Hi guys, Trying to do some audio patching from multiple input files, and output a QT or MXF with a poly soundtrack. Now this turns out to be a hell of a job, I can’t grasp the logic on how the patching works. Y\LTC_Convert\FF\ffmpeg -threads 1 -i V\!patch\test.mxf -ss 0.0000 -i V\!patch\snd.wav -map 0:0 -filter_complex "[1:a][0:a:2][1:a][0:a:1][0:a:3]amerge=inputs=5,pan=5c|c0=c9|c1=c1|c2=c8|c3=c0|c4=c2[a]" -map "[a]" -ca pcm_s24le -cv copy -timecode 01:00:00:00 -y V\!patch\active\test.mxf" FFmpeg returns: Stream mapping: Stream #0:2 (pcm_s24le) -> amerge:in3 Stream #0:3 (pcm_s24le) -> amerge:in1 Stream #0:4 (pcm_s24le) -> amerge:in4 Stream #1:0 (pcm_s24le) -> amerge:in0 Stream #1:0 (pcm_s24le) -> amerge:in2 This looks all good, so the problem must be in how I define the pan, but for the life of me I can’t understand how the numbers work. It seems (by other tests) that the input track up numbers based on what is already set, but it’s still erratic.. I would expect to get (output = from input file) sndTrack 0 = snd.wav 2 sndTrack 1 = test.mxf 2 sndTrack 2 = snd.wav 1 sndTrack 3 = test.mxf 1 sndTrack 4 = test.mxf 3 but, the result has channels mapped as sndTrack 0 = snd.wav 1 sndTrack 1 = snd.wav 2 sndTrack 2 = test.mxf 3 sndTrack 3 = snd.wav 1 sndTrack 4 = snd.wav 3 Isn’t there a simple way to set the patching? Or, where is my logic off? thx, Bouke ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.4.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 34.100 / 55. 34.100 libavcodec 57. 64.101 / 57. 64.101 libavformat 57. 56.100 / 57. 56.100 libavdevice 57. 1.100 / 57. 1.100 libavfilter 6. 65.100 / 6. 65.100 libswscale 4. 2.100 / 4. 2.100 libswresample 2. 3.100 / 2. 3.100 libpostproc 54. 1.100 / 54. 1.100 Guessed Channel Layout for Input Stream #0.1 : mono Guessed Channel Layout for Input Stream #0.2 : mono Guessed Channel Layout for Input Stream #0.3 : mono Guessed Channel Layout for Input Stream #0.4 : mono Guessed Channel Layout for Input Stream #0.5 : mono Guessed Channel Layout for Input Stream #0.6 : mono Guessed Channel Layout for Input Stream #0.7 : mono Guessed Channel Layout for Input Stream #0.8 : mono Input #0, mxf, from 'V:\!patch\test.mxf': Metadata: uid : b8b5c18e-2490-6849-ad9f-7f99f053ff76 generation_uid : 30fcae45-66b3-8245-94b0-ad13bedb033d company_name : AVID product_name : TRMG product_version : 3.01 product_uid : 00000000-0000-0000-0000-000000000000 modification_date: 2017-11-16T11:51:43.000000Z material_package_umid: 0x060A2B340101010501010D131300000060373AAE025378409AB925C4319F6FB2 timecode : 01:00:00:00 Duration: 00:00:16.88, start: 0.000000, bitrate: 60691 kb/s Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:1: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:2: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:3: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:4: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:5: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:6: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:7: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:8: Audio: pcm_s24le, 48000 Hz, mono, s32 (24 bit), 1152 kb/s Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Guessed Channel Layout for Input Stream #1.0 : 7.1 Input #1, wav, from 'V:\!patch\snd.wav': Metadata: comment : snd.wav encoded_by : Avid Media Composer 8.6.1 originator_reference: 000000000000002a5a0d7fad00b554c7 date : 2017-11-16 creation_time : 14-08-21 time_reference : 172800000 coding_history : PCM MODE:STEREO SAMPLE_RATE:48000 BITS_PER_SAMP:24 : DIGITIZE CARD:DeckLink Studio 2 & 1394 Audio & DirectSound Audio PERIPHERAL:DeckLink Studio 2 & Avid OHCI : Duration: 00:00:16.88, bitrate: 9216 kb/s Stream #1:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s [Parsed_amerge_0 @ 056ef9a0] No channel layout for input 1 [Parsed_amerge_0 @ 056ef9a0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels [Parsed_pan_1 @ 056efaa0] Pure channel mapping detected: 9 1 8 0 2 Output #0, mxf, to 'V:\!patch\patch.mxf': Metadata: uid : b8b5c18e-2490-6849-ad9f-7f99f053ff76 generation_uid : 30fcae45-66b3-8245-94b0-ad13bedb033d company_name : AVID product_name : TRMG product_version : 3.01 product_uid : 00000000-0000-0000-0000-000000000000 modification_date: 2017-11-16T11:51:43.000000Z material_package_umid: 0x060A2B340101010501010D131300000060373AAE025378409AB925C4319F6FB2 timecode : 01:00:00:00 encoder : Lavf57.56.100 Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50000 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc Metadata: file_package_umid: 0x060A2B340101010501010D1313000000CA47B58C572A8D458FF25B9B8DC8F42F Stream #0:1: Audio: pcm_s24le, 48000 Hz, 5.0, s32, 5760 kb/s (default) Metadata: encoder : Lavc57.64.101 pcm_s24le Stream mapping: Stream #0:2 (pcm_s24le) -> amerge:in3 Stream #0:3 (pcm_s24le) -> amerge:in1 Stream #0:4 (pcm_s24le) -> amerge:in4 Stream #1:0 (pcm_s24le) -> amerge:in0 Stream #1:0 (pcm_s24le) -> amerge:in2 Stream #0:0 -> #0:0 (copy) pan -> Stream #0:1 (pcm_s24le) Press [q] to stop, [?] for help frame= 56 fps=0.0 q=-1.0 size= 15712kB time=00:00:02.20 bitrate=58504.5kbits/s speed= 4.4x frame= 107 fps=107 q=-1.0 size= 29091kB time=00:00:04.24 bitrate=56205.3kbits/s speed=4.23x frame= 158 fps=105 q=-1.0 size= 42914kB time=00:00:06.28 bitrate=55979.1kbits/s speed=4.16x frame= 187 fps= 93 q=-1.0 size= 50989kB time=00:00:07.44 bitrate=56142.9kbits/s speed=3.69x frame= 238 fps= 95 q=-1.0 size= 64478kB time=00:00:09.48 bitrate=55717.8kbits/s speed=3.77x frame= 286 fps= 95 q=-1.0 size= 78343kB time=00:00:11.40 bitrate=56296.7kbits/s speed=3.78x frame= 334 fps= 95 q=-1.0 size= 91595kB time=00:00:13.32 bitrate=56332.4kbits/s speed=3.78x frame= 384 fps= 95 q=-1.0 size= 105758kB time=00:00:15.32 bitrate=56551.3kbits/s speed=3.81x frame= 422 fps= 96 q=-1.0 Lsize= 116527kB time=00:00:16.88 bitrate=56551.3kbits/s speed=3.84x video:104154kB audio:11869kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.434182%
On 11/18/2017 7:42 PM, Bouke / VideoToolShed wrote:
Stream mapping: Stream #0:2 (pcm_s24le) -> amerge:in3 Stream #0:3 (pcm_s24le) -> amerge:in1 Stream #0:4 (pcm_s24le) -> amerge:in4 Stream #1:0 (pcm_s24le) -> amerge:in0 Stream #1:0 (pcm_s24le) -> amerge:in2
but, the result has channels mapped as sndTrack 0 = snd.wav 1 sndTrack 1 = snd.wav 2 sndTrack 2 = test.mxf 3 sndTrack 3 = snd.wav 1 sndTrack 4 = snd.wav 3
It's as expected. amerge output channel order, in this case, will be the channels laid out in input order ( [1:a][0:a:2][1:a][0:a:1][0:a:3] ) i.e. all channels of [1:a], followed by [0:a:2], followed by a repeat of [1:a] and so on. Regards, Gyan
This works as intended: ffmpeg -i HD422.mxf -i 8ch.wav -c:v copy -c:a pcm_s24le -filter_complex \ "[1:a]channelsplit=channel_layout=7.1[a0][a1][a2][a3][a4][a5][a6][a7]" \ -map 0:v -map "[a1]" -map 0:a:1 -map "[a0]" -map 0:a:0 -map 0:a:2 \ -timecode 01:00:00:00 testmerge00.mxf -map "[a2]" \ -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -f null -
or if you want a single audio stream with 5 channels: ffmpeg -i HD422.mxf -i 8ch.wav -c:v copy -c:a pcm_s24le -filter_complex \ "[1:a]channelsplit=channel_layout=7.1[a0][a1][a2][a3][a4][a5][a6][a7],\ [a1][0:a:1][a0][0:a:0][0:a:2]amerge=inputs=5[a]" \ -map 0:v -map "[a]" -timecode 01:00:00:00 testmerge01.mxf \ -map "[a2]" -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -f null -
On 18 Nov 2017, at 17:24, Erik Dobberkau <erik.dobberkau@gmail.com> wrote:
or if you want a single audio stream with 5 channels:
ffmpeg -i HD422.mxf -i 8ch.wav -c:v copy -c:a pcm_s24le -filter_complex \ "[1:a]channelsplit=channel_layout=7.1[a0][a1][a2][a3][a4][a5][a6][a7],\ [a1][0:a:1][a0][0:a:0][0:a:2]amerge=inputs=5[a]" \ -map 0:v -map "[a]" -timecode 01:00:00:00 testmerge01.mxf \ -map "[a2]" -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -f null -
Hi Eric, Great (I would never have come up with the way of disposing unwanted channels.) One problem though, It seems that FFmpeg pipes the channel split, but does so in 16 bits: Stream #1:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 7.1, s32 (24 bit), 9216 kb/s Stream mapping: Stream #0:1 (pcm_s24le) -> amerge:in3 Stream #0:2 (pcm_s24le) -> amerge:in1 Stream #0:3 (pcm_s24le) -> amerge:in4 Stream #1:0 (pcm_s24le) -> channelsplit Stream #0:0 -> #0:0 (copy) amerge -> Stream #0:1 (pcm_s24le) channelsplit:FC -> Stream #1:0 (pcm_s16le) channelsplit:LFE -> Stream #1:1 (pcm_s16le) channelsplit:BL -> Stream #1:2 (pcm_s16le) channelsplit:BR -> Stream #1:3 (pcm_s16le) channelsplit:SL -> Stream #1:4 (pcm_s16le) channelsplit:SR -> Stream #1:5 (pcm_s16le) And after that promote it to 24 bits again. Is there a way to force the channel split to work in 24 bits? (No idea how to squeeze pcm_s24le into the filter_complex part…) Bouke
And after that promote it to 24 bits again. Is there a way to force the channel split to work in 24 bits? (No idea how to squeeze pcm_s24le into the filter_complex part…)
A more knowledgeable person than myself would need to jump in here. When I use "aformat=sample_fmts=s24" at the beginning of the filterchain, this results in an error.
On 11/21/17, Erik Dobberkau <erik.dobberkau@gmail.com> wrote:
And after that promote it to 24 bits again. Is there a way to force the channel split to work in 24 bits? (No idea how to squeeze pcm_s24le into the filter_complex part...)
A more knowledgeable person than myself would need to jump in here.
When I use "aformat=sample_fmts=s24" at the beginning of the filterchain, this results in an error.
Because such sample format does not exist.
On 11/19/2017 6:09 PM, Bouke / VideoToolShed wrote:
ffmpeg -i HD422.mxf -i 8ch.wav -c:v copy -c:a pcm_s24le -filter_complex \ "[1:a]channelsplit=channel_layout=7.1[a0][a1][a2][a3][a4][a5][a6][a7],\ [a1][0:a:1][a0][0:a:0][0:a:2]amerge=inputs=5[a]" \ -map 0:v -map "[a]" -timecode 01:00:00:00 testmerge01.mxf \ -map "[a2]" -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -f null -
And after that promote it to 24 bits again. Is there a way to force the channel split to work in 24 bits? (No idea how to squeeze pcm_s24le into the filter_complex part…)
The default audio codec for the null muxer is pcm_s16le, and your audio codec option is only set for the first output, so add '-c:a pcm_s24le' anywhere after the output mxf filename, and before the pipe character. Regards, Gyan
On 22 Nov 2017, at 06:32, Gyan Doshi <gyandoshi@gmail.com> wrote:
On 11/19/2017 6:09 PM, Bouke / VideoToolShed wrote:
ffmpeg -i HD422.mxf -i 8ch.wav -c:v copy -c:a pcm_s24le -filter_complex \ "[1:a]channelsplit=channel_layout=7.1[a0][a1][a2][a3][a4][a5][a6][a7],\ [a1][0:a:1][a0][0:a:0][0:a:2]amerge=inputs=5[a]" \ -map 0:v -map "[a]" -timecode 01:00:00:00 testmerge01.mxf \ -map "[a2]" -map "[a3]" -map "[a4]" -map "[a5]" -map "[a6]" -map "[a7]" -f null -
And after that promote it to 24 bits again. Is there a way to force the channel split to work in 24 bits? (No idea how to squeeze pcm_s24le into the filter_complex part…)
The default audio codec for the null muxer is pcm_s16le, and your audio codec option is only set for the first output, so add '-c:a pcm_s24le' anywhere after the output mxf filename, and before the pipe character.
Hi Gyan, AH! Stupid me, now I see only the unused channels (that go down the drain) are 16 bits :-) Thanks! Bouke
Regards, Gyan _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
2017-11-18 15:12 GMT+01:00 Bouke / VideoToolShed <bouke@videotoolshed.com>:
Hi guys, Trying to do some audio patching from multiple input files, and output a QT or MXF with a poly soundtrack. Now this turns out to be a hell of a job, I can’t grasp the logic on how the patching works.
Y\LTC_Convert\FF\ffmpeg -threads 1 -i V\!patch\test.mxf -ss 0.0000 -i V\!patch\snd.wav -map 0:0 -filter_complex "[1:a][0:a:2][1:a][0:a:1][0:a: 3]amerge=inputs=5,pan=5c|c0=c9|c1=c1|c2=c8|c3=c0|c4=c2[a]" -map "[a]" -ca pcm_s24le -cv copy -timecode 01:00:00:00 -y V\!patch\active\test.mxf"
FFmpeg returns: Stream mapping: Stream #0:2 (pcm_s24le) -> amerge:in3 Stream #0:3 (pcm_s24le) -> amerge:in1 Stream #0:4 (pcm_s24le) -> amerge:in4 Stream #1:0 (pcm_s24le) -> amerge:in0 Stream #1:0 (pcm_s24le) -> amerge:in2
This looks all good, so the problem must be in how I define the pan, but for the life of me I can’t understand how the numbers work. It seems (by other tests) that the input track up numbers based on what is already set, but it’s still erratic..
I would expect to get (output = from input file) sndTrack 0 = snd.wav 2 sndTrack 1 = test.mxf 2 sndTrack 2 = snd.wav 1 sndTrack 3 = test.mxf 1 sndTrack 4 = test.mxf 3
but, the result has channels mapped as sndTrack 0 = snd.wav 1 sndTrack 1 = snd.wav 2 sndTrack 2 = test.mxf 3 sndTrack 3 = snd.wav 1 sndTrack 4 = snd.wav 3
Isn’t there a simple way to set the patching? Or, where is my logic off?
Hi Bouke, I would have thought -filter_complex "[1:a:1][0:a:1][1:a:0][0:a:0][0:a:2]amerge=inputs=5" would get you what you want. -filter_complex "[1:1][0:a:1][1:0][0:a:0][0:a:2]amerge=inputs=5" should also work, as well as -filter_complex "[1:1][0:2][1:0][0:1][0:3]amerge=inputs=5" No pan filter required, if you require one output stream with 5 audio channels. If you specifiy audio by using "a", you need to start counting from zero. If you omit "a", the stream number depends on the arrangement of streams in the file. Best regards, Erik
participants (4)
-
Bouke / VideoToolShed -
Erik Dobberkau -
Gyan Doshi -
Paul B Mahol