0

I'm trying to convert a batch of (mostly) .mxf files (4 channels of audio) to .mp4 files (stereo audio) taking the first two channels from the source using the following script:

#!/bin/zsh

for i in *.mxf; do
 if [ -e "$i" ]; then
   file=`basename "$i" .mxf`
   
ffmpeg -i "$i" -pix_fmt yuv420p -vcodec libx264 -vf yadif -vsync 1 -r 30000/1001 -threads 0 -b:v: 12M -bufsize 12384k -maxrate 15M -preset medium -profile:v high -tune film -g 48 -x264opts no-scenecut -pass 1 -filter_complex "[0:a:1][0:a:2]amerge,channelmap=channel_layout=stereo[st],aresample=async=1:min_hard_comp=0.100000:first_pts=0" -map 0:v -map "[st]" -acodec aac -b:a 192k -ac 2 -ar 48000  -f mp4 -y "$file.mp4"

ffmpeg -i "$i" -pix_fmt yuv420p -vcodec libx264 -vf yadif -vsync 1 -r 30000/1001 -threads 0 -b:v: 12M -bufsize 12384k -maxrate 15M -preset medium -profile:v high -tune film -g 48 -x264opts no-scenecut -pass 2 -filter_complex "[0:a:1][0:a:2]amerge,channelmap=channel_layout=stereo[st],aresample=async=1:min_hard_comp=0.100000:first_pts=0" -map 0:v -map "[st]" -acodec aac -b:a 192k -ac 2 -ar 48000  -f mp4 -y "$file.mp4"
  
 fi
done

The script doesn't fail with files like this one:

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untold Stories of the ER episode 205.mxf':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2014-11-12T19:53:48.000000Z
    com.apple.finalcutstudio.media.uuid: 0B4B8750-C571-4BE7-B5FC-01AFC9B7C90B
  Duration: 00:45:38.00, start: 0.000000, bitrate: 34623 kb/s
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3n / 0x6E33786D), yuv422p(tv, bt470bg/bt470m/bt470m, bottom coded first (swapped)), 720x512 [SAR 128:135 DAR 4:3], 29999 kb/s, SAR 10:11 DAR 225:176, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : MPEG IMX 525/60i (30 MBit/s)
      timecode        : 01:00:00;00
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:5(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-11-12T20:08:55.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 01:00:00;00
Unsupported codec with id 0 for input stream 5

But fails with ones like this:

ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mxf, from 'Untold Stories of the ER episode 101.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    uid             : 8bbcdb9a-6447-11e4-98a7-002436f56128
    generation_uid  : 8bbcdbb8-6447-11e4-98a7-002436f56128
    company_name    : OC
    product_name    : OCTk
    product_version : 2.6
    product_uid     : 109c5440-d21d-b211-8029-001111ebc476
    modification_date: 2014-11-04T12:25:17.780000Z
    material_package_umid: 0x060A2B340101010501010D20130000008B424A7E644711E498A7002436F56128
    timecode        : 00:59:50;00
  Duration: 00:44:40.01, start: 0.000000, bitrate: 42596 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt470bg/bt470m/bt470m, top first), 720x512 [SAR 128:135 DAR 4:3], 30000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 59.94 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 4 channels, s16, 3072 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128

This is the output from running the script on those 2 files:


 ./untitled.sh
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Guessed Channel Layout for Input Stream #0.1 : 4.0
Input #0, mxf, from 'Untold Stories of the ER episode 101.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    uid             : 8bbcdb9a-6447-11e4-98a7-002436f56128
    generation_uid  : 8bbcdbb8-6447-11e4-98a7-002436f56128
    company_name    : OC
    product_name    : OCTk
    product_version : 2.6
    product_uid     : 109c5440-d21d-b211-8029-001111ebc476
    modification_date: 2014-11-04T12:25:17.780000Z
    material_package_umid: 0x060A2B340101010501010D20130000008B424A7E644711E498A7002436F56128
    timecode        : 00:59:50;00
  Duration: 00:44:40.01, start: 0.000000, bitrate: 42596 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt470bg/bt470m/bt470m, top first), 720x512 [SAR 128:135 DAR 4:3], 30000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 59.94 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 4.0, s16, 3072 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128
