Answers.Body: <p>If you're using filter_complex, then all filtering has to happen within that complex. So,</p>
  
  <pre><code>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
  </code></pre>
  
  <p>This stacks the top half of the webcam video below the top half of the desktop capture.</p>
  
  <hr>
  
  <p>Having taken a look at the console output, you should actually try this:</p>
  
  <pre><code>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
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-11T14:27:33.240Z
Answers.Text: You are my hero. Thank you so much. I made a video. http://youtu.be/iaoKalspcI0  I forgot that I neglected audio, so that post has no sound. Let me work on that next step now ...
Answers.UserDisplayName: user14047
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-11T14:51:39.267Z
Answers.Text: 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
Answers.UserDisplayName: user14047
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-11T12:56:41.647Z
Answers.LastActivityDate: 2016-03-11T12:56:41.647Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>I made another video and posted it to YouTube.
  <div class="youtube-embed"><div>
                  <iframe width="640px" height="395px" src="https://www.youtube.com/embed/GEujSuJjXbc?start=0"></iframe>
              </div></div></p>
  
  <p>I used the following command : </p>
  
  <pre><code>  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))
  </code></pre>
  
  <p>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.</p>
  
  <p>I suppose there is a more complex solution to this.</p>
  
  <h2>I tried tying (chaining) the :"audio=" to  both of the video input source/streams</h2>
  
  <p>that is , I tried both logical possibilities (variations) : </p>
  
  <p><code>video="Microsoft LifeCam HD-6000":</code></p>
  
  <p>and</p>
  
  <p><code>video="screen-capture-recorder":</code></p>
  
  <p>Same issue. In fact, the latency doesn't exchange between the different video streams.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-11T16:28:06.303Z
Answers.Text: Try putting `-use_wallclock_as_timestamps 1` before each `-i`
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-12T17:35:19.597Z
Answers.Text: "This video is no longer available because the YouTube account associated with this video has been terminated."
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-11T15:28:42.177Z
Answers.LastActivityDate: 2016-03-11T15:28:42.177Z
Answers.UserDisplayName: user14047
Body: <p>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. </p>
  
  <p>My screen resolution is set to 1280 by 720 pixels. </p>
  
  <p>I have a webcam that is set to provide video at that same resolution. </p>
  
  <p>I want the top half of the webcam's input/feed/stream to be layered on top of the 
  <em>bottom</em> half of the screen-capture-recorder (recording my desktop).</p>
  
  <p>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.</p>
  
  <p>This should be simple.</p>
  
  <p>I'll paste a few of the commands that I've tried and that have failed to work.</p>
  
  <p>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</p>
  
  <p>and</p>
  
  <p>I even tried adding : 
  "[0:v][1:v]vstack[v]" -map "[v]"
  to that , above (previous) command.</p>
  
  <p>See my Google Doc for complete output (what was in my cmd.exe window) :</p>
  
  <p><a href="https://docs.google.com/document/d/1SqtjEY_gM3rdeKPyRzUq_jJhPQUPCK5L4E5HPttwS3s/edit?usp=sharing" rel="nofollow">https://docs.google.com/document/d/1SqtjEY_gM3rdeKPyRzUq_jJhPQUPCK5L4E5HPttwS3s/edit?usp=sharing</a></p>
  
Tags: <ffmpeg>
Title: ffmpeg split screen two video sources
UserDisplayName: user14047
ThreadText: # ffmpeg split screen two video sources
  
  (Asked by: username_0 on 2016-03-11)
  
  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>
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-03-11. Score: 1 | Accepted answer
  
  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
  
  ```
  
  > **Comments:**
  > **username_0**: You are my hero. Thank you so much. I made a video. http://youtu.be/iaoKalspcI0  I forgot that I neglected audio, so that post has no sound. Let me work on that next step now ...  
  > **username_0**: 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  
  
  ---
  
  ### Answer by username_0 on 2016-03-11. Score: 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.
  
  > **Comments:**
  > **username_1**: Try putting `-use_wallclock_as_timestamps 1` before each `-i`  
  > **username_2**: "This video is no longer available because the YouTube account associated with this video has been terminated."  
  
  ---
  
  