GNOME Bugzilla – Bug 608892
DCA/AAC/AC-3 decoders broken in gst-libav
Last modified: 2018-11-03 12:55:21 UTC
In most of my videos, I only get some of the channels (usually the background music, sometimes sound effects) on my stereo setup. Non-gstreamer players grok them fine though, including mplayer, vlc, and xine. I have all the gst-plugins-* packages installed, with most external dependencies installed. I have tried to build gst-ffmpeg with internal ffmpeg, external ffmpeg 0.5 and svn (several snapshots from 0.5 to now) with no luck. I just found out that installing libdca and the associated (-bad) plugin seems to work. I'm using the onboard sound on an Asus M4A785G HTPC motherboard[0], which is a VIA VT2020 (snd-hda-codec-via), connected to an amplifier using the two RCA outputs on the back. [0] http://www.asus.com/product.aspx?P_ID=uypox45wza0j3kz6
The problem seems to be with ffdec_dca's handling of multi-channel files. Using the native plugin in gst-plugins-bad would work. Either the gst-ffmpeg glue code should be fixed to handle multi-channel properly, or simply be disabled.
ffdec_dca has the correct channel layout on the srcpads here. Maybe the problem is the downmixing to stereo. If you use dtsdec for decoding, is the downmixing in dtsdec used or the downmixing in audioconvert or pulseaudio?
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for. Thanks!
Just for the record: as Sebastian said, the problem is the downmixing. The decoder needs to do the downmixing to stereo, and ffdec_* doesn't do that yet (see bug #587570). Until they do that, the ffdec_* AAC, DTS, AC3 decoders are not really useful and should not have a rank, so they are not autoplugged. Marking bug as blocker for this. A secondary problem may be in the audiosinks, especially alsasink may advertise more channels and then either downmix internally or just drop channels without downmixing. This you need to work around by making alsasink use the right device (e.g. device=front) or forcing it to 2 channels by putting this into your gconf musicaudiosink key: "capsfilter caps='audio/x-raw-int,channels=2' ! alsasink". Alsasink needs to do things differently so this isn't a problem any longer (there are bugs for that elsewhere).
I discussed the issue of why FAAD is still preferred over ffdec_aac with some FFmpeg colleagues and it seems that no one has seen any AAC samples anywhere that make use of the matrix mixing method from the specification. In fact, the specification itself states that the method is not allowed with LC AAC objects. I'm not certain, but that may perhaps extend to HE AAC as well as HE AAC might be LC AAC objects with SBR and PS objects as well. AC-3 and DTS both use matrices though. DTS has standard matrices and the possibility to create custom ones too. For each format, I believe that in most cases the output channel order from the decoder will follow the channels as described in their specifications in WAVEFORMATEXTENSIBLE order. Apologies if this link disappears or anything, but the order can be found in libavcodec/avcodec.h [1]. The convenience layout definitions that follow the channel order list don't cover all the different layouts in the different decoders so don't rely on just those. One can see which layouts are supported for each decoder in the AVCodec.channel_layouts member. Perhaps the AC-3 and DTS matrices can be passed out of band (buffer metadata? :B) to audioconvert for external downmixing. Either that or one will have to implement generic channel mixing in FFmpeg and make it be performed to adhere to request_channels or whatever the current desired usage is in the libavcodec APIs, with DTS and AC-3 making use of matrices as appropriate. [1] http://git.ffmpeg.org/?p=ffmpeg;a=blob;f=libavcodec/avcodec.h;h=96d7987bdde2751956dab6719aed60ae8f75cd47;hb=HEAD#l426
This still needs to be handled for the release. In their current state, ffdec_dca and ffdec_ac3 are not fit for autoplugging, so should either get RANK_NONE or be restricted to channels=[1,2].
Setting to RANK_NONE for 0.10.12 release ================== /* TEMPORARILY DISABLING AC3/EAC3/DTS for 0.10.12 release * due to downmixing failure. * See Bug #608892 for more details */ case CODEC_ID_EAC3: case CODEC_ID_AC3: case CODEC_ID_DTS: rank = GST_RANK_NONE; break;
commit 37f5d70332296c53bf6d9c1d012f53c67a8f91f0 Author: Edward Hervey <bilboed@bilboed.com> Date: Thu Jun 30 21:38:57 2011 +0200 ffmpegdec: Setting AC3/EAC3/DTS decoders to rank NONE for release This still causes issues with bad (missing?) downmixing. They can be handled by existing a52dec/dtsdec See Bug #608892
Any news on this? Updating target milestone to 0.10.14 as 0.10.13 was released already.
AVCodecContext has a request_channel_layout to make it force downmixing. It seems that only AC3 uses this field and DCA, AC3, MLP use the old deprecated request_channels fields.
Still applies in git. Demoting severity to major.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-libav/issues/4.