0

I am not able to figure out how to get ffmpeg to make a video that combines (muxes) half-height-cropped from two video sources. The latest generation of ffmpeg (3.x) has a "vstack" filter.

My screen resolution is set to 1280 by 720 pixels.

I have a webcam that is set to provide video at that same resolution.

I want the top half of the webcam's input/feed/stream to be layered on top of the bottom half of the screen-capture-recorder (recording my desktop).

Both source video streams, plus the end output result will have a width of 1280 pixels. The combination of the half-height 2 video stream inputs will end up filling up 720 lines of vertical resolution.

This should be simple.

I'll paste a few of the commands that I've tried and that have failed to work.

ffmpeg.exe -f dshow -i video="screen-capture-recorder" -f dshow -i video="Microsoft LifeCam HD-6000" -vf "crop=1280:360:1280:360" -filter_complex vstack -vcodec libx264 -pix_fmt yuv420p -preset ultrafast 6000screen_take1.mkv

and

I even tried adding : "[0:v][1:v]vstack[v]" -map "[v]" to that , above (previous) command.

See my Google Doc for complete output (what was in my cmd.exe window) :

https://docs.google.com/document/d/1SqtjEY_gM3rdeKPyRzUq_jJhPQUPCK5L4E5HPttwS3s/edit?usp=sharing

1

If you're using filter_complex, then all filtering has to happen within that complex. So,

ffmpeg.exe -f dshow -i video="screen-capture-recorder" \
           -f dshow -i video="Microsoft LifeCam HD-6000" \
-filter_complex "[0:v]crop=1280:360:0:0[v0];[1:v]crop=1280:360:0:0[v1];[v0][v1]vstack[v]" \
-map [v] -vcodec libx264 -pix_fmt yuv420p -preset ultrafast 6000screen_take1.mkv

This stacks the top half of the webcam video below the top half of the desktop capture.


Having taken a look at the console output, you should actually try this:

ffmpeg.exe -f dshow -rtbufsize 9000000 -i video="screen-capture-recorder" \
           -f dshow -i video="Microsoft LifeCam HD-6000" \
-filter_complex "[0:v]crop=1280:360:0:0[v0];[1:v]scale=1280:-1,crop=1280:360:0:0[v1]; \
                 [v0][v1]vstack[v]" \
-map [v] -vcodec libx264 -pix_fmt yuv420p -preset ultrafast 6000screen_take1.mkv
  • You are my hero. Thank you so much. I made a video. youtu.be/iaoKalspcI0 I forgot that I neglected audio, so that post has no sound. Let me work on that next step now ... – user14047 Mar 11 '16 at 14:27
  • I got a pretty good video using : ffmpeg.exe -f dshow -i video="screen-capture-recorder" -f dshow -i video="Microsoft LifeCam HD-6000":audio="virtual-audio-capturer" -filter_complex amix=inputs=1 -filter_complex "[0:v]crop=1280:360:0:0[v0];[1:v]scale=1280:-1,crop=1280:360:0:0[v1]; [v0][v1]vstack[v]" -map [v] -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -acodec pcm_s16le – user14047 Mar 11 '16 at 14:51
0

I made another video and posted it to YouTube.

I used the following command :

  ffmpeg.exe -f dshow -i video="screen-capture-recorder" -f dshow -i video="Microsoft LifeCam HD-6000":audio="virtual-audio-capturer" -filter_complex amix=inputs=1 -filter_complex "[0:v]crop=1280:360:0:0[v0];[1:v]scale=1280:-1,crop=1280:360:0:0[v1]; [v0][v1]vstack[v]" -map [v] -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -acodec pcm_s16le (output video file('s name))

Notice how what is depicted on the top half (virtual on-screen piano keyboard) (both of them) lags behind. Yeah there is latency between the video signal of the top half and the rest of the content.

I suppose there is a more complex solution to this.

I tried tying (chaining) the :"audio=" to both of the video input source/streams

that is , I tried both logical possibilities (variations) :

video="Microsoft LifeCam HD-6000":

and

video="screen-capture-recorder":

Same issue. In fact, the latency doesn't exchange between the different video streams.

  • Try putting -use_wallclock_as_timestamps 1 before each -i – Gyan Mar 11 '16 at 16:28
  • "This video is no longer available because the YouTube account associated with this video has been terminated." – llogan Mar 12 '16 at 17:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.