Overlay a video on another video at specific time with FFmpeg





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am trying to overlay a video with another video. I followed the original command OP posted here. And it works, but it overlays the video from time 0:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  new.mp4 


I tried the correct answer to specify a time, but it is not working for me: 1) the overlay starts at around second 12, and 2) video is not played after the overlay is finished.



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a]; [0:v][a]overlay=enable=gte(t,5):shortest=1[out]" -map [out] -map 0:a -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a copy new.mp4


Anything changed recently on FFmpeg?! Why isn't it working?



Here is the output of this command (it finishes very fast):



ffmpeg version N-92906-g54109b1d14 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181201
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 25.100 / 56. 25.100
libavcodec 58. 43.100 / 58. 43.100
libavformat 58. 25.100 / 58. 25.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '720480.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2018-07-26T09:23:16.000000Z
Duration: 00:01:50.17, start: 0.000000, bitrate: 3181 kb/s
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x480 [SAR 8:9 DAR 4:3], 2785 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : VideoHandler
timecode : 00:59:55:12
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:5: Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : TimecodeMediaHandler
timecode : 00:59:55:12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'sdbug.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-08-29T14:50:13.000000Z
Duration: 00:00:10.01, start: 0.000000, bitrate: 10504 kb/s
Stream #1:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 720x486, 9666 kb/s, SAR 109:120 DAR 109:81, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Apple Video Media Handler
encoder : Animation
timecode : 00:00:00;00
Stream #1:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Time Code Media Handler
timecode : 00:00:00;00
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (qtrle) -> setpts
overlay -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 000002b902a3f480] using SAR=8/9
[libx264 @ 000002b902a3f480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002b902a3f480] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000002b902a3f480] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'new.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.43.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
frame= 599 fps= 92 q=-1.0 Lsize= 11556kB time=00:01:50.01 bitrate= 860.5kbits/s speed=16.8x
video:6173kB audio:5288kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.828358%
[libx264 @ 000002b902a3f480] frame I:8 Avg QP:13.24 size: 44134
[libx264 @ 000002b902a3f480] frame P:174 Avg QP:18.62 size: 20916
[libx264 @ 000002b902a3f480] frame B:417 Avg QP:21.31 size: 5583
[libx264 @ 000002b902a3f480] consecutive B-frames: 6.0% 1.7% 5.5% 86.8%
[libx264 @ 000002b902a3f480] mb I I16..4: 15.9% 58.9% 25.2%
[libx264 @ 000002b902a3f480] mb P I16..4: 1.4% 13.6% 4.2% P16..4: 36.6% 22.8% 12.3% 0.0% 0.0% skip: 9.0%
[libx264 @ 000002b902a3f480] mb B I16..4: 0.1% 0.9% 0.3% B16..8: 46.4% 10.6% 2.9% direct: 5.5% skip:33.3% L0:53.4% L1:36.9% BI: 9.7%
[libx264 @ 000002b902a3f480] 8x8 transform intra:68.5% inter:65.1%
[libx264 @ 000002b902a3f480] coded y,uvDC,uvAC intra: 77.5% 89.5% 77.2% inter: 26.8% 48.1% 10.1%
[libx264 @ 000002b902a3f480] i16 v,h,dc,p: 50% 13% 13% 23%
[libx264 @ 000002b902a3f480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 17% 6% 8% 10% 7% 9% 7%
[libx264 @ 000002b902a3f480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 10% 7% 12% 11% 9% 9% 7%
[libx264 @ 000002b902a3f480] i8c dc,h,v,p: 51% 15% 24% 10%
[libx264 @ 000002b902a3f480] Weighted P-Frames: Y:5.2% UV:2.9%
[libx264 @ 000002b902a3f480] ref P L0: 60.1% 19.6% 15.8% 4.4% 0.1%
[libx264 @ 000002b902a3f480] ref B L0: 91.6% 7.3% 1.1%
[libx264 @ 000002b902a3f480] ref B L1: 97.2% 2.8%
[libx264 @ 000002b902a3f480] kb/s:2529.97









share|improve this question

























  • Change setpts=PTS-10/TB to setpts=PTS+10/TB.

    – llogan
    Jan 3 at 21:53











  • Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

    – Tina J
    Jan 3 at 22:11











  • Without your actual command and the complete console output I can only provided guesses.

    – llogan
    Jan 3 at 22:58











  • Commands above are exact command. Updated with the output as well.

    – Tina J
    Jan 3 at 23:07


















0















I am trying to overlay a video with another video. I followed the original command OP posted here. And it works, but it overlays the video from time 0:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  new.mp4 


I tried the correct answer to specify a time, but it is not working for me: 1) the overlay starts at around second 12, and 2) video is not played after the overlay is finished.



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a]; [0:v][a]overlay=enable=gte(t,5):shortest=1[out]" -map [out] -map 0:a -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a copy new.mp4


