4
\$\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?
\$\endgroup\$
  • \$\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\$ – Barry Carter Jan 22 '16 at 21:03
  • \$\begingroup\$ It should pause and seek in sync. \$\endgroup\$ – Vi. Jan 23 '16 at 3:00
  • 3
    \$\begingroup\$ This question is being discussed on Meta Code Review. \$\endgroup\$ – 200_success Mar 10 '16 at 19:19
5
\$\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
\$\endgroup\$

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.