Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#7266 closed defect (wontfix)

Splitting 5.1 audio into discrete AAC streams is broken in FFmpeg

Reported by: Bryan Bortz Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: aac regression
Cc: owlboy@owlboy.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Up until FFmpeg v4.0 I have been able to run the following command on an input video file that contains an H.264 video track and either AC3 or DTS audio stream and produce an MP4 that has 6 streams of audio. Each stream corresponds to a channel of the 5.1 audio.

ffmpeg -i INPUT.MKV -vcodec copy -filter_complex channelsplit=channel_layout=5.1 -acodec aac -movflags faststart OUTPUT.MP4

It even worked on Stereo tracks and put the L and R channels into the proper places and produced some extraneous silent tracks for the other 4 channels.

But now in v4.0.1 I get the following error:

[aac @ 0x7f7f65001e00] Unsupported channel layout

Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Conversion failed!

Changing the command to be the following does not improve things:

ffmpeg -i INPUT.MKV -vcodec copy -filter_complex "channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR]" -acodec aac -movflags faststart OUTPUT.MP4

It gives the following error:

Filter channelsplit:BR has an unconnected output

(Note that BL/BR and SL/SR both produce the same error about BR)

This MP4 file structure is useful for playing back inside of Unity with virtual speakers placed in the environment.

My end goal:

  • MP4 (MOOV Atom at the Front)

-H.264 Video Stream
-AAC Audio Stream - FL
-AAC Audio Stream - FR
-AAC Audio Stream - FC
-AAC Audio Stream - LFE
-AAC Audio Stream - SL
-AAC Audio Stream - SR

Attachments (4)

ffmpeg-20180620-111122.log (359.0 KB ) - added by Bryan Bortz 4 years ago.
-report log
ffmpeg-20180620-121649.log (362.0 KB ) - added by Bryan Bortz 4 years ago.
-report log - Previous log was not the correct log!
ffmpeg-20180620-122243-v3.4.2.log (367.4 KB ) - added by Bryan Bortz 4 years ago.
-report of the command working on v3.4.2
ffmpeg-20180620-165657-v4.0.log (362.0 KB ) - added by Bryan Bortz 4 years ago.
-report FFmpeg v4.0

Download all attachments as: .zip

Change History (13)

by Bryan Bortz, 4 years ago

Attachment: ffmpeg-20180620-111122.log added

-report log

comment:1 by Bryan Bortz, 4 years ago

Cc: owlboy@owlboy.com added

comment:2 by Carl Eugen Hoyos, 4 years ago

Keywords: mp4 multiple-streams removed

How is the issue you see related to the log you attached?

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

by Bryan Bortz, 4 years ago

Attachment: ffmpeg-20180620-121649.log added

-report log - Previous log was not the correct log!

comment:3 by Bryan Bortz, 4 years ago

@cehoyos Sorry about that! I grabbed the wrong -report log!

The correct log (ffmpeg-20180620-121649.log​) Is now attached.

ffmpeg -i /Users/bryan.bortz/Movies/the_gate-1987-intro.mp4 -vcodec copy -filter_complex channelsplit=channel_layout=5.1 -acodec aac -movflags faststart -report output-test.mp4

Last edited 4 years ago by Bryan Bortz (previous) (diff)

comment:4 by Bryan Bortz, 4 years ago

I am also attaching a log from v3.4.2 where the same command succeeds and provides the desired and expected output:

ffmpeg-20180620-122243-v3.4.2.log

by Bryan Bortz, 4 years ago

-report of the command working on v3.4.2

comment:5 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavcodec
Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Summary: Splitting 5.1 audio into discrete AAC streams is broken in FFmpeg 4.0.1Splitting 5.1 audio into discrete AAC streams is broken in FFmpeg

Regression since fbf295e2bd4d48d7a0a094ed5afce2fa5b6cf35a
Please confirm that the issue was also reproducible with FFmpeg 4.0.

comment:6 by Bryan Bortz, 4 years ago

Can confirm the behavior exists in FFmpeg 4.0. (additional log attached: ffmpeg-20180620-165657-v4.0.log)

by Bryan Bortz, 4 years ago

-report FFmpeg v4.0

comment:7 by Elon Musk, 4 years ago

Resolution: wontfix
Status: openclosed

This is usage issue. You need to add to every single output of your filtergraph aformat=channel_layouts=mono and properly map them to output.

AAC with PCE can not encode FL/FR/SL/SR/.. channel layouts, so you need to convert each stream to mono channel layout.

in reply to:  7 comment:8 by Bryan Bortz, 4 years ago

Replying to richardpl:

This is usage issue. You need to add to every single output of your filtergraph aformat=channel_layouts=mono and properly map them to output.

AAC with PCE can not encode FL/FR/SL/SR/.. channel layouts, so you need to convert each stream to mono channel layout.

Can I request an example? I've been playing around with this for a while now and can't find any examples/docs specifically about this case. Various things I try work in versions less than 4.0 but not in 4.0+.

Thank you.

Last edited 4 years ago by Bryan Bortz (previous) (diff)

comment:9 by Elon Musk, 4 years ago

"channelsplit=channel_layout=5.1[FL][FR][FC][LFE][BL][BR],[FL]aformat=channel_layouts=mono[FL];[FR]aformat=channel_layouts=mono[FR];[FC]aformat=channel_layouts=mono[FC];[LFE]aformat=channel_layouts=mono[LFE];[BL]aformat=channel_layouts=mono[BL];[BR]aformat=channel_layouts=mono[BR]"
Note: See TracTickets for help on using tickets.