1

I want to directly put 2 ffmpeg outut side by side in order to output a video that has both videos.

The recording ares

  1. a 640x480 webcam recording with:

    ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 webcam.mkv
    
  2. a desktop recording video of 1600x900 with

    ffmpeg -f x11grab -r 100 -s 1600x900 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 3 desktop.mkv
    
                  ---------------
                  |             |
       |----------|   desktop   |
       |  webcam  |             |
       --------------------------
    
2
ffmpeg \
-f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 \
-f x11grab -framerate 100 -video_size 1600x900 -i :0.0 \
-filter_complex "[0:v]pad=iw:900:0:(oh-ih)/2[left];[left][1:v]hstack" \
output
  • Use -framerate instead of -r and -video_size instead of -s for x11grab.
  • The hstack filter will use the frame rate of the first input, so you may add the fps filter after the pad filter if desired.
  • -framerate 100 seems high and may not be sustainable.

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.