Stream specifier ':a:1' in filtergraph description [0:a:0][0:a:1]amerge,channelmap=channel_layout=stereo[st],aresample=async=1:min_hard_comp=0.100000:first_pts=0 matches no streams.
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Guessed Channel Layout for Input Stream #0.1 : 4.0
Input #0, mxf, from 'Untold Stories of the ER episode 101.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    uid             : 8bbcdb9a-6447-11e4-98a7-002436f56128
    generation_uid  : 8bbcdbb8-6447-11e4-98a7-002436f56128
    company_name    : OC
    product_name    : OCTk
    product_version : 2.6
    product_uid     : 109c5440-d21d-b211-8029-001111ebc476
    modification_date: 2014-11-04T12:25:17.780000Z
    material_package_umid: 0x060A2B340101010501010D20130000008B424A7E644711E498A7002436F56128
    timecode        : 00:59:50;00
  Duration: 00:44:40.01, start: 0.000000, bitrate: 42596 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt470bg/bt470m/bt470m, top first), 720x512 [SAR 128:135 DAR 4:3], 30000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 59.94 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 4.0, s16, 3072 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D20130000008B408180644711E498A7002436F56128
Stream specifier ':a:1' in filtergraph description [0:a:0][0:a:1]amerge,channelmap=channel_layout=stereo[st],aresample=async=1:min_hard_comp=0.100000:first_pts=0 matches no streams.
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untold Stories of the ER episode 205.mxf':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2014-11-12T19:53:48.000000Z
    com.apple.finalcutstudio.media.uuid: 0B4B8750-C571-4BE7-B5FC-01AFC9B7C90B
  Duration: 00:45:38.00, start: 0.000000, bitrate: 34623 kb/s
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3n / 0x6E33786D), yuv422p(tv, bt470bg/bt470m/bt470m, bottom coded first (swapped)), 720x512 [SAR 128:135 DAR 4:3], 29999 kb/s, SAR 10:11 DAR 225:176, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : MPEG IMX 525/60i (30 MBit/s)
      timecode        : 01:00:00;00
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:5(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-11-12T20:08:55.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 01:00:00;00
Stream mapping:
  Stream #0:1 (pcm_s24le) -> amerge:in0 (graph 0)
  Stream #0:2 (pcm_s24le) -> amerge:in1 (graph 0)
  Stream #0:3 (pcm_s24le) -> aresample (graph 0)
  aresample (graph 0) -> Stream #0:0 (aac)
  Stream #0:0 -> #0:1 (mpeg2video (native) -> h264 (libx264))
  channelmap (graph 0) -> Stream #0:2 (aac)
Press [q] to stop, [?] for help
[Parsed_amerge_0 @ 0x7fa65dc04e80] No channel layout for input 1
[Parsed_amerge_0 @ 0x7fa65dc04e80] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[libx264 @ 0x7fa66100de00] using SAR=10/11
[libx264 @ 0x7fa66100de00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fa66100de00] profile Main, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x7fa66100de00] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:-1:-1 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.15 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=48 keyint_min=4 scenecut=0 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=12000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=15000 vbv_bufsize=12384 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Untold Stories of the ER episode 205.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    com.apple.finalcutstudio.media.uuid: 0B4B8750-C571-4BE7-B5FC-01AFC9B7C90B
    encoder         : Lavf58.45.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.91.100 aac
    Stream #0:1(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x512 [SAR 10:11 DAR 225:176], q=-1--1, 12000 kb/s, 0.03 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Video Media Handler
      timecode        : 01:00:00;00
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 15000000/0/12000000 buffer size: 12384000 vbv_delay: N/A
    Stream #0:2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.91.100 aac
