[FFmpeg-user] Channel mapping misery

Bouke / VideoToolShed bouke at videotoolshed.com
Wed Mar 4 13:02:11 EET 2020


Hi all,
Trying to do create files where I can control the audio channels. (From multiple, different sources.)

I’ve got it ‘sorta kinda’ working:

-threads 0 -i /Volumes/Data/test/C0092.MP4 -ss 1601.8095416666692 -i /Volumes/Data/test/068.WAV -map 0:0 -filter_complex [0:1][1:0][1:0][1:0][1:0][1:0]amerge=inputs=6,pan=6c|c0=c0|c1=c2|c2=c3|c3=c4|c4=c5|c5=c6[a] -map [a] -c:a pcm_s24le -timecode 01:42:38:10 -metadata:s:v:0 reel_name=C0092 -c:v copy /Volumes/Data/test/C0092.mov 
(Full output at the bottom)
This works, although Wiki says ‘With amerge all inputs must have the same sample rate and format.’
But that does not seem to be the case… (In the docs in the -map_channel section it’s encouraged to use amerge, since -map_channel cannot do conversions…)
So, I don’t think my problem lies there.

When I add one channel more to the previous command: (the wave file has 10 channels)

-threads 0 -i /Volumes/Data/test/C0092.MP4 -ss 1601.8095416666692 -i /Volumes/Data/test/068.WAV -map 0:0 -filter_complex [0:1][1:0][1:0][1:0][1:0][1:0][1:0]amerge=inputs=7,pan=7c|c0=c0|c1=c2|c2=c3|c3=c4|c4=c5|c5=c6|c6=c7[a] -map [a] -c:a pcm_s24le -timecode 01:42:38:10 -metadata:s:v:0 reel_name=C0092 -c:v copy /Volumes/Data/test/C0092.mov -y 

This does show the pure channel mapping, but fails with:

[Parsed_amerge_0 @ 0x7facfcc28b80] No channel layout for input 1
[Parsed_amerge_0 @ 0x7facfcc28b80] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Assertion outlink->channel_layout == out_layout || !outlink->channel_layout failed at src/libavfilter/af_aresample.c:168

Then, adding yet another channel, the error message changes:
-threads 0 -i /Volumes/Data/test/C0092.MP4 -ss 1601.8095416666692 -i /Volumes/Data/test/068.WAV -map 0:0 -filter_complex [0:1][1:0][1:0][1:0][1:0][1:0][1:0][1:0]amerge=inputs=8,pan=8c|c0=c0|c1=c2|c2=c3|c3=c4|c4=c5|c5=c6|c6=c7|c7=c8[a] -map [a] -c:a pcm_s24le -timecode 01:42:38:10 -metadata:s:v:0 reel_name=C0092 -c:v copy /Volumes/Data/test/C0092.mov -y 


[Parsed_amerge_0 @ 0x7faa63f00000] No channel layout for input 1
[Parsed_amerge_0 @ 0x7faa63f00000] Too many channels (max 64)
[Parsed_amerge_0 @ 0x7faa63f00000] Query format failed for 'Parsed_amerge_0': Invalid argument

Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!


What am I missing here / what is the correct approach?

Thanks,
Bouke

Working output:

ffmpeg version git-2020-02-03-1c15111 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.8)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 38.100 / 56. 38.100
  libavcodec     58. 67.100 / 58. 67.100
  libavformat    58. 37.100 / 58. 37.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 73.100 /  7. 73.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb371800000] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb371800000] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.

Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/test/C0092.MP4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2020-01-30T13:31:25.000000Z
  Duration: 00:00:02.40, start: 0.000000, bitrate: 97881 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 82959 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2020-01-30T13:31:25.000000Z

      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2020-01-30T13:31:25.000000Z
      handler_name    : Sound Media Handler
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 204 kb/s (default)
    Metadata:
      creation_time   : 2020-01-30T13:31:25.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 01:42:38:10

Input #1, wav, from '/Volumes/Data/test/068.WAV':
  Metadata:
    comment         : sSPEED=025.000-ND 
                    : sTAKE=068 
                    : sUBITS=$00000000 
                    : sSWVER=5.01.8149 
                    : sSCENE=MixPre 
                    : sFILENAME=MixPre-068.WAV 
                    : sTAPE=200130 
                    : sCIRCLED=FALSE 
                    : sTRK1=MixL 
                    : sTRK2=MixR 
                    : sTRK3=Track 1 
                    : sTRK4=Track 2 
                    : sTRK5=Track 3 
                    : sTRK6=Track 4 
                    : sTRK7=Track 5 
                    : sTRK8=Track 6 
                    : sTRK9
    encoded_by      : SoundDev: MixPre-10 II TJ0019225
    originator_reference: USSDVTJ001922501520013072A000201

    date            : 2020-01-30
    creation_time   : 07:02:20
    time_reference  : 2468718515
    coding_history  : A=PCM,F=48000,W=24,M=multi,R=48000,T=10 Ch;Ambisonics=off 
                    : 
  Duration: 00:49:41.90, bitrate: 11520 kb/s
    Stream #1:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 10 channels, s32 (24 bit), 11520 kb/s

Stream mapping:
  Stream #0:1 (pcm_s16be) -> amerge:in0
  Stream #1:0 (pcm_s24le) -> amerge:in1
  Stream #1:0 (pcm_s24le) -> amerge:in2
  Stream #1:0 (pcm_s24le) -> amerge:in3
  Stream #1:0 (pcm_s24le) -> amerge:in4
  Stream #1:0 (pcm_s24le) -> amerge:in5
  Stream #0:0 -> #0:0 (copy)
  pan -> Stream #0:1 (pcm_s24le)
Press [q] to stop, [?] for help

[Parsed_amerge_0 @ 0x7fb371408a40] No channel layout for input 1

[Parsed_amerge_0 @ 0x7fb371408a40] Input channel layouts overlap: output layout will be determined by the number of distinct input channels

[Parsed_pan_1 @ 0x7fb3714091c0] Pure channel mapping detected: 0 2 3 4 5 6

Output #0, mov, to '/Volumes/Data/test/C0092.mov':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    timecode        : 01:42:38:10
    encoder         : Lavf58.37.100
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 82959 kb/s, 0.04 fps, 25 tbr, 25k tbn, 25k tbc (default)
    Metadata:
      creation_time   : 2020-01-30T13:31:25.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
      reel_name       : C0092

    Stream #0:1: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 5.1, s32, 6912 kb/s (default)
    Metadata:
      encoder         : Lavc58.67.100 pcm_s24le

frame=   60 fps=0.0 q=-1.0 Lsize=   26333kB time=00:00:02.40 bitrate=89884.2kbits/s speed=30.8x    
video:24305kB audio:2025kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.014150%


More information about the ffmpeg-user mailing list