Opened 11 years ago

Last modified 11 years ago

#2110 new defect

Audio pass-through using "-ac spdifac3" doesn't work on OS X 10.8.2

Reported by: codeling@… Owned by: reimar
Priority: normal Component: ad
Version: HEAD Severity: normal
Keywords: Cc: nfxjfg@…
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Playing a movie containing AC-3 6 channel audio doesn't work when using the option "-ac spdifac3". It produces no sound.

Playing the same movie using the option "-ac hwac3" gives the expected result producing 5.1 surround output.

This is the terminal output using the "-ac spdifac3" option:

mini:~ $ mplayer -ac spdifac3 life.on.mars.s01e01.int.720p.bluray.x264-nodlabs.mkv
MPlayer 1.1-4.2.1 (C) 2000-2012 MPlayer Team

Playing life.on.mars.s01e01.int.720p.bluray.x264-nodlabs.mkv.
libavformat version 54.6.101 (internal)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (ac3), -aid 0
[lavf] stream 2: subtitle (text), -sid 0
VIDEO: [H264] 1280x720 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Clip info:

creation_time: 2009-01-31 21:56:32

Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.23.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Forced audio codec: spdifac3
Opening audio decoder: [spdif] libavformat/spdifenc audio pass-through decoder.
Unknown/missing audio format -> no sound
ADecoder init failed :(
Cannot find codec for audio format 0x2000.
Audio: no sound
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x1108156b0]BICUBIC scaler, from yuv420p to yuyv422 using MMX2
VO: [corevideo] 1280x720 => 1280x720 Packed YUY2
[ASPECT] Warning: No suitable new res found!
V: 18.9 0/ 0 18% 19% 0.0% 0 0

PAUSE

Exiting... (Quit)

Attachments (1)

file_2110.txt (3.8 KB ) - added by codeling@… 11 years ago.
mediainfo for movie

Download all attachments as: .zip

Change History (11)

by codeling@…, 11 years ago

Attachment: file_2110.txt added

mediainfo for movie

comment:1 by reimar, 11 years ago

op_sys: Mac OS XAll

Not related to OSX luckily.
The issue will appear always when using -demuxer lavf or in general with audio stored in MKV or MP4.
Please try if it works with r35517.
It still won't detect the sample rate correctly, but unless that actually causes issues I'd rather avoid adding hacks to fix that.

comment:2 by codeling@…, 11 years ago

Tried r35518 with "-ac spdifac3".

It doesn't report any error but produces white noise stereo output. "-ac hwac3" still works.

comment:3 by nfxjfg@…, 11 years ago

Cc: nfxjfg@… added

Please note that the author of ad_spdif sent a number of patches to improve it, but they were ignored and never applied: http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2012-March/070125.html

comment:4 by reimar, 11 years ago

None of those changes have anything at all to do with AC3, and none of the other formats are currently supported on OSX (and those patches would not change that).
I fixed a few more issues.
If it still does not work, I could use a new MPlayer output and whether this is on PPC or Intel OSX.

comment:5 by codeling@…, 11 years ago

Succes! "-ac spdifac3" now works.

Build from trunk at 01:08 CET and "-ac spdifac3" now has the same behavior as "-ac hwac3".

Just to check that I hadn't screwed something up at my end, I confirmed that r35518 still doesn't work.

This is on Intel. OS X 10.8 doesn't run on PPC.

Thank you for your work! I am sure the mplayer2 and mpv-player people appreciate it.

comment:6 by nfxjfg@…, 11 years ago

Sure you don't want to apply the patches? I think they would have made commit 35517 unnecessary, even though as you say they aren't about AC3. (But improving DTS support instead?)

comment:7 by reimar, 11 years ago

r35517 was about providing a proper fallback.
Those patches instead would have completely removed any and all fallback, instead failing fatally if sample rate cannot be detected.
Which would e.g. be the case with an FFmpeg compiled without an AC3 decoder (for example because the user prefers liba52 anyway).
While I don't mind other developers handling it differently, I want to know which issues it fixes to know if it's worth the complexity and what simpler alternatives exist.
For example I wonder when and why detecting the sample rate is necessary.
I also wonder when and why (except for MKV etc., I understand that issue) the values from the parser are not good enough, because that probably is a symptom of a bug that needs to be fixed properly instead of worked around.

comment:8 by nfxjfg@…, 11 years ago

(In reply to comment #7)

r35517 was about providing a proper fallback.
Those patches instead would have completely removed any and all fallback,
instead failing fatally if sample rate cannot be detected.

I haven't looked too close at these patches, and I understand nothing about spdif, but it looked like the patches did add better sample rate detection by opening a decoder.

Additionally, the parser is almost always disabled when playing normal video files, because demux_lavf doesn't set needs_parsing (unless correct pts is disabled, then it's set in video.c). So in my understanding, it's usually using the fallback now?