Anything changed recently on FFmpeg?! Why isn't it working?



Here is the output of this command (it finishes very fast):



ffmpeg version N-92906-g54109b1d14 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181201
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 25.100 / 56. 25.100
libavcodec 58. 43.100 / 58. 43.100
libavformat 58. 25.100 / 58. 25.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '720480.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2018-07-26T09:23:16.000000Z
Duration: 00:01:50.17, start: 0.000000, bitrate: 3181 kb/s
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x480 [SAR 8:9 DAR 4:3], 2785 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : VideoHandler
timecode : 00:59:55:12
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:5: Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : TimecodeMediaHandler
timecode : 00:59:55:12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'sdbug.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-08-29T14:50:13.000000Z
Duration: 00:00:10.01, start: 0.000000, bitrate: 10504 kb/s
Stream #1:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 720x486, 9666 kb/s, SAR 109:120 DAR 109:81, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Apple Video Media Handler
encoder : Animation
timecode : 00:00:00;00
Stream #1:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Time Code Media Handler
timecode : 00:00:00;00
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (qtrle) -> setpts
overlay -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 000002b902a3f480] using SAR=8/9
[libx264 @ 000002b902a3f480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002b902a3f480] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000002b902a3f480] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'new.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.43.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
frame= 599 fps= 92 q=-1.0 Lsize= 11556kB time=00:01:50.01 bitrate= 860.5kbits/s speed=16.8x
video:6173kB audio:5288kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.828358%
[libx264 @ 000002b902a3f480] frame I:8 Avg QP:13.24 size: 44134
[libx264 @ 000002b902a3f480] frame P:174 Avg QP:18.62 size: 20916
[libx264 @ 000002b902a3f480] frame B:417 Avg QP:21.31 size: 5583
[libx264 @ 000002b902a3f480] consecutive B-frames: 6.0% 1.7% 5.5% 86.8%
[libx264 @ 000002b902a3f480] mb I I16..4: 15.9% 58.9% 25.2%
[libx264 @ 000002b902a3f480] mb P I16..4: 1.4% 13.6% 4.2% P16..4: 36.6% 22.8% 12.3% 0.0% 0.0% skip: 9.0%
[libx264 @ 000002b902a3f480] mb B I16..4: 0.1% 0.9% 0.3% B16..8: 46.4% 10.6% 2.9% direct: 5.5% skip:33.3% L0:53.4% L1:36.9% BI: 9.7%
[libx264 @ 000002b902a3f480] 8x8 transform intra:68.5% inter:65.1%
[libx264 @ 000002b902a3f480] coded y,uvDC,uvAC intra: 77.5% 89.5% 77.2% inter: 26.8% 48.1% 10.1%
[libx264 @ 000002b902a3f480] i16 v,h,dc,p: 50% 13% 13% 23%
[libx264 @ 000002b902a3f480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 17% 6% 8% 10% 7% 9% 7%
[libx264 @ 000002b902a3f480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 10% 7% 12% 11% 9% 9% 7%
[libx264 @ 000002b902a3f480] i8c dc,h,v,p: 51% 15% 24% 10%
[libx264 @ 000002b902a3f480] Weighted P-Frames: Y:5.2% UV:2.9%
[libx264 @ 000002b902a3f480] ref P L0: 60.1% 19.6% 15.8% 4.4% 0.1%
[libx264 @ 000002b902a3f480] ref B L0: 91.6% 7.3% 1.1%
[libx264 @ 000002b902a3f480] ref B L1: 97.2% 2.8%
[libx264 @ 000002b902a3f480] kb/s:2529.97









share|improve this question

























  • Change setpts=PTS-10/TB to setpts=PTS+10/TB.

    – llogan
    Jan 3 at 21:53











  • Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

    – Tina J
    Jan 3 at 22:11











  • Without your actual command and the complete console output I can only provided guesses.

    – llogan
    Jan 3 at 22:58











  • Commands above are exact command. Updated with the output as well.

    – Tina J
    Jan 3 at 23:07














0












0








0


1






I am trying to overlay a video with another video. I followed the original command OP posted here. And it works, but it overlays the video from time 0:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  new.mp4 


I tried the correct answer to specify a time, but it is not working for me: 1) the overlay starts at around second 12, and 2) video is not played after the overlay is finished.



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a]; [0:v][a]overlay=enable=gte(t,5):shortest=1[out]" -map [out] -map 0:a -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a copy new.mp4