frame=  101 fps=0.0 q=11.0 size=    1536kB time=00:00:03.94 bitrate=3188.3kbits/frame=  209 fps=208 q=11.0 size=    7168kB time=00:00:07.95 bitrate=7379.4kbits/frame=  332 fps=221 q=6.0 size=   11264kB time=00:00:11.96 bitrate=7710.2kbits/sframe=  449 fps=224 q=8.0 size=   16640kB time=00:00:15.42 bitrate=8837.9kbits/sframe=  557 fps=222 q=9.0 size=   23296kB time=00:00:18.96 bitrate=10062.6kbits/frame=  664 fps=221 q=11.0 size=   29952kB time=00:00:22.97 bitrate=10679.3kbitsframe=  777 fps=222 q=11.0 size=   36096kB time=00:00:25.96 bitrate=11389.4kbitsframe=  883 fps=220 q=10.0 size=   40704kB time=00:00:29.97 bitrate=11124.8kbitsframe=  989 fps=219 q=10.0 size=   45824kB time=00:00:33.98 bitrate=11046.1kbitsframe= 1104 fps=220 q=10.0 size=   51968kB time=00:00:36.99 bitrate=11508.5kbitsframe= 119frame=frame=82058 fps=207 q=-1.0 Lsize= 4113982kB time=00:45:38.00 bitrate=12308.9kbits/s speed=6.92x
video:3991853kB audio:118879kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.079064%
[aac @ 0x7fa66100cc00] Qavg: 20965.652
[libx264 @ 0x7fa66100de00] frame I:1710  Avg QP: 2.44  size: 85781
[libx264 @ 0x7fa66100de00] frame P:25015 Avg QP: 5.49  size: 63495
[libx264 @ 0x7fa66100de00] frame B:55333 Avg QP: 7.19  size: 42518
[libx264 @ 0x7fa66100de00] consecutive B-frames:  7.4%  5.0%  9.5% 78.1%
[libx264 @ 0x7fa66100de00] mb I  I16..4: 43.0%  0.0% 57.0%
[libx264 @ 0x7fa66100de00] mb P  I16..4: 31.0%  0.0%  0.0%  P16..4: 36.8%  0.0%  0.0%  0.0%  0.0%    skip:32.2%
[libx264 @ 0x7fa66100de00] mb B  I16..4: 13.5%  0.0%  0.0%  B16..8: 30.7%  0.0%  0.0%  direct:20.5%  skip:35.3%  L0:19.3% L1:19.2% BI:61.5%
[libx264 @ 0x7fa66100de00] coded y,uvDC,uvAC intra: 92.4% 91.0% 89.9% inter: 54.0% 51.4% 44.9%
[libx264 @ 0x7fa66100de00] i16 v,h,dc,p: 30% 20% 34% 16%
[libx264 @ 0x7fa66100de00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 22%  9%  6%  7%  7%  7%  8%  8%
[libx264 @ 0x7fa66100de00] i8c dc,h,v,p: 57% 18% 17%  7%
[libx264 @ 0x7fa66100de00] Weighted P-Frames: Y:3.0% UV:1.3%
[libx264 @ 0x7fa66100de00] kb/s:11943.47
[aac @ 0x7fa6610b9e00] Qavg: 3838.157
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.62)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.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
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untold Stories of the ER episode 205.mxf':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2014-11-12T19:53:48.000000Z
    com.apple.finalcutstudio.media.uuid: 0B4B8750-C571-4BE7-B5FC-01AFC9B7C90B
  Duration: 00:45:38.00, start: 0.000000, bitrate: 34623 kb/s
    Stream #0:0(eng): Video: mpeg2video (4:2:2) (mx3n / 0x6E33786D), yuv422p(tv, bt470bg/bt470m/bt470m, bottom coded first (swapped)), 720x512 [SAR 128:135 DAR 4:3], 29999 kb/s, SAR 10:11 DAR 225:176, 29.97 fps, 29.97 tbr, 2997 tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : MPEG IMX 525/60i (30 MBit/s)
      timecode        : 01:00:00;00
    Side data:
      cpb: bitrate max/min/avg: 30000000/0/0 buffer size: 9437184 vbv_delay: N/A
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:5(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2014-11-12T20:08:55.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 01:00:00;00
Stream mapping:
  Stream #0:1 (pcm_s24le) -> amerge:in0 (graph 0)
  Stream #0:2 (pcm_s24le) -> amerge:in1 (graph 0)
  Stream #0:3 (pcm_s24le) -> aresample (graph 0)
  aresample (graph 0) -> Stream #0:0 (aac)
  Stream #0:0 -> #0:1 (mpeg2video (native) -> h264 (libx264))
  channelmap (graph 0) -> Stream #0:2 (aac)
Press [q] to stop, [?] for help
[Parsed_amerge_0 @ 0x7ff3ca60f880] No channel layout for input 1
[Parsed_amerge_0 @ 0x7ff3ca60f880] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[libx264 @ 0x7ff3ca82ae00] using SAR=10/11
[libx264 @ 0x7ff3ca82ae00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7ff3ca82ae00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7ff3ca82ae00] x264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=48 keyint_min=4 scenecut=0 intra_refresh=0 rc_lookahead=40 rc=2pass mbtree=1 bitrate=12000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 cplxblur=20.0 qblur=0.5 vbv_maxrate=15000 vbv_bufsize=12384 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Untold Stories of the ER episode 205.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    com.apple.finalcutstudio.media.uuid: 0B4B8750-C571-4BE7-B5FC-01AFC9B7C90B
    encoder         : Lavf58.45.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.91.100 aac
    Stream #0:1(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x512 [SAR 10:11 DAR 225:176], q=-1--1, 12000 kb/s, 0.03 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2014-11-12T19:53:48.000000Z
      handler_name    : Apple Video Media Handler
      timecode        : 01:00:00;00
      encoder         : Lavc58.91.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 15000000/0/12000000 buffer size: 12384000 vbv_delay: N/A
    Stream #0:2: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc58.91.100 aac
frame=82058 fps= 77 q=-1.0 Lsize= 4133372kB time=00:45:38.00 bitrate=12366.9kbits/s speed=2.56x
video:4011243kB audio:118879kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.078693%
[aac @ 0x7ff3ca819800] Qavg: 20965.652
[libx264 @ 0x7ff3ca82ae00] frame I:1710  Avg QP: 4.11  size: 73669
[libx264 @ 0x7ff3ca82ae00] frame P:25015 Avg QP: 6.40  size: 60778
[libx264 @ 0x7ff3ca82ae00] frame B:55333 Avg QP: 7.88  size: 44479
[libx264 @ 0x7ff3ca82ae00] consecutive B-frames:  7.4%  5.0%  9.5% 78.1%
[libx264 @ 0x7ff3ca82ae00] mb I  I16..4: 40.1% 30.5% 29.3%
[libx264 @ 0x7ff3ca82ae00] mb P  I16..4:  4.3% 30.5% 13.8%  P16..4:  6.0%  7.9%  5.3%  0.0%  0.0%    skip:32.2%
[libx264 @ 0x7ff3ca82ae00] mb B  I16..4:  1.5% 16.2%  6.9%  B16..8: 12.5% 10.3%  5.2%  direct:11.4%  skip:36.0%  L0:27.5% L1:22.7% BI:49.8%
[libx264 @ 0x7ff3ca82ae00] 8x8 transform intra:62.3% inter:48.7%
[libx264 @ 0x7ff3ca82ae00] coded y,uvDC,uvAC intra: 94.3% 94.9% 94.3% inter: 43.9% 44.5% 42.2%
[libx264 @ 0x7ff3ca82ae00] i16 v,h,dc,p: 39% 20% 23% 19%
[libx264 @ 0x7ff3ca82ae00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 17% 23%  4%  4%  5%  4%  7%  6%
[libx264 @ 0x7ff3ca82ae00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 21% 12%  6%  8%  8%  8%  7%  7%
[libx264 @ 0x7ff3ca82ae00] i8c dc,h,v,p: 56% 17% 19%  9%
[libx264 @ 0x7ff3ca82ae00] Weighted P-Frames: Y:3.4% UV:1.3%
[libx264 @ 0x7ff3ca82ae00] ref P L0: 49.8% 18.8% 18.6% 12.6%  0.2%
[libx264 @ 0x7ff3ca82ae00] ref B L0: 83.8% 12.7%  3.5%
[libx264 @ 0x7ff3ca82ae00] ref B L1: 94.1%  5.9%
[libx264 @ 0x7ff3ca82ae00] kb/s:12001.49
[aac @ 0x7ff3ca82c600] Qavg: 3838.157

I know there are a couple things wrong with the script because I'm getting audio from the 3rd source channel muxed into my outputs when the script is successful and because some of the files fail outright. I think the files that fail outright are due to my incorrectly defining the input streams/channels for the filter.

I have tried omitting this part completely

aresample=async=1:min_hard_comp=0.100000:first_pts=0

And tried several combinations of:

`[0:a][1:a] [0:a:1][0:a:2] [0:a:1.1][0:a:1.2]'

etc.

I guess first things first would be trying figure out if this script can be altered to work on both sources and if not, how to alter it so it works on the source that is currently not working.

I appreciate any advice you may have.

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.