Which would e.g. be the case with an FFmpeg compiled without an AC3 decoder
(for example because the user prefers liba52 anyway).

The user would really have to go out of their way to disable the AC3 decoder in ffmpeg at compilation. Is that even worth considering?

While I don't mind other developers handling it differently, I want to know
which issues it fixes to know if it's worth the complexity and what simpler
alternatives exist.

Why not ask Naoya? He wrote ad_spdif and the patches we're talking about. You could bring this up on the mailing list.

Personally I wonder if ad_spdif really does anything better than ad_hwac3. It looked good because it supports more formats and contains less weird manual parsing code.

comment:9 by codeling@…, 11 years ago

I've done some more more spdif testing with mplayer-svn today.

It turns out that "-ac spdifdts" doesn't work either:

mini:~ $ bin/mplayer -ac spdifdts Game.Of.Thrones.S01.E01.2011.720p.BluRay.x264.DTS-HDChina.mkv
MPlayer UNKNOWN-4.2.1 (C) 2000-2012 MPlayer Team

Playing Game.Of.Thrones.S01.E01.2011.720p.BluRay.x264.DTS-HDChina.mkv.
libavformat version 54.42.100 (internal)
libavformat file format detected.
[matroska,webm @ 0x102a62420]Stream #2: not enough frames to estimate rate; consider increasing probesize
[matroska,webm @ 0x102a62420]Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (dca), -aid 0, -alang eng
[lavf] stream 2: subtitle (pgssub), -sid 0, -slang eng
VIDEO: [H264] 1280x720 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Clip info:

creation_time: 2012-02-18 18:15:22

Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.78.101 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Forced audio codec: spdifdts
Opening audio decoder: [spdif] libavformat/spdifenc audio pass-through decoder.
AUDIO: 192000 Hz, 8 ch, iec61937le, 768.0 kbit/3.12% (ratio: 96000->3072000)
Selected audio codec: [spdifdts] afm: spdif (libavformat/spdifenc DTS pass-through decoder)
==========================================================================
[format] Sample format little-endian IEC61937 not yet supported
Error at audio filter chain pre-init!

Exiting... (Fatal error)
mini:~ $

This is the output for the same file with "-ac hwdts", which works fine:

mini:~ $ bin/mplayer -ac hwdts Game.Of.Thrones.S01.E01.2011.720p.BluRay.x264.DTS-HDChina.mkv
MPlayer UNKNOWN-4.2.1 (C) 2000-2012 MPlayer Team

Playing Game.Of.Thrones.S01.E01.2011.720p.BluRay.x264.DTS-HDChina.mkv.
libavformat version 54.42.100 (internal)
libavformat file format detected.
[matroska,webm @ 0x104529420]Stream #2: not enough frames to estimate rate; consider increasing probesize
[matroska,webm @ 0x104529420]Could not find codec parameters for stream 2 (Subtitle: hdmv_pgs_subtitle): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (dca), -aid 0, -alang eng
[lavf] stream 2: subtitle (pgssub), -sid 0, -slang eng
VIDEO: [H264] 1280x720 0bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
Clip info:

creation_time: 2012-02-18 18:15:22

Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.78.101 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Forced audio codec: hwdts
Opening audio decoder: [hwac3] AC3/DTS pass-through S/PDIF
hwac3: switched to DTS, 1536000 bps, 48000 Hz

AUDIO: 48000 Hz, 2 ch, ac3le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [hwdts] afm: hwac3 (DTS through S/PDIF)
==========================================================================
AO: [coreaudio] 48000Hz 2ch ac3le (2 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x104547090]BICUBIC scaler, from yuv420p to yuyv422 using MMXEXT
VO: [corevideo] 1280x720 => 1280x720 Packed YUY2
[ASPECT] Warning: No suitable new res found!
A: 3.2 V: 2.2 A-V: 1.062 ct: 0.042 0/ 0 43% 230% 1.3% 50 0

comment:10 by reimar, 11 years ago

I think it would be best if you tried below patch and also checked if any of the formats other than AC3/DTS also work:
Index: libao2/ao_coreaudio.c
===================================================================
--- libao2/ao_coreaudio.c (revision 35567)
+++ libao2/ao_coreaudio.c (working copy)
@@ -477,7 +477,7 @@

ao_msg(MSGT_AO,MSGL_V, "got audio output device ID: %"PRIu32" Name: %s\n", devid_def, psz_name );


/* Probe whether device support S/PDIF stream output if input is AC3 stream. */

  • if (AF_FORMAT_IS_AC3(format)) {

+ if (AF_FORMAT_IS_IEC61937(format)) {

if (AudioDeviceSupportsDigital(devid_def))
{

ao->b_supports_digital = 1;

Note: See TracTickets for help on using tickets.