Modify

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#5900 closed patch (duplicate)

AO: Generalise upmix and AC-3 encoding

Reported by: foobum@… Owned by: jyavenard
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords: AC-3 upmix passthru
Cc: mark@… Ticket locked: no

Description

This patch generalises the upmix / AC-3 (re)encode functionality. Main thing is that it makes upmix and encode to DD5.1 work.

Also:

  • Fix resampler clipping
  • Turn on resampler where sr != 48k [1]
  • Fix passthru where main dev:subdev == passthru dev:subdev [2]
  • Add keybind (Ctrl+U) / OSD menu option to toggle upmixing
  • Preserve timestretch across stream changes / upmix toggles
  • Small change to freesurround params

[1] Recent versions of ALSA will do this if we don't. The SRC we use is much better quality.

[2] Like my nvidia CK804

Patches against fixes and trunk attached. Tested on fixes only.

Attachments (48)

audioencoding-fixes.patch (62.6 KB) - added by foobum@… 9 years ago.
audioencoding-trunk.patch (61.8 KB) - added by foobum@… 9 years ago.
mythmusic-toggle-upmix.patch (1.9 KB) - added by foobum@… 9 years ago.
freesurround.patch (9.0 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-1.patch (76.5 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-1.patch (77.1 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-2.patch (76.7 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-2.patch (77.3 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-3.patch (77.7 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-3.patch (78.6 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-4.patch (83.8 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-4.2.patch (83.8 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-4.patch (83.3 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-5.patch (86.4 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-5.patch (85.3 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-6.patch (85.5 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-6.patch (86.5 KB) - added by foobum@… 9 years ago.
00-5900-audioencoding-trunk-6.1.patch (84.5 KB) - added by Matthew Wire <devel@…> 9 years ago.
Fix for avformatdecoder.cpp so it compiles post vdpau changes
ticket5900@trunk19685.diff (79.9 KB) - added by Markus Schulz <msc@…> 9 years ago.
works with trunk@19685
audioencoding-trunk-6-r19916.patch (85.5 KB) - added by foobum@… 9 years ago.
against r19916
audioencoding-trunk-6-r20019.patch (85.2 KB) - added by foobum@… 9 years ago.
audioencoding-trunk-6-r20101.patch (86.0 KB) - added by foobum@… 9 years ago.
audioencoding-fixes-jya7.patch (89.9 KB) - added by jyavenard@… 8 years ago.
AC3 upmixer for 0.21-fixes
audioencoding-fixes-vdpau-jya7.patch (91.0 KB) - added by jyavenard@… 8 years ago.
AC3 upmixer for 0.21-fixes with VDPAU backport
audioencoding-trunk-jya7.patch (88.0 KB) - added by jyavenard@… 8 years ago.
AC3 upmixer for trunk (tested on 20533)
audioencoding-trunk-jya8.patch (88.1 KB) - added by jyavenard@… 8 years ago.
AC3 upmixer for trunk (tested on 20545).. Forgot change on mythmusic
audioencoding-fixes-jya10.patch (91.3 KB) - added by jyavenard@… 8 years ago.
patch for 0.21-fixes
audioencoding-fixes-vdpau-jya10.patch (92.3 KB) - added by jyavenard@… 8 years ago.
Patch for 0.21-fixes after VDPAU patches have been applied
audioencoding-trunk-jya10.patch (89.4 KB) - added by jyavenard@… 8 years ago.
Patch for trunk (20600)
audioencoding-fixes-jya13.patch (91.8 KB) - added by jyavenard@… 8 years ago.
patch for 0.21-fixes
audioencoding-trunk-jya13.patch (90.0 KB) - added by jyavenard@… 8 years ago.
Patch for trunk (20600)
audioencoding-trunk-jya14.patch (90.1 KB) - added by jyavenard@… 8 years ago.
Patch for trunk (20651)
audioencoding-fixes-jya14.patch (92.0 KB) - added by jyavenard@… 8 years ago.
patch for 0.21-fixes
audioencoding-fixes-jya15.patch (80.7 KB) - added by jyavenard@… 8 years ago.
patch for 0.21-fixes (work with vdpau backport now)
audioencoding-trunk-jya15.patch (78.0 KB) - added by jyavenard@… 8 years ago.
Patch for trunk (20651)
audioencoding-trunk-7.patch (105.2 KB) - added by foobum@… 8 years ago.
against r20844
audioencoding-fixes-7.patch (131.5 KB) - added by foobum@… 8 years ago.
against r20844
audioencoding-fixes-7.1.patch (105.2 KB) - added by foobum@… 8 years ago.
audioencoding-trunk-7.1.patch (105.2 KB) - added by foobum@… 8 years ago.
audioencoding-fixes-7.2.patch (131.5 KB) - added by foobum@… 8 years ago.
audioencoding-trunk-7.2.patch (105.3 KB) - added by foobum@… 8 years ago.
audioencoding-fixes-7.3.patch (131.6 KB) - added by foobum@… 8 years ago.
ac3-error.log (8.8 KB) - added by Markus Schulz <msc@…> 8 years ago.
error with 5.1ch ac3-re-encoded files
audioencoding-trunk-7.3.patch (108.1 KB) - added by foobum@… 8 years ago.
audioencoding-trunk-7.3-mt.patch (100.7 KB) - added by Marc Tousignant <drayson@…> 8 years ago.
audioencoding-trunk-7.3-mt2.patch (100.8 KB) - added by Marc Tousignant <drayson@…> 8 years ago.
audioencoding-trunk-7.4.diff (86.4 KB) - added by jyavenard 8 years ago.
For trunk #21594
audioencoding-trunk-7.5.diff (87.1 KB) - added by jyavenard 8 years ago.
Against trunk r21594

Change History (113)

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:1 Changed 9 years ago by foobum@…

Added a patch that makes upmixed audio sound a lot better. Should apply to fixes or trunk and before or after the audioencoding patch.

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:2 Changed 9 years ago by foobum@…

New versions of the patches that merge the previous. Also allow disabling of the resampler if setting DisableResampler is true. Only people with cards (and receivers) that support a range of srates, a conviction that ALSA isn't resampling for them and ultra sensitive ears need set it :).

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:3 Changed 9 years ago by foobum@…

Make disable_resampler protected so that children (like pulseaudio) are able to choose.

comment:4 follow-up: Changed 9 years ago by Markus Schulz <msc@…>

nice patch. Changing Volume thru internal mythtv volume controls would be nice and perfect if original DD5.1 streams could be decoded/do volume change/encoded in one step to change the volume for each stream without using the AV-Receiver remote control anymore. I know there was a bit of quality loss but more comfort.

comment:5 Changed 9 years ago by Markus Schulz <msc@…>

mythmusic dont work (@trunk), there was no audio output unless i disable the upmixer (STRG+U). mythvideo works fine.

logoutput for starting playback in mythmusic with "-v audio":

2008-11-14 13:05:08.787 AO: Creating AC-3 Encoder 2008-11-14 13:05:08.787 DEnc: Init codecid=AC3, br=448000, sr=48000, ch=6 re=0 2008-11-14 13:05:08.788 DigitalEncoder::Init fs=1536, bpf=12 ofb=18432 2008-11-14 13:05:08.788 AO: Using resampler. From: 44100 to 48000 2008-11-14 13:05:08.788 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-14 13:05:08.788 Setting IEC958 status bits 2008-11-14 13:05:08.789 Opening ALSA audio device 'default'. 2008-11-14 13:05:08.789 in SetParameters?(format=2, channels=2, rate=48000, buffer_time=400000, period_time=25000) 2008-11-14 13:05:08.790 get_buffer_size returned 16384 2008-11-14 13:05:08.790 set_period_time_near returned 21333 2008-11-14 13:05:08.790 get_period_size returned 1024 2008-11-14 13:05:08.794 Opening mixer default 2008-11-14 13:05:08.796 Setting Master volume to 100 2008-11-14 13:05:08.796 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.796 channel 0 vol set to 100 2008-11-14 13:05:08.796 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.796 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.796 ALSA: channel 0 playback switch set to 1 2008-11-14 13:05:08.796 Setting Master volume to 100 2008-11-14 13:05:08.796 mixer unable to find control Master 1 2008-11-14 13:05:08.797 Setting PCM volume to 92 2008-11-14 13:05:08.797 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.798 channel 0 vol set to 92 2008-11-14 13:05:08.798 ALSA: channel 0 playback switch set to 1 2008-11-14 13:05:08.798 Setting PCM volume to 92 2008-11-14 13:05:08.798 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.798 channel 1 vol set to 92 2008-11-14 13:05:08.798 ALSA: channel 1 playback switch set to 1 2008-11-14 13:05:08.798 Volume range is 0 to 100, mult=1 2008-11-14 13:05:08.798 AO: Audio fragment size: 6144 2008-11-14 13:05:08.799 AO: create upmixer 2008-11-14 13:05:08.801 AO: Create upmixer done with surround mode 2 2008-11-14 13:05:08.801 AO: Audio Stretch Factor: 1 2008-11-14 13:05:08.802 AO: Ending reconfigure 2008-11-14 13:05:08.802 AO: kickoffOutputAudioLoop: pid = 21254 2008-11-14 13:05:08.802 AO: OutputAudioLoop?: Play Event 2008-11-14 13:05:08.804 AO: OutputAudioLoop?: Play Event

I don't see where he sets the IEC958 status bits like in mythvideo:

2008-11-14 13:09:02.646 AO: Creating AC-3 Encoder 2008-11-14 13:09:02.646 DEnc: Init codecid=AC3, br=448000, sr=48000, ch=6 re=0 2008-11-14 13:09:02.647 DigitalEncoder::Init fs=1536, bpf=12 ofb=18432 2008-11-14 13:09:02.647 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-14 13:09:02.647 Setting IEC958 status bits 2008-11-14 13:09:02.648 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2008-11-14 13:09:02.649 in SetParameters?(format=2, channels=2, rate=48000, buffer_time=400000, period_time=25000)

hope this helps.

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:6 Changed 9 years ago by foobum@…

In latest versions of the patch (-3):

  • Fix analog out (use AC3PassThru setting rather than passthru_dev.isEmpty)
  • Fix downmixing (restore a few lines in avfdecoder that were removed in error)
  • Fix mythmusic upmixed AC-3 output (give OpenAudio?() the configured passthru dev)

comment:7 Changed 9 years ago by Markus Schulz <msc@…>

still not working:

mythmusic: 2008-11-15 10:43:55.268 AO: Using resampler. From: 44100 to 48000 2008-11-15 10:43:55.269 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-15 10:43:55.269 Setting IEC958 status bits 2008-11-15 10:43:55.272 Opening ALSA audio device 'default'. 2008-11-15 10:43:55.283 mixer unable to find control Master 1 2008-11-15 10:43:55.295 AO: Using resampler. From: 44100 to 48000 2008-11-15 10:43:55.296 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-15 10:43:55.297 Setting IEC958 status bits 2008-11-15 10:43:55.297 Opening ALSA audio device 'default'. 2008-11-15 10:43:55.299 mixer unable to find control Master 1

mythvideo: 2008-11-15 10:44:37.517 AFD: Opened codec 0x9bb1b20, id(MPEG4) type(Video) 2008-11-15 10:44:37.517 AFD: codec MP3 has 2 channels 2008-11-15 10:44:37.531 AFD: Opened codec 0xbd40c50, id(MP3) type(Audio) 2008-11-15 10:44:37.539 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-15 10:44:37.539 Setting IEC958 status bits 2008-11-15 10:44:37.539 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2008-11-15 10:44:37.546 mixer unable to find control Master 1 2008-11-15 10:44:37.554 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-15 10:44:37.554 Setting IEC958 status bits 2008-11-15 10:44:37.555 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2008-11-15 10:44:37.557 mixer unable to find control Master 1 2008-11-15 10:44:37.559 LCD: Set AVFormat to Codec 86017 2008-11-15 10:44:37.566 Opening audio device 'default'. ch 2(2) sr 48000 2008-11-15 10:44:37.566 Setting IEC958 status bits 2008-11-15 10:44:37.566 Opening ALSA audio device 'iec958:{ AES0 0x02 }'

looks like the wrong audio device would be opened (default versus ice958:..).

comment:8 Changed 9 years ago by Markus Schulz <msc@…>

TODO: Error checking that device is opened correctly! m_output = AudioOutput::OpenAudio?(adevice, pdevice, 16, 2, 44100,

AUDIOOUTPUT_MUSIC, true, true);

With this change in musicplayer.cpp it works (last param changed from false=>true for enabling passthru).

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:9 follow-up: Changed 9 years ago by foobum@…

In lastest (-4):

  • Fix typo in trunk version of patch
  • Fix mm visualisation update when upmixing
  • Decode 32k AC-3 streams (don't know any cards that can pass these)
  • Reset IEC status when we're finished in aoALSA
  • Small tidy in avfdecoder and aoALSA

Perhaps useful to add that, in current shape, this patch probably addresses #2813, #4819, #5271, #5384 and #5477

comment:10 in reply to: ↑ 9 ; follow-up: Changed 9 years ago by anonymous

Replying to foobum@gmail.com:

Perhaps useful to add that, in current shape, this patch probably addresses #2813, #4819, #5271, #5384 and #5477

The patch does fix #4819. I no longer have any recordings with the issue I mention in #2813 so cannot test it.

comment:11 in reply to: ↑ 10 Changed 9 years ago by ylee@…

Comment to get on CC: list

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:12 Changed 9 years ago by foobum@…

In latest (-5):

  • Add SRC quality setting (Setup -> General) with other audio settings
  • Fix mythmusic visualisation update when doing SRC

Those who wanted to disable the SRC should now do so by setting the Sample Rate Conversion setting to 'Disabled' in the Setup/General? screens. The 'DisableResampler' setting no longer does anything.

Changed 9 years ago by foobum@…

Changed 9 years ago by foobum@…

comment:13 Changed 9 years ago by foobum@…

In latest (-6):

  • Prevent upmix toggle when MaxChannels == 2
  • Properly handle no spdif device in SetIECStatus()

Been tested with both analog and spdif out. Think this is pretty much done now..

comment:14 Changed 9 years ago by elkin@…

hi, I am currently using audioencoding-fixes-6.patch and it works, thanks foobum! but I had to manually apply a few lines, as it does not cleanly apply to mythtv - 0.21.0+fixes19084.

I use it on a MythBuntu? machine doing analog 5.1 output to a 10 year old Dolby Surround receiver. Besides it being really cool to support this, the base is much better now.

I know I am not supposed to be asking for features in trac, but it's Christmas: I would like to be able to preset the upmix toggle to "off" by default, and to be able to switch between 2ch and 5.1ch mode. Possible? It seems like #5477 was closed because this patch should do this, but just disabling upmix leaves me with all sound coming out of all 5 speakers and not only the desired 2ch stereo.

Changed 9 years ago by Matthew Wire <devel@…>

Fix for avformatdecoder.cpp so it compiles post vdpau changes

comment:15 Changed 9 years ago by anonymous

This patch addresses a lot of other tickets it seems. Any chance of this getting looked at by the devs in the near future?

comment:16 follow-up: Changed 9 years ago by elkin@…

Hi Foobum, I wanted to continue testing this patch set, but I just can't get it to apply anymore to rev 0.21 19556 fixes. Could you post an updated diff? thanks!

comment:17 in reply to: ↑ 16 Changed 9 years ago by elkin@…

Replying to elkin@elkin.de:

Hi Foobum, I wanted to continue testing this patch set, but I just can't get it to apply anymore to rev 0.21 19556 fixes. Could you post an updated diff? thanks!

oh well, replying to my own comment: patching with version 6 works with revision 19626

Changed 9 years ago by Markus Schulz <msc@…>

works with trunk@19685

comment:18 Changed 9 years ago by Markus Schulz <msc@…>

i've upped a version which works with current trunk. i hope this ticket will be applied soon (and with an actual version from foobum)

Changed 9 years ago by foobum@…

against r19916

comment:19 Changed 9 years ago by foobum@…

Same patch, updated for r19916 of trunk

comment:20 in reply to: ↑ 4 Changed 9 years ago by foobum@…

Replying to Markus Schulz <msc@antzsystem.de>:

Changing Volume thru internal mythtv volume controls would be nice and perfect if original DD5.1 streams could be decoded/do volume change/encoded in one step to change the volume for each stream without using the AV-Receiver remote control anymore. I know there was a bit of quality loss but more comfort.

See #6279

Changed 9 years ago by foobum@…

comment:21 Changed 9 years ago by foobum@…

Please ignore audioencoding-trunk-6-r19916.patch - I uploaded the wrong file. This is the right one, updated for r20019 of trunk.

comment:22 follow-up: Changed 9 years ago by Simon Kenyon <simon@…>

mythtv/libs/libmythtv/tv_play.cpp has changed quite a bit do you think it would be possible to update this again?

comment:23 follow-up: Changed 9 years ago by Markus Schulz <msc@…>

Channel mapping is wrong with DTS audio (tested with several dts movies) and other multichannel movies (for example apple trailers from www.apple.com/trailers/).

comment:24 follow-up: Changed 9 years ago by Markus Schulz <msc@…>

Sticky Keys forward/backward produces errors cause audio was not disabled.

comment:25 Changed 9 years ago by anonymous

Tried the patch, it's setting the wrong device when going into time stretch. Shouldn't be disabling passthru and shouldn't try to use ALSA:default instead of ALSA:iec958

2009-03-03 01:31:01.669 TV: Attempting to change from None to Watching WatchingPreRecorded? 2009-03-03 01:31:01.703 RemoteFile?(myth://192.168.1.150:6543/2251_20090227195900.mpg) 2009-03-03 01:31:01.703 TV: StartPlayer?(0, Watching WatchingPreRecorded?, main) -- begin 2009-03-03 01:31:02.234 AFD: Opened codec 0x7f8d54b1f350, id(MPEG2VIDEO) type(Video) 2009-03-03 01:31:02.234 AFD: codec AC3 has 2 channels 2009-03-03 01:31:02.234 AFD: Opened codec 0x7f8d54b22e50, id(AC3) type(Audio) 2009-03-03 01:31:02.234 AFD: Audio Track #1 is A/V stream #1 and has 2 channels in the English language(6647399). 2009-03-03 01:31:02.234 AFD: Selected track 1: English AC3 2ch (A/V Stream #1) 2009-03-03 01:31:02.234 AFD: Initializing audio parms from audio track #1 2009-03-03 01:31:02.234 AFD: Audio format changed

from id(NONE) -1Hz -1ch 0bps to id( AC3) 48000Hz 2ch 16bps pt

2009-03-03 01:31:02.238 AO: Killing AudioOutputDSP 2009-03-03 01:31:02.238 Opening audio device 'default '. ch 2(2) sr 48000 2009-03-03 01:31:02.238 Setting IEC958 status: non-audio 2009-03-03 01:31:02.239 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2009-03-03 01:31:02.241 in SetParameters?(format=2, channels=2, rate=48000, buffer_time=400000, period_time=25000) 2009-03-03 01:31:02.241 get_buffer_size returned 16384 2009-03-03 01:31:02.241 set_period_time_near returned 25000 2009-03-03 01:31:02.241 get_period_size returned 1200 2009-03-03 01:31:02.245 Opening mixer default 2009-03-03 01:31:02.247 Setting Master volume to 98 2009-03-03 01:31:02.247 Volume range is 0 to 31, mult=3.22581 2009-03-03 01:31:02.247 channel 0 vol set to 30 2009-03-03 01:31:02.247 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.247 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.247 ALSA: channel 0 playback switch set to 1 2009-03-03 01:31:02.248 Setting Master volume to 98 2009-03-03 01:31:02.248 Volume range is 0 to 31, mult=3.22581 2009-03-03 01:31:02.248 channel 1 vol set to 30 2009-03-03 01:31:02.248 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.248 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.248 ALSA: channel 1 playback switch set to 1 2009-03-03 01:31:02.249 Setting PCM volume to 4 2009-03-03 01:31:02.249 Volume range is 0 to 31, mult=3.22581 2009-03-03 01:31:02.249 channel 0 vol set to 1 2009-03-03 01:31:02.249 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.249 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.249 ALSA: channel 0 playback switch set to 1 2009-03-03 01:31:02.249 Setting PCM volume to 4 2009-03-03 01:31:02.249 Volume range is 0 to 31, mult=3.22581 2009-03-03 01:31:02.250 channel 1 vol set to 1 2009-03-03 01:31:02.250 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.250 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.250 ALSA: channel 1 playback switch set to 1 2009-03-03 01:31:02.250 Volume range is 0 to 100, mult=1 2009-03-03 01:31:02.250 AO: Audio fragment size: 6144 2009-03-03 01:31:02.251 AO: Audio Stretch Factor: 1 2009-03-03 01:31:02.251 AO: Ending reconfigure 2009-03-03 01:31:02.251 AO: no change exiting 2009-03-03 01:31:02.251 AO: kickoffOutputAudioLoop: pid = 20131 2009-03-03 01:31:02.251 AO: OutputAudioLoop?: Play Event 2009-03-03 01:31:02.390 AO: no change exiting 2009-03-03 01:31:02.390 AO: Pause 1 2009-03-03 01:31:02.391 AO: OutputAudioLoop?: audio paused 2009-03-03 01:31:02.484 OSD Theme Dimensions W: 640 H: 480 2009-03-03 01:31:02.877 AO: Pause 1 2009-03-03 01:31:02.877 TV: StartPlayer?(0, Watching WatchingPreRecorded?, main) -- end ok 2009-03-03 01:31:02.878 TV: Changing from None to Watching WatchingPreRecorded? 2009-03-03 01:31:02.878 New DB connection, total: 3 2009-03-03 01:31:02.879 AO: OutputAudioLoop?: audio paused 2009-03-03 01:31:02.880 Using realtime priority. 2009-03-03 01:31:02.881 Connected to database 'mythconverg' at host: 192.168.1.150 2009-03-03 01:31:02.884 Video timing method: RTC 2009-03-03 01:31:02.947 AO: Pause 0 2009-03-03 01:31:02.948 AO: OutputAudioLoop?: Play Event

2009-03-03 01:31:08.636 AFD: Disabling pass through 2009-03-03 01:31:08.636 AFD: Initializing audio parms from audio track #1 2009-03-03 01:31:08.636 AFD: Audio format changed

from id( AC3) 48000Hz 2ch 16bps pt to id( AC3) 48000Hz 2ch 16bps

2009-03-03 01:31:08.636 AO: SetEffDsp?: 4800000 2009-03-03 01:31:08.636 AO: Killing AudioOutputDSP 2009-03-03 01:31:08.638 AO: OutputAudioLoop?: Stop Event 2009-03-03 01:31:08.639 AO: kickoffOutputAudioLoop exiting 2009-03-03 01:31:08.639 Opening audio device 'default '. ch 2(2) sr 48000 2009-03-03 01:31:08.639 Setting IEC958 status: audio 2009-03-03 01:31:08.639 Opening ALSA audio device 'default '. ALSA lib pcm.c:2202:(snd_pcm_open_noupdate) Unknown PCM default

2009-03-03 01:31:08.639 AudioOutput? Error: snd_pcm_open(default ): No such file or directory 2009-03-03 01:31:08.639 AO, ERROR: Aborting reconfigure 2009-03-03 01:31:08.639 Aborting reconfigure 2009-03-03 01:31:08.639 AO: Using time stretch 0.95 2009-03-03 01:31:12.271 Marking recording as unwatched 2009-03-03 01:31:12.312 TV: Attempting to change from Watching WatchingPreRecorded? to None 2009-03-03 01:31:12.343 AO: Killing AudioOutputDSP 2009-03-03 01:31:12.343 Setting IEC958 status: audio 2009-03-03 01:31:12.360 TV: Changing from Watching WatchingPreRecorded? to None 2009-03-03 01:31:14.213 NetworkControl?: Socket disconnected 2009-03-03 01:31:15.193 Deleting UPnP client...

comment:26 follow-up: Changed 9 years ago by davatar@…

Correction to the above, the patch mostly works as long as the "max channels" is set to 5.1, then all sound is 5.1 AC3 encoded. However I get digital clipping and (no volume control) when getting upmix from analog TV recordings.

comment:27 in reply to: ↑ 23 Changed 9 years ago by foobum@…

Replying to Markus Schulz <msc@antzsystem.de>:

Channel mapping is wrong with DTS audio (tested with several dts movies) and other multichannel movies (for example apple trailers from www.apple.com/trailers/).

Wrong ticket - DTS is not touched with this one. Will fix in next patch on #6279.

comment:28 in reply to: ↑ 24 Changed 9 years ago by foobum@…

Replying to Markus Schulz <msc@antzsystem.de>:

Sticky Keys forward/backward produces errors cause audio was not disabled.

Can't reproduce - seeking with sticky keys enabled works fine for me. Please send -v playback,audio logs (via mail, not here please).

comment:29 in reply to: ↑ 26 ; follow-up: Changed 9 years ago by foobum@…

Replying to davatar@comcast.net:

Correction to the above, the patch mostly works as long as the "max channels" is set to 5.1, then all sound is 5.1 AC3 encoded. However I get digital clipping and (no volume control) when getting upmix from analog TV recordings.

The timestretched, stereo AC-3 'issue' is intended behaviour on the basis that there's no point reencoding stereo material. You should have a valid default device defined (even if it's the the same as the passthru device). I might change this.

I've never experienced any clipping - could you provide a sample and some logs?

Software volume control can be found at #6279

Changed 9 years ago by foobum@…

comment:30 in reply to: ↑ 22 Changed 9 years ago by foobum@…

Replying to Simon Kenyon <simon@koala.ie>:

mythtv/libs/libmythtv/tv_play.cpp has changed quite a bit do you think it would be possible to update this again?

Updated for r20101 of trunk.

comment:31 in reply to: ↑ 29 ; follow-up: Changed 9 years ago by davatar@…

Replying to foobum@gmail.com:

Replying to davatar@comcast.net:

Correction to the above, the patch mostly works as long as the "max channels" is set to 5.1, then all sound is 5.1 AC3 encoded. However I get digital clipping and (no volume control) when getting upmix from analog TV recordings.

The timestretched, stereo AC-3 'issue' is intended behaviour on the basis that there's no point reencoding stereo material. You should have a valid default device defined (even if it's the the same as the passthru device). I might change this.

I've never experienced any clipping - could you provide a sample and some logs?

Nothing is logged for this and I don't know how to save the AC3 output stream. Source was analog stereo capture, I simply turned down the capture volume.

Also there is a point to re-encoding (or passing through) stereo material properly - if stereo material is always output to 5.1 AC3, then the sound system's dolby prologic decoding is defeated. This would work if stereo PCM or stereo AC3 streams were output as stereo AC3 and not 5.1, unless the prologic decoding can be done in software on the upmix???

comment:32 in reply to: ↑ 31 Changed 9 years ago by foobum@…

Replying to davatar@comcast.net:

This would work if stereo PCM or stereo AC3 streams were output as stereo AC3 and not 5.1, unless the prologic decoding can be done in software on the upmix???

It can. But to be clear, had you left maxchannels = 2 you would have got stereo PCM from timestretched stereo AC-3 if you had defined a default device (ALSA:iec958 perhaps).

comment:33 Changed 9 years ago by Matthew Wire <devel@…>

The resampler breaks playback for me here. Stuttering and highspeed playback suggesting it's being resampled twice. This is a vanilla ubuntu 8.10 install with digital sound via usb (default device). It works fine when resampler is disabled.

I suggest that the resampler defaults to disabled since this will allow all(?) configurations to work out of the box.

comment:34 Changed 9 years ago by foobum@…

Not seen this in my testing on various boxen including an Ubuntu one. Do you know what sample rates your device supports?

comment:35 Changed 9 years ago by Matthew Wire <devel@…>

Sorry for the delay in getting back to you. It seems to work fine now with the resampler enabled. I guess it must have been a glitch somewhere on my system.

comment:36 Changed 8 years ago by marklgoldberg@…

It appears that with AC3 5.1 sources output to alsa analog audio out the channel mapping is incorrect. See http://www.gossamer-threads.com/lists/mythtv/users/379886 for more info.

comment:37 Changed 8 years ago by jyavenard@…

Following is a set of updates for 0.21-fixes, 0.21-fixes with VDPAU backport and trunk..

What those patches do is merge the original mythtv audio code, with the newer upmixer one so you can fully turn off the upmixer.

Some people have reported issues with the AC3 upmixer with the channel mapping being incorrect.

This patch adds a new entry in Setup -> General -> Audio, adding a new AC3 upmixer entry. If unckecked (the default) this runs the original mythtv code; if checked the new AC3 upmix is used.

Changed 8 years ago by jyavenard@…

AC3 upmixer for 0.21-fixes

Changed 8 years ago by jyavenard@…

AC3 upmixer for 0.21-fixes with VDPAU backport

Changed 8 years ago by jyavenard@…

AC3 upmixer for trunk (tested on 20533)

Changed 8 years ago by jyavenard@…

AC3 upmixer for trunk (tested on 20545).. Forgot change on mythmusic

comment:38 Changed 8 years ago by jyavenard@…

The following patch will fix the issue mentioned earlier with channels mapping being incorrect between ALSA and AC3.

Patches follow for trunk (20600) 0.21-fixes and 0.21-fixes with VDPAU backport

Changed 8 years ago by jyavenard@…

patch for 0.21-fixes

Changed 8 years ago by jyavenard@…

Patch for 0.21-fixes after VDPAU patches have been applied

Changed 8 years ago by jyavenard@…

Patch for trunk (20600)

comment:39 Changed 8 years ago by jyavenard@…

The previous patch broke multi-channels AAC playback.

This new patch only perform a channel re-order if the original audio format is AC3, is multi-channel and passhtru is disabled.

Changed 8 years ago by jyavenard@…

patch for 0.21-fixes

Changed 8 years ago by jyavenard@…

Patch for trunk (20600)

comment:40 Changed 8 years ago by jyavenard@…

Fix AC3upmixer problem with mythmusic, sometimes you would get no sound at all...

Changed 8 years ago by jyavenard@…

Patch for trunk (20651)

Changed 8 years ago by jyavenard@…

patch for 0.21-fixes

comment:41 Changed 8 years ago by jyavenard@…

Hopefully the last revision in a while. Patch #15 This fix software volume if the original stream is 5.1 AC3

Changed 8 years ago by jyavenard@…

patch for 0.21-fixes (work with vdpau backport now)

Changed 8 years ago by jyavenard@…

Patch for trunk (20651)

comment:42 Changed 8 years ago by Markus Schulz <msc@…>

i have problems with trunk@20650 and vdpau with interlaced content, it stutters alot:

2009-07-07 20:59:10.129 NVP(0): Video is 3.22435 frames behind audio (too slow), dropping frame to catch up. 'video_output' mean = '40478,59', std. dev. = '26333,50', fps = '24,70' 2009-07-07 20:59:12.920 NVP(0): Video is 3.52245 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:12.921 NVP(0): Video is 3.67933 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:12.921 NVP(0): Video is 3.54697 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:12.921 NVP(0): Video is 3.19773 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:15.140 NVP(0): Video is 3.16097 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:15.140 NVP(0): Video is 3.14573 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:16.132 NVP(0): Video is 3.18208 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:16.132 NVP(0): Video is 3.36155 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:16.132 NVP(0): Video is 3.24615 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:16.385 NVP(0): 1200 interlaced frames seen. 'video_output' mean = '38457,14', std. dev. = '30836,89', fps = '26,00' 2009-07-07 20:59:19.191 NVP(0): Video is 3.03428 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:19.191 NVP(0): Video is 3.2382 frames behind audio (too slow), dropping frame to catch up. 2009-07-07 20:59:19.191 NVP(0): Video is 3.14115 frames behind audio (too slow), dropping frame to catch up. 'video_output' mean = '41060,94', std. dev. = '29755,94', fps = '24,35' 2009-07-07 20:59:21.400 NVP(0): Video is 3.44955 frames behind audio (too slow), dropping frame to catch up.

it's curious that's almost 3 frames, perhaps it has something todo with the ac3-encoder buffering.

if i switch the deinterlacing to progressive or view progressive content it works fine:

'video_output' mean = '39997,32', std. dev. = '1577,19', fps = '25,00' 'video_output' mean = '39997,25', std. dev. = '49,07', fps = '25,00' 'video_output' mean = '39997,73', std. dev. = '269,19', fps = '25,00' 'video_output' mean = '39997,56', std. dev. = '900,24', fps = '25,00' 2009-07-07 21:26:16.818 NVP(3): 22800 progressive frames seen. 'video_output' mean = '39997,75', std. dev. = '75,89', fps = '25,00' 'video_output' mean = '39997,66', std. dev. = '87,85', fps = '25,00' 'video_output' mean = '39997,72', std. dev. = '1011,71', fps = '25,00' 'video_output' mean = '39997,67', std. dev. = '411,33', fps = '25,00' 2009-07-07 21:26:32.818 NVP(3): 23200 progressive frames seen. 'video_output' mean = '39997,63', std. dev. = '76,92', fps = '25,00' 'video_output' mean = '39997,26', std. dev. = '49,30', fps = '25,00'

it works fine without ac3encoder (disabled) for both interlaced _and_ progressive content. any idea?

comment:43 Changed 8 years ago by jyavenard@…

3 frames is not a random figure but how much MythTV will let the video/audio slip out of sync.

For the time being, until I resolve this issue, change the Upmix conversion rate to "Passive" (I'm guessing you are using Active Linear). This is what making run out of sync.

comment:44 Changed 8 years ago by Markus Schulz <msc@…>

Using "passive" dont help. same problem...

Changed 8 years ago by foobum@…

against r20844

Changed 8 years ago by foobum@…

against r20844

comment:45 Changed 8 years ago by foobum@…

New versions against r20844 include automatic detection of sample rates supported by the hardware (for ALSA, OSS, JACK at least) and therefore remove the 'Disabled' SRC quality setting.

Also, we now pass a CODEC_ID to audiooutput so we can make better choices there, such as whether to reencode 2ch AC-3/DTS (which we now do).

Finally, lavc modified so that AC-3 and DTS decoders emit ALSA channel ordering. We now reorder channels to 6ch AC-3 format unconditionally in audiooutputdigitalencoder. Should fix analog channel order problems with AC-3.

comment:46 Changed 8 years ago by anonymous

mythmusic r20844 trunk fails with the trunk patch.

cddecoder.cpp:17:35: error: mythtv/ffmpeg/avcodec.h: No such file or directory cddecoder.cpp: In member function 'virtual bool CdDecoder::initialize()': cddecoder.cpp:153: error: 'CODEC_ID_PCM_S16LE' was not declared in this scope make[2]: * [cddecoder.o] Error 1 make[2]: * Waiting for unfinished jobs.... make[2]: Leaving directory `/var/tmp/portage/media-plugins/mythmusic-svn-9999/work/mythmusic/mythmusic/mythmusic' make[1]: * [sub-mythmusic-make_default] Error 2 make[1]: Leaving directory `/var/tmp/portage/media-plugins/mythmusic-svn-9999/work/mythmusic/mythmusic' make: * [sub-mythmusic-make_default] Error 2

I believe the correct include is mythtv/libavcodec/avcodec.h Or atleast that is what allowed me to compile.

Changed 8 years ago by foobum@…

Changed 8 years ago by foobum@…

comment:47 Changed 8 years ago by foobum@…

Fix mythplugins compilation.

Changed 8 years ago by foobum@…

comment:48 Changed 8 years ago by foobum@…

Oops. Ignore fixes-7.1 - uploaded wrong file, correct one is fixes-7.2.

comment:49 Changed 8 years ago by Markus Schulz <msc@…>

the channel ordering (or similar problem, i get no speech thru center speaker) seems to be wrong for decoded(5.1 AC3) + encoded (cause of softvolume) 5.1 audio streams. If i disable softvolume the same stream sounds ok.

comment:50 Changed 8 years ago by foobum@…

Hm. Odd. Works fine for me. Is the source audio definitely AC-3? Are you using the latest softvol patch? Is CONFIG_AC3_DECODER == 1 and ENABLE_LIBA52_DECODER == 0 in config.h?

In latest patch we now convert to alsa channel order in ac3dec.c and convert to AC-3 channel order unconditionally in audiooutputdigitalencoder.cpp. Logically, this should be correct and appears that way to me..

Changed 8 years ago by foobum@…

Changed 8 years ago by foobum@…

comment:51 follow-up: Changed 8 years ago by foobum@…

In latest (trunk-7.2, fixes-7.3): don't incorrectly reorder stereo AC-3.

comment:52 Changed 8 years ago by Markus Schulz <msc@…>

7.2 dont fix the problem. after some more tests i don't think it's a channel ordering problem, cause i get _no_ audio from rear-speakers, most of the sound comes thru the center speaker but this sounds more like a rear-channel (audio was a little bit muffled).

I've attached a logfile (-v audio) where i switch to a 2ch-ac3 stream (upmixed and sounds good) and a 5.1ch-ac3 stream (error case). Perhaps you can see here some details..

Changed 8 years ago by Markus Schulz <msc@…>

error with 5.1ch ac3-re-encoded files

comment:53 Changed 8 years ago by anonymous

r20883 breaks current patch on trunk.

comment:54 in reply to: ↑ 51 ; follow-up: Changed 8 years ago by anonymous

Replying to foobum@gmail.com:

In latest (trunk-7.2, fixes-7.3): don't incorrectly reorder stereo AC-3.

fixes-7.3 won't compile as it is, as it refers to files within the nonexistent mfd directory.

Changed 8 years ago by foobum@…

comment:55 in reply to: ↑ 54 ; follow-up: Changed 8 years ago by foobum@…

Replying to anonymous:

fixes-7.3 won't compile as it is, as it refers to files within the nonexistent mfd directory.

Sounds like you're trying to apply the fixes patch against trunk.

comment:56 Changed 8 years ago by foobum@…

audioencoding-trunk-7.3 is against r21011 and should hopefully fix the channel ordering issues, which were a result of recent ffmpeg merge (ffmpeg now uses SMPTE channel ordering for default input/output to most encoders/decoders). Markus Schulz did the hard work in addressing this.

Changed 8 years ago by Marc Tousignant <drayson@…>

comment:57 Changed 8 years ago by Marc Tousignant <drayson@…>

21108 breaks trunk-7.3 The attached allows the patch to once again apply and compile. However, I am not sure of the effects of 21108 on the patch itself.

comment:58 Changed 8 years ago by jyavenard

  • Owner changed from ijr to jyavenard
  • Status changed from new to assigned

comment:59 in reply to: ↑ 55 Changed 8 years ago by jyavenard

Replying to foobum@gmail.com:

Replying to anonymous:

fixes-7.3 won't compile as it is, as it refers to files within the nonexistent mfd directory.

Sounds like you're trying to apply the fixes patch against trunk.

I'm experiencing the same issue. fixes-7.3 do not properly apply to 0.21-fixes having references to a mfd directory.

Hard to guess from that if there is anything else broken in that patch.

Changed 8 years ago by Marc Tousignant <drayson@…>

comment:60 Changed 8 years ago by Marc Tousignant <drayson@…>

r21567 caused the patch to fail. This patch corrects the issues with applying the old patch.

comment:61 Changed 8 years ago by jyavenard

Note that the channel ordering on all patches for trunk are completely out of whack... It also doesn't compile for JACK...

You can try the following short file: http://www.avenard.org/files/media/videotest/channelsPLII.mpg

It is PLII test audio track playing on each discrete speaker ; it works beautifully on 0.21-fixes.

I am working on those issues with foobum.

I will also close this ticket soon, and move to another one aim at simplifying the audio system on myth and the configuration. This upmixer is part of it.

comment:62 Changed 8 years ago by jyavenard

audioencoding-trunk-7.4.diff

Fix channel order (Pro-Logic II files above now plays fine). Fix regression when mythfrontend can't open audio card Fix JACK compilation issue Rewrite GetSupportedRates? to prevent invalid iterators following erase in vectors Reformat the code to follow MythTV standard coding rules. Some minor C++ declaration fixes

Haven't tested on Analog output, assuming earlier code was okay.

Changed 8 years ago by jyavenard

For trunk #21594

comment:63 Changed 8 years ago by jyavenard

When using the software volume mixer, found that the channel ordering was incorrect once again. So re-introduced conditional channel re-ordering found in earlier version of the patch.

Currently tested with digital output with the following configuration: -No software volume mixer: PLII, AC3, DTS -Software volume mixer: PLII, AC3, DTS

Anyone using Analog audio, could you please test ?

patch audioencoding-trunk-7.5.diff

Changed 8 years ago by jyavenard

Against trunk r21594

comment:64 Changed 8 years ago by jyavenard

  • Resolution set to duplicate
  • Status changed from assigned to closed

comment:65 Changed 8 years ago by jyavenard

See patch #6975.

#6975 contains an updated upmixer patch for trunk ; fixing all known channel order issues and minimising the amount of channel reordering

Add Comment

Modify Ticket

Action
as closed The owner will remain jyavenard.
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.