Posted: . At: 7:24 PM. This was 4 years ago. Post ID: 14419
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to play 3 videos at once with mpv on Linux.


There is a very nice trick you can do with MPV on Linux. This is playing 3 videos at once.

Playing 3 videos at once with mpv on Linux.
Playing 3 videos at once with mpv on Linux.

In the above image, I am playing 3 videos at once with mpv on Linux. This is very easy to do and a lot of fun.

This is how to do it. Have one initial file selected and then use another 2 files to make 3.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
4.4 Sun Jun 21 jason@Yog-Sothoth 1: $ mpv --lavfi-complex="[vid1][vid2][vid3]hstack=inputs=3[vo];[aid1][aid2][aid3]amix=inputs=3[ao]" vid1.mkv --external-files='vid2.mkv:vid3.mkv'
Playing: vid1.mkv
VO does not support requested hardware decoder, or loading it failed.
VO does not support requested hardware decoder, or loading it failed.
VO does not support requested hardware decoder, or loading it failed.
 (+) Video --vid=1 (*) 'Encoded with IFME v4.9.4.0' (hevc 704x396 23.976fps)
 (+) Video --vid=2 (*) 'vid2.mkv' (hevc 704x396 23.976fps) (external)
 (+) Video --vid=3 (*) 'vid3.mkv' (hevc 704x396 23.976fps) (external)
 (+) Audio --aid=1 (*) 'Track 1' (aac 2ch 48000Hz)
 (+) Audio --aid=2 'Track 2' (aac 2ch 48000Hz)
 (+) Audio --aid=3 'Track 3' (aac 2ch 48000Hz)
     Audio --aid=4 (*) 'vid2.mkv' (aac 2ch 48000Hz) (external)
     Audio --aid=5 'vid2.mkv' (aac 2ch 48000Hz) (external)
     Audio --aid=6 'vid2.mkv' (aac 2ch 48000Hz) (external)
     Audio --aid=7 (*) 'vid3.mkv' (aac 2ch 48000Hz) (external)
     Audio --aid=8 'vid3.mkv' (aac 2ch 48000Hz) (external)
     Audio --aid=9 'vid3.mkv' (aac 2ch 48000Hz) (external)
 (+) Subs  --sid=1 --slang=eng (*) (ass)
     Subs  --sid=2 --slang=eng (*) 'vid2.mkv' (ass) (external)
     Subs  --sid=3 --slang=eng (*) 'vid3.mkv' (ass) (external)
VO: [opengl] 2112x396 => 2112x396 yuv420p
AO: [pulse] 48000Hz stereo 2ch float
AV: 00:09:52 / 00:24:11 (40%) A-V:  0.000

This plays the audio from all 3 files and mixes it all together. This could be very useful for comparing different videos.

This example plays 6 videos in a vertical stack.

4.4 Sun Jun 21 jason@Yog-Sothoth 1: $ mpv --lavfi-complex="[vid1][vid2][vid3][vid4][vid5][vid6]vstack=inputs=6[vo];[aid1][aid2][aid3][aid4][aid5][aid6]amix=inputs=6[ao]" vid1.mkv --external-files='vid2.mkv:vid3.mkv:vid4.mkv:vid5.mkv:vid6.mkv'

This is what it looks like. This is nice. I wish I could have a stack of 3 and then beside that another stack of 3 videos. But I cannot work out how to do that. Maybe you could have 12 videos playing at once.

Playing 6 videos at once in a vertical stack.
Playing 6 videos at once in a vertical stack.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.