patternshellMinor
FFmpeg command line for showing two videos side by side
Viewed 0 times
showinglinesidetwoforffmpegvideoscommand
Problem
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.
Is there some better way, in particular:
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:
- Without using fake video input;
- More easily extendible, without inventing names for
[tmp];
- Maybe with automatic geometry calculation, without manual coordinates;
- Input video filenames should be more easily visible and together?
Solution
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(unfortunatelympvorvlcfails to provide seeking in this scenario)
- Audio is preserved
Code Snippets
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 -Context
StackExchange Code Review Q#117610, answer score: 7
Revisions (0)
No revisions yet.