Anything changed recently on FFmpeg?! Why isn't it working?



Here is the output of this command (it finishes very fast):



ffmpeg version N-92906-g54109b1d14 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181201
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 25.100 / 56. 25.100
libavcodec 58. 43.100 / 58. 43.100
libavformat 58. 25.100 / 58. 25.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '720480.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2018-07-26T09:23:16.000000Z
Duration: 00:01:50.17, start: 0.000000, bitrate: 3181 kb/s
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x480 [SAR 8:9 DAR 4:3], 2785 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : VideoHandler
timecode : 00:59:55:12
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:5: Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : TimecodeMediaHandler
timecode : 00:59:55:12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'sdbug.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-08-29T14:50:13.000000Z
Duration: 00:00:10.01, start: 0.000000, bitrate: 10504 kb/s
Stream #1:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 720x486, 9666 kb/s, SAR 109:120 DAR 109:81, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Apple Video Media Handler
encoder : Animation
timecode : 00:00:00;00
Stream #1:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Time Code Media Handler
timecode : 00:00:00;00
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (qtrle) -> setpts
overlay -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 000002b902a3f480] using SAR=8/9
[libx264 @ 000002b902a3f480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002b902a3f480] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000002b902a3f480] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'new.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.43.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
frame= 599 fps= 92 q=-1.0 Lsize= 11556kB time=00:01:50.01 bitrate= 860.5kbits/s speed=16.8x
video:6173kB audio:5288kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.828358%
[libx264 @ 000002b902a3f480] frame I:8 Avg QP:13.24 size: 44134
[libx264 @ 000002b902a3f480] frame P:174 Avg QP:18.62 size: 20916
[libx264 @ 000002b902a3f480] frame B:417 Avg QP:21.31 size: 5583
[libx264 @ 000002b902a3f480] consecutive B-frames: 6.0% 1.7% 5.5% 86.8%
[libx264 @ 000002b902a3f480] mb I I16..4: 15.9% 58.9% 25.2%
[libx264 @ 000002b902a3f480] mb P I16..4: 1.4% 13.6% 4.2% P16..4: 36.6% 22.8% 12.3% 0.0% 0.0% skip: 9.0%
[libx264 @ 000002b902a3f480] mb B I16..4: 0.1% 0.9% 0.3% B16..8: 46.4% 10.6% 2.9% direct: 5.5% skip:33.3% L0:53.4% L1:36.9% BI: 9.7%
[libx264 @ 000002b902a3f480] 8x8 transform intra:68.5% inter:65.1%
[libx264 @ 000002b902a3f480] coded y,uvDC,uvAC intra: 77.5% 89.5% 77.2% inter: 26.8% 48.1% 10.1%
[libx264 @ 000002b902a3f480] i16 v,h,dc,p: 50% 13% 13% 23%
[libx264 @ 000002b902a3f480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 17% 6% 8% 10% 7% 9% 7%
[libx264 @ 000002b902a3f480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 10% 7% 12% 11% 9% 9% 7%
[libx264 @ 000002b902a3f480] i8c dc,h,v,p: 51% 15% 24% 10%
[libx264 @ 000002b902a3f480] Weighted P-Frames: Y:5.2% UV:2.9%
[libx264 @ 000002b902a3f480] ref P L0: 60.1% 19.6% 15.8% 4.4% 0.1%
[libx264 @ 000002b902a3f480] ref B L0: 91.6% 7.3% 1.1%
[libx264 @ 000002b902a3f480] ref B L1: 97.2% 2.8%
[libx264 @ 000002b902a3f480] kb/s:2529.97









share|improve this question
















I am trying to overlay a video with another video. I followed the original command OP posted here. And it works, but it overlays the video from time 0:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -map 0:1 -pix_fmt yuv420p -c:a copy -c:v libx264 -crf 18  new.mp4 


I tried the correct answer to specify a time, but it is not working for me: 1) the overlay starts at around second 12, and 2) video is not played after the overlay is finished.



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a]; [0:v][a]overlay=enable=gte(t,5):shortest=1[out]" -map [out] -map 0:a -c:v libx264 -crf 18 -pix_fmt yuv420p -c:a copy new.mp4


