1

I'm trying to join together two videos on top of each other. I already did these two ffmpeg commands:

ffmpeg -i 2_Out_of_Control.VOB -aspect 16:9 \
-vf "yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,scale=1280:720,boxblur=lp=13" \
-c:v libx264 -preset medium \
-c:a copy \
'2(blurred)Out_of_Control.mp4'

ffmpeg -i 2_Out_of_Control.VOB \
-vf "yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,scale=1080:720" \
-c:v libx264 -preset medium \
-c:a copy \
'2(clear)Out_of_Control.mp4'

I'm currently stuck on making the "clear" version centered and on top of the "blurred" version. I'm not sure how to do that. Only achieved it by using OpenShot but yeah, would prefer if there is an ffmpeg command to merge the two videos on top of each other.

Input file details:

$ ffmpeg -i 2_Out_of_Control.VOB 
ffmpeg version git-2013-10-03-c7fe2a3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct  4 2013 05:22:06 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --prefix=/home/username/ffmpeg_build --extra-cflags=-I/home/username/ffmpeg_build/include --extra-ldflags=-L/home/username/ffmpeg_build/lib --bindir=/home/username/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 46.100 / 52. 46.100
  libavcodec     55. 34.100 / 55. 34.100
  libavformat    55. 19.100 / 55. 19.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 88.101 /  3. 88.101
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpeg, from '2_Out_of_Control.VOB':
  Duration: 00:05:00.01, start: 0.500000, bitrate: 4574 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 8:9 DAR 4:3], max. 9334 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s
At least one output file must be specified
4
  • You can use the overlay video filter to do this. I can give you an example that (possibly) does everything in one command, but you did not say where you want the overlay to be placed (left, centered, right, etc). Also please include the complete console output for each ffmpeg command.
    – llogan
    Oct 17, 2013 at 17:47
  • Thank you for the response @LordNeckbeard! I edited the original post and added that I need "clear" video on top of the "blurred" video in the center. Thanks again for the response :)
    – AisIceEyes
    Oct 18, 2013 at 5:08
  • I've edited again my question @LordNeckbeard :) Though yeah - I've been thinking, is it possible that it can just be one input of the vob, doing both the "blurred" and the "clear" videos, instead of using ffmpeg thrice? Thanks again for helping :)
    – AisIceEyes
    Oct 19, 2013 at 13:46
  • I have edited again the starting post. The info you requested is at Edit3. Thanks again @LordNeckbeard for helping :D
    – AisIceEyes
    Oct 20, 2013 at 7:32

1 Answer 1

1

Overlay normal video over a blurred version

normal image overlaid over blurry version
Example of 1/2 size overlay on top of blurred original (or it could represent a 2x sized background behind original sized overlay)

I incorporated your original parameters but the crop and forced upscale may cause a somewhat blurry and squished or stretched look (but I'm not sure in this case as I am unable to test at the moment).

ffmpeg -i input -filter_complex \
"[0:v]yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,split[v1][v2]; \
 [v1]scale=1280:720,boxblur=lp=13[bg]; \
 [v2]scale=1080:720[fg]; \
 [bg][fg]overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2,setdar=16/9[video]" \
 -map "[video]" -c:v libx264 -preset medium -crf 20 -c:a copy \
 output.mp4

The filtergraph

  1. Deinterlace with yadif, crop, and then split the results. Name these outputs [v1] and [v2].

  2. scale and boxblur [v1]. Name the output [bg] as in "background".

  3. scale [v2]. Name the output [fg] as in "foreground".

  4. overlay [fg] on top of [bg]. Make it centered. Then set the display aspect ratio with setdar. Name this output [video] so you can refer to it with -map.

Also see

2
  • When I tried doing it, I'm having this error @LordNeckbeard: Failed to set value '[0:v]yadif=0:-1:0,crop=w=714:h=476:x=6:y=0,split[v1][v2]; [v1]scale=1280:720,boxblur=lp=13[bg]; [v2]scale=1080:720[fg]; [bg][fg]overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2,setdar=16/9[video]' for option 'filter_complex': Option not found - do I have to recompile my ffmpeg for it to have a filter_complex?
    – AisIceEyes
    Oct 21, 2013 at 0:59
  • Oh, it works now, @LordNeckbeard. That was weird. Or maybe because I tried using ffplay instead of ffmpeg first. Let's see the final vid once it finishes encoding. Thanks again for helping!
    – AisIceEyes
    Oct 21, 2013 at 2:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .