Superposición FFMPEG de múltiples videos

0

Estoy tratando de superponer varios videos en un video base, los videos se superponen pero el audio del video base primario se pierde. Además, si quiero agregar más videos, ¿qué pasos debo seguir?

El siguiente es mi comando:

ffmpeg -i master_video.mp4 -i comment_1_offset.mp4 -i comment_2_offset.mp4 -filter_complex "[0:v][1:v]overlay=900:450:enable='between(t\,06,12)'[bg];[bg][2:v]overlay=0:0:enable='between(t\,8,15)'[v]; [1:a][2:a]amerge=inputs=2[a]"  -map "[v]" -map "[a]" -ac 2 final_comments.mp4

OUTPUT:
ffmpeg version 3.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
  libavutil      55. 27.100 / 55. 27.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'master_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.24.2
  Duration: 00:00:29.57, start: 0.000000, bitrate: 1421 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1032 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 383 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'comment_1_offset.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.40.101
  Duration: 00:00:11.28, start: 0.000000, bitrate: 292 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 4:3 DAR 16:9], 127 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 338 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'comment_2_offset.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.40.101
  Duration: 00:00:15.03, start: 0.000000, bitrate: 409 kb/s
    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x568, 359 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #2:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 70 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'final_comments.mp4' already exists. Overwrite ? [y/N] y
[Parsed_amerge_2 @ 0x7fc833703300] No channel layout for input 1
[Parsed_amerge_2 @ 0x7fc833703300] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[libx264 @ 0x7fc833831e00] using SAR=1/1
[libx264 @ 0x7fc833831e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fc833831e00] profile High, level 3.1
[libx264 @ 0x7fc833831e00] 264 - core 148 r2668 fd2c324 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x7fc833830c00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'final_comments.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.40.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.48.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      encoder         : Lavc57.48.101 aac
Stream mapping:
  Stream #0:0 (h264) -> overlay:main
  Stream #1:0 (h264) -> overlay:overlay
  Stream #1:1 (aac) -> amerge:in0
  Stream #2:0 (h264) -> overlay:overlay
  Stream #2:1 (aac) -> amerge:in1
  overlay -> Stream #0:0 (libx264)
  amerge -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[Parsed_overlay_0 @ 0x7fc833702200] [framesync @ 0x7fc8337024e8] Buffer queue overflow, dropping.
    Last message repeated 80 times
[Parsed_overlay_1 @ 0x7fc833702be0] [framesync @ 0x7fc833702cc8] Buffer queue overflow, dropping.
    Last message repeated 110 times
frame=   44 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   56 fps= 52 q=28.0 size=       0kB time=00:00:00.12 bitrate=   3.2kbits/frame=   69 fps= 43 q=28.0 size= Error while decoding stream #2:1: Cannot allocate memory.26 bitrate=1445.6kbits/s speed=1.35x     00:01.16 bitrate=   0.3kbits/s speed=0.542x    
    Last message repeated 10 times
Error while decoding stream #2:1: Cannot allocate memory.26 bitrate=1536.6kbits/s speed=1.27x    
    Last message repeated 37 times
Error while decoding stream #2:1: Cannot allocate memory.68 bitrate=1531.0kbits/s speed=1.24x    
    Last message repeated 39 times
Error while decoding stream #2:1: Cannot allocate memory.60 bitrate=1419.2kbits/s speed=1.27x    
    Last message repeated 9 times
frame=  739 fps= 37 q=-1.0 Lsize=    4778kB time=00:00:29.44 bitrate=1329.4kbits/s speed=1.49x    
video:4682kB audio:85kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.223951%
[libx264 @ 0x7fc833831e00] frame I:7     Avg QP:16.70  size: 97405
[libx264 @ 0x7fc833831e00] frame P:379   Avg QP:22.09  size:  8715
[libx264 @ 0x7fc833831e00] frame B:353   Avg QP:25.96  size:  2291
[libx264 @ 0x7fc833831e00] consecutive B-frames: 34.9%  1.1%  9.3% 54.7%
[libx264 @ 0x7fc833831e00] mb I  I16..4: 14.9% 38.0% 47.1%
[libx264 @ 0x7fc833831e00] mb P  I16..4:  2.4%  3.4%  0.5%  P16..4: 32.4%  7.8%  3.0%  0.0%  0.0%    skip:50.5%
[libx264 @ 0x7fc833831e00] mb B  I16..4:  0.2%  0.3%  0.0%  B16..8: 28.4%  1.6%  0.2%  direct: 0.6%  skip:68.5%  L0:52.1% L1:45.1% BI: 2.9%
[libx264 @ 0x7fc833831e00] 8x8 transform intra:51.1% inter:69.4%
[libx264 @ 0x7fc833831e00] coded y,uvDC,uvAC intra: 47.1% 69.1% 21.1% inter: 7.0% 11.1% 0.3%
[libx264 @ 0x7fc833831e00] i16 v,h,dc,p: 26% 30% 13% 31%
[libx264 @ 0x7fc833831e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 22% 22%  4%  5%  5%  5%  6%  6%
[libx264 @ 0x7fc833831e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 17% 11%  8%  9%  9%  8%  9%  8%
[libx264 @ 0x7fc833831e00] i8c dc,h,v,p: 48% 21% 23%  9%
[libx264 @ 0x7fc833831e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fc833831e00] ref P L0: 80.1%  9.7%  8.2%  2.1%
[libx264 @ 0x7fc833831e00] ref B L0: 93.6%  5.5%  0.9%
[libx264 @ 0x7fc833831e00] ref B L1: 96.6%  3.4%
[libx264 @ 0x7fc833831e00] kb/s:1297.28
[aac @ 0x7fc833851c00] Qavg: 805.732
Pantalón Rakesh
fuente
Debe mostrar la salida completa de la consola desde su comando. Usted edita su pregunta para añadir esta información requerida.
llogan
Pregunta editada
Rakesh Pant