5

I have Video out.mp4 have 30 sec I want to put new video image1.mp4 have 5 sec in out.mp4 at 10 seconds i have this code to put my image1.mp4 in out.mp4

ffmpeg -i F:\out.mp4  -vf "movie=image2.mp4 , scale=200:-1,fade=out:200:alpha=1 , [inner]; [in][inner] overlay=70:70 [out]"  -c:v libx264  -s "1080x720" completed.mp4

the output

    >ffmpeg -i F:\out.mp4 -vf "movie=image2.mp4 , scale=200:-1,fade=out:100:alpha=1
 [inner]; [in][inner] overlay=70:70 [out]"  completed.mp4
ffmpeg version N-70411-g7da7d26 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw
b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
 --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab
le-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 24.101 / 56. 24.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.24.101
  Duration: 00:00:16.67, start: 0.000000, bitrate: 309 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 800x640 [
SAR 1:1 DAR 5:4], 306 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
[swscaler @ 0000000005608ea0] deprecated pixel format used, make sure you did se
t range correctly
[libx264 @ 0000000002c1c3a0] using SAR=1/1
[libx264 @ 0000000002c1c3a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0000000002c1c3a0] profile High, level 3.1
[libx264 @ 0000000002c1c3a0] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=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=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'completed.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.24.101
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 8
00x640 [SAR 1:1 DAR 5:4], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.26.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   68 fps=0.0 q=29.0 size=      96kB time=00:00:00.63 bitrate=1245.6kbits/
frame=  111 fps=107 q=29.0 size=     161kB time=00:00:02.06 bitrate= 637.5kbits/
frame=  155 fps=100 q=29.0 size=     222kB time=00:00:03.53 bitrate= 514.3kbits/
frame=  212 fps=103 q=29.0 size=     270kB time=00:00:05.43 bitrate= 406.5kbits/
frame=  270 fps=105 q=29.0 size=     292kB time=00:00:07.36 bitrate= 324.9kbits/
frame=  314 fps=102 q=29.0 size=     465kB time=00:00:08.83 bitrate= 431.6kbits/
frame=  382 fps=106 q=29.0 size=     569kB time=00:00:11.10 bitrate= 420.0kbits/
frame=  461 fps=112 q=29.0 size=     597kB time=00:00:13.73 bitrate= 356.2kbits/
frame=  500 fps=107 q=-1.0 Lsize=     629kB time=00:00:16.60 bitrate= 310.3kbits
/s
video:623kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
verhead: 0.984177%
[libx264 @ 0000000002c1c3a0] frame I:3     Avg QP:15.65  size: 90538
[libx264 @ 0000000002c1c3a0] frame P:190   Avg QP:21.18  size:  1663
[libx264 @ 0000000002c1c3a0] frame B:307   Avg QP:30.53  size:   161
[libx264 @ 0000000002c1c3a0] consecutive B-frames: 18.0%  0.0%  1.2% 80.8%
[libx264 @ 0000000002c1c3a0] mb I  I16..4: 17.4% 72.4% 10.2%
[libx264 @ 0000000002c1c3a0] mb P  I16..4:  0.0%  0.3%  0.2%  P16..4:  5.0%  1.3
%  0.9%  0.0%  0.0%    skip:92.2%
[libx264 @ 0000000002c1c3a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  2.1%  0.3
%  0.1%  direct: 0.1%  skip:97.4%  L0:39.2% L1:52.6% BI: 8.2%
[libx264 @ 0000000002c1c3a0] 8x8 transform intra:68.7% inter:65.2%
[libx264 @ 0000000002c1c3a0] coded y,uvDC,uvAC intra: 79.0% 49.6% 23.6% inter: 1
.1% 1.6% 0.2%
[libx264 @ 0000000002c1c3a0] i16 v,h,dc,p: 92%  5%  1%  2%
[libx264 @ 0000000002c1c3a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19%  8% 22%  7%  8%
12%  5% 13%  6%
[libx264 @ 0000000002c1c3a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 18% 16%  5%  6%
 8%  6%  7%  6%
[libx264 @ 0000000002c1c3a0] i8c dc,h,v,p: 63% 16% 18%  3%
[libx264 @ 0000000002c1c3a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002c1c3a0] ref P L0: 59.0% 18.1% 17.1%  5.8%
[libx264 @ 0000000002c1c3a0] ref B L0: 83.8% 11.7%  4.5%
[libx264 @ 0000000002c1c3a0] ref B L1: 96.5%  3.5%
[libx264 @ 0000000002c1c3a0] kb/s:305.76
Ryodo
  • 445
  • 5
  • 17
Ti Amo Laky
  • 755
  • 2
  • 8
  • 21
  • You need to include the complete console output from your command. – llogan Mar 22 '15 at 21:53
  • Run the command. Once it finishes copy the output and paste it into your question. – llogan Mar 23 '15 at 00:45
  • ok i put the output console :) – Ti Amo Laky Mar 23 '15 at 01:02
  • There is a between option wonder if that would help http://stackoverflow.com/a/29222419/32453 (and select filter?) dunno... – rogerdpack Mar 27 '15 at 20:26
  • 1
    thankyou but i d'ont no how i can do its ffmpeg -i F:\out.mp4 -vf "movie=image2.mp4 , scale=200:-1,fade=out:100:alpha=1 ,select=between(t\,4\,9) [inner]; [in][inner] overlay=70:70 [out]" completed.mp4 but its selected from image2.mp4 not for the input video out.mp4 how i can apply this for input ? – Ryodo Mar 27 '15 at 23:27

1 Answers1

5

You have to split your original video and concat the three parts.

As we can evince from the ffmpeg-user mailing list, there's no current filter to help "insert" ops...

Quoting an August 2014 discussion:

To whom it may be concerned:

Hi, I'm a user of ffmpeg. I know ffmpeg can concat two videos or audios into a new single media file, but I want to insert a video or audio into the middle of the media file,for example, the duration of "a.avi " is 00:05:00, and the duration of "b.rmvb " is 00:01:00, I want to insert "b.rmvb" into the postion "00:02:00" of a.avi, the duration of new a.avi is "00:06:00",how to fulfill it? if not, can you add this new function into ffmpeg and update it? thanks for your attention.

Yes it can, but you would need to split the first video into 2 videos and then concat all 3. That is how an insert works (even in a NLE program like Avid, FCP or Premiere).

Note that all the formats need to be identical and you would need to either use an intra frame edit friendly format or split on an I frame


ffmpeg-user mailing list ffmpeg-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user

F2K
  • 481
  • 4
  • 11
  • 1
    Tks for your post how i can my video and concat again ? – Ryodo Apr 03 '15 at 17:27
  • 1
    @Ryodo you can find a lot of tutorials, here's a link with a bunch of usefull commands (split and join too) http://www.labnol.org/internet/useful-ffmpeg-commands/28490/ – F2K Apr 04 '15 at 09:29