Anything changed recently on FFmpeg?! Why isn't it working?



Here is the output of this command (it finishes very fast):



ffmpeg version N-92906-g54109b1d14 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181201
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 25.100 / 56. 25.100
libavcodec 58. 43.100 / 58. 43.100
libavformat 58. 25.100 / 58. 25.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '720480.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2018-07-26T09:23:16.000000Z
Duration: 00:01:50.17, start: 0.000000, bitrate: 3181 kb/s
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x480 [SAR 8:9 DAR 4:3], 2785 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : VideoHandler
timecode : 00:59:55:12
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:5: Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : TimecodeMediaHandler
timecode : 00:59:55:12
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'sdbug.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2018-08-29T14:50:13.000000Z
Duration: 00:00:10.01, start: 0.000000, bitrate: 10504 kb/s
Stream #1:0(eng): Video: qtrle (rle / 0x20656C72), bgra(progressive), 720x486, 9666 kb/s, SAR 109:120 DAR 109:81, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Apple Video Media Handler
encoder : Animation
timecode : 00:00:00;00
Stream #1:1(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2018-08-29T14:50:13.000000Z
handler_name : Time Code Media Handler
timecode : 00:00:00;00
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (qtrle) -> setpts
overlay -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (copy)
Stream #0:2 -> #0:2 (copy)
Stream #0:3 -> #0:3 (copy)
Stream #0:4 -> #0:4 (copy)
Press [q] to stop, [?] for help
[libx264 @ 000002b902a3f480] using SAR=8/9
[libx264 @ 000002b902a3f480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002b902a3f480] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 000002b902a3f480] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'new.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.43.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:2: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:3: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
Stream #0:4: Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 98 kb/s (default)
Metadata:
creation_time : 2018-07-26T09:23:16.000000Z
handler_name : SoundHandler
frame= 599 fps= 92 q=-1.0 Lsize= 11556kB time=00:01:50.01 bitrate= 860.5kbits/s speed=16.8x
video:6173kB audio:5288kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.828358%
[libx264 @ 000002b902a3f480] frame I:8 Avg QP:13.24 size: 44134
[libx264 @ 000002b902a3f480] frame P:174 Avg QP:18.62 size: 20916
[libx264 @ 000002b902a3f480] frame B:417 Avg QP:21.31 size: 5583
[libx264 @ 000002b902a3f480] consecutive B-frames: 6.0% 1.7% 5.5% 86.8%
[libx264 @ 000002b902a3f480] mb I I16..4: 15.9% 58.9% 25.2%
[libx264 @ 000002b902a3f480] mb P I16..4: 1.4% 13.6% 4.2% P16..4: 36.6% 22.8% 12.3% 0.0% 0.0% skip: 9.0%
[libx264 @ 000002b902a3f480] mb B I16..4: 0.1% 0.9% 0.3% B16..8: 46.4% 10.6% 2.9% direct: 5.5% skip:33.3% L0:53.4% L1:36.9% BI: 9.7%
[libx264 @ 000002b902a3f480] 8x8 transform intra:68.5% inter:65.1%
[libx264 @ 000002b902a3f480] coded y,uvDC,uvAC intra: 77.5% 89.5% 77.2% inter: 26.8% 48.1% 10.1%
[libx264 @ 000002b902a3f480] i16 v,h,dc,p: 50% 13% 13% 23%
[libx264 @ 000002b902a3f480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 17% 6% 8% 10% 7% 9% 7%
[libx264 @ 000002b902a3f480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 13% 10% 7% 12% 11% 9% 9% 7%
[libx264 @ 000002b902a3f480] i8c dc,h,v,p: 51% 15% 24% 10%
[libx264 @ 000002b902a3f480] Weighted P-Frames: Y:5.2% UV:2.9%
[libx264 @ 000002b902a3f480] ref P L0: 60.1% 19.6% 15.8% 4.4% 0.1%
[libx264 @ 000002b902a3f480] ref B L0: 91.6% 7.3% 1.1%
[libx264 @ 000002b902a3f480] ref B L1: 97.2% 2.8%
[libx264 @ 000002b902a3f480] kb/s:2529.97






video ffmpeg overlay video-processing






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 19:23







Tina J

















asked Jan 3 at 21:17









Tina JTina J

98611445




98611445













  • Change setpts=PTS-10/TB to setpts=PTS+10/TB.

    – llogan
    Jan 3 at 21:53











  • Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

    – Tina J
    Jan 3 at 22:11











  • Without your actual command and the complete console output I can only provided guesses.

    – llogan
    Jan 3 at 22:58











  • Commands above are exact command. Updated with the output as well.

    – Tina J
    Jan 3 at 23:07



















  • Change setpts=PTS-10/TB to setpts=PTS+10/TB.

    – llogan
    Jan 3 at 21:53











  • Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

    – Tina J
    Jan 3 at 22:11











  • Without your actual command and the complete console output I can only provided guesses.

    – llogan
    Jan 3 at 22:58











  • Commands above are exact command. Updated with the output as well.

    – Tina J
    Jan 3 at 23:07

















Change setpts=PTS-10/TB to setpts=PTS+10/TB.

– llogan
Jan 3 at 21:53





Change setpts=PTS-10/TB to setpts=PTS+10/TB.

– llogan
Jan 3 at 21:53













Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

– Tina J
Jan 3 at 22:11





Now two problems: 1) no video is played after the overlay is finished (I see frame freezed!), and 2) It starts at around second 12!

