0

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
Community
  • 1
  • 1
OwlBoy
  • 33
  • 1
  • 8
  • 2
    If it worked before, and does not anymore, file a bug report at trac.ffmpeg.org – Gyan Jun 20 '18 at 05:44
  • It's not a bug. Turns out my previous method was improper use of FFMPEG. https://trac.ffmpeg.org/ticket/7266#comment:7 I really need some help sorting out how to use the recommended command `aformat=channel_layouts=mono` from that comment on the bug tracker. – OwlBoy Dec 17 '18 at 16:04
  • 1
    It's still a regression, as Carl noted. Method in answer. – Gyan Dec 17 '18 at 17:00

1 Answers1

2

This is how you would set new layout and maps.

ffmpeg -i INPUT.MKV
       -filter_complex "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]"
       -map 0:v -map '[FL]' -map '[FR]' -map '[FC]' -map '[LFE]' -map '[BL]' -map '[BR]'
       -vcodec copy -acodec aac -movflags faststart OUTPUT.MP4
Gyan
  • 85,394
  • 9
  • 169
  • 201