5
\$\begingroup\$

Here is command line for playing two videos side by side in sync in FFmpeg (ffplay). It can be useful for comaring videos, for example.

ffplay -v warning -f rawvideo -s 800x400 -i /dev/zero -vf 'movie=video1.mkv,scale=400x400 [mv2] ; movie=video2.mkv,scale=400x400 [mv1]; [in][mv1] overlay=0:0 [tmp]; [tmp][mv2] overlay=400:0'

Is there some better way, in particular:

  1. Without using fake video input;
  2. More easily extendible, without inventing names for [tmp];
  3. Maybe with automatic geometry calculation, without manual coordinates;
  4. Input video filenames should be more easily visible and together?
200_success
146k22 gold badges190 silver badges478 bronze badges
asked Jan 22, 2016 at 17:17
\$\endgroup\$
3
  • \$\begingroup\$ That's really cool! I have to admit I never considered doing that using ffplay. Would you consider using multiple instances of ffplay or vlc or mplayer and align the windows either manually or using -geometry? Or does it all have to be in one window? \$\endgroup\$ Commented Jan 22, 2016 at 21:03
  • \$\begingroup\$ It should pause and seek in sync. \$\endgroup\$ Commented Jan 23, 2016 at 3:00
  • 3
    \$\begingroup\$ This question is being discussed on Meta Code Review. \$\endgroup\$ Commented Mar 10, 2016 at 19:19

1 Answer 1

8
\$\begingroup\$

Partial result

ffmpeg -v warning -i video1.mkv -i video2.mkv -filter_complex '[0:v]scale=400:400,pad=800:400 [0:q]; [1:v]scale=400:400[1:q]; [0:q][1:q]overlay=400:0' -f nut -c:v rawvideo -c:a copy - | mplayer -noconsolecontrols -cache-min 1 -cache 1024000 -
  • Dummy video input removed
  • Filenames now separate command line aguments, not parts of a longer string
  • Still manual geometry
  • Still not automatically extendible to more videos
  • Preparing and playing video decoupled, now can use other player instead of mplayer (unfortunately mpv or vlc fails to provide seeking in this scenario)
  • Audio is preserved
answered Feb 9, 2016 at 16:51
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.