– Tina J
Jan 3 at 22:11













Without your actual command and the complete console output I can only provided guesses.

– llogan
Jan 3 at 22:58





Without your actual command and the complete console output I can only provided guesses.

– llogan
Jan 3 at 22:58













Commands above are exact command. Updated with the output as well.

– Tina J
Jan 3 at 23:07





Commands above are exact command. Updated with the output as well.

– Tina J
Jan 3 at 23:07












1 Answer
1






active

oldest

votes


















1














Change PTS- to PTS+. Remove shortest=1. Add eof_action=pass:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a];[0:v][a]overlay=enable=gte(t,10):eof_action=pass,format=yuv420p[out]" -map "[out]" -map 0:a? -c:v libx264 -crf 18 -c:a copy new.mp4


See the setpts and overlay filter documentation for more info.






share|improve this answer


























  • Now if I want it to overlay at time 0, which ones should I change?!

    – Tina J
    Jan 4 at 0:14











  • Don't forget to add the / after t in gte(t,10)

    – Tina J
    Jan 4 at 0:14






  • 1





    @TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

    – llogan
    Jan 4 at 0:43











  • What difference does it make?! 5 vs 10

    – Tina J
    Jan 4 at 16:48






  • 1





    @TinaJ Works for me.

    – llogan
    Jan 4 at 20:38












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54029929%2foverlay-a-video-on-another-video-at-specific-time-with-ffmpeg%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Change PTS- to PTS+. Remove shortest=1. Add eof_action=pass:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a];[0:v][a]overlay=enable=gte(t,10):eof_action=pass,format=yuv420p[out]" -map "[out]" -map 0:a? -c:v libx264 -crf 18 -c:a copy new.mp4


See the setpts and overlay filter documentation for more info.






share|improve this answer


























  • Now if I want it to overlay at time 0, which ones should I change?!

    – Tina J
    Jan 4 at 0:14











  • Don't forget to add the / after t in gte(t,10)

    – Tina J
    Jan 4 at 0:14






  • 1





    @TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

    – llogan
    Jan 4 at 0:43











  • What difference does it make?! 5 vs 10

    – Tina J
    Jan 4 at 16:48






  • 1





    @TinaJ Works for me.

    – llogan
    Jan 4 at 20:38
















1














Change PTS- to PTS+. Remove shortest=1. Add eof_action=pass:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a];[0:v][a]overlay=enable=gte(t,10):eof_action=pass,format=yuv420p[out]" -map "[out]" -map 0:a? -c:v libx264 -crf 18 -c:a copy new.mp4


See the setpts and overlay filter documentation for more info.






share|improve this answer


























  • Now if I want it to overlay at time 0, which ones should I change?!

    – Tina J
    Jan 4 at 0:14











  • Don't forget to add the / after t in gte(t,10)

    – Tina J
    Jan 4 at 0:14






  • 1





    @TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

    – llogan
    Jan 4 at 0:43











  • What difference does it make?! 5 vs 10

    – Tina J
    Jan 4 at 16:48






  • 1





    @TinaJ Works for me.

    – llogan
    Jan 4 at 20:38














1












1








1







Change PTS- to PTS+. Remove shortest=1. Add eof_action=pass:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a];[0:v][a]overlay=enable=gte(t,10):eof_action=pass,format=yuv420p[out]" -map "[out]" -map 0:a? -c:v libx264 -crf 18 -c:a copy new.mp4


See the setpts and overlay filter documentation for more info.






share|improve this answer















Change PTS- to PTS+. Remove shortest=1. Add eof_action=pass:



ffmpeg -i 720480.mp4 -i sdbug.mov -filter_complex "[1:v]setpts=PTS+10/TB[a];[0:v][a]overlay=enable=gte(t,10):eof_action=pass,format=yuv420p[out]" -map "[out]" -map 0:a? -c:v libx264 -crf 18 -c:a copy new.mp4


See the setpts and overlay filter documentation for more info.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 4 at 0:42

























answered Jan 3 at 23:43









lloganllogan

47.5k14108140




47.5k14108140













  • Now if I want it to overlay at time 0, which ones should I change?!

    – Tina J
    Jan 4 at 0:14











  • Don't forget to add the / after t in gte(t,10)

    – Tina J
    Jan 4 at 0:14






  • 1





    @TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

    – llogan
    Jan 4 at 0:43











  • What difference does it make?! 5 vs 10

    – Tina J
    Jan 4 at 16:48






  • 1





    @TinaJ Works for me.

    – llogan
    Jan 4 at 20:38



















  • Now if I want it to overlay at time 0, which ones should I change?!

    – Tina J
    Jan 4 at 0:14











  • Don't forget to add the / after t in gte(t,10)

    – Tina J
    Jan 4 at 0:14






  • 1





    @TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

    – llogan
    Jan 4 at 0:43











  • What difference does it make?! 5 vs 10

    – Tina J
    Jan 4 at 16:48






  • 1





    @TinaJ Works for me.

    – llogan
    Jan 4 at 20:38

















Now if I want it to overlay at time 0, which ones should I change?!

– Tina J
Jan 4 at 0:14





Now if I want it to overlay at time 0, which ones should I change?!

– Tina J
Jan 4 at 0:14













Don't forget to add the / after t in gte(t,10)

– Tina J
Jan 4 at 0:14





Don't forget to add the / after t in gte(t,10)

– Tina J
Jan 4 at 0:14




1




1





@TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

– llogan
Jan 4 at 0:43





@TinaJ Fixed. I accidentally deleted it when changing the value. Alternatively, you could use 'gte(t,5)' if you prefer.

– llogan
Jan 4 at 0:43













What difference does it make?! 5 vs 10

– Tina J
Jan 4 at 16:48





What difference does it make?! 5 vs 10

– Tina J
Jan 4 at 16:48




1




1





@TinaJ Works for me.

– llogan
Jan 4 at 20:38





@TinaJ Works for me.

– llogan
Jan 4 at 20:38




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54029929%2foverlay-a-video-on-another-video-at-specific-time-with-ffmpeg%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas