Posted: . At: 11:10 AM. This was 2 years ago. Post ID: 12196
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.


Linux MPV tips and tricks for playing files on your Linux box.


The MPV media player is a great application for playing movies on a Linux machine.

To change the aspect ratio of a file, while it is playing, press Shift-A. This is the default keybinding hardcoded in the binary.

You may watch a Youtube video using MPV and select the vertical resolution of the video using this one-liner.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Videos]
└─$ mpv --ytdl-format="bestvideo[ext=mp4][height<=?360]+bestaudio[ext=m4a]" https://www.youtube.com/watch?v=EBfHw0WD1_c

This is a very useful MPV Youtube trick.

Download an entire Youtube playlist as MP3 files using this long command example.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Youtube2]
└─$ youtube-dl -x --audio-format "mp3" --embed-thumbnail --yes-playlist --output "%(title)s.%(ext)s" -i PLyPYOzurbMk7hXJEJPlMeRySoPyC-63-0

This embeds the Youtube thumbnail as the album art as well. Plus sets the ID3 tags. A very useful example indeed.

The MPV player can be used to rip part of a video to a WebM file for sharing online.

http://securitronlinux.com/debian-testing/how-to-encode-a-section-of-a-movie-to-a-webm-file-with-mpv/.

Play movies from your collection randomly.

http://securitronlinux.com/debian-testing/how-to-shuffle-play-a-directory-full-of-movies-with-mpv-on-linux/.

Play Youtube videos with the MPV media player.

http://securitronlinux.com/bejiitaswrath/watch-youtube-videos-with-the-mpv-movie-player-this-is-a-very-simple-process/.

This is the default /etc/input.conf https://raw.githubusercontent.com/mpv-player/mpv/master/etc/input.conf.

DVB-T broadcasts may also be watched with MPV. Place channels.conf file in the ~/.config/mpv/channels.conf file and then it will work.

jason@Yog-Sothoth » ~ » $ mpv dvb://"SBS ONE HD(SBS)"
Playing: dvb://SBS ONE HD(SBS)
[dvbin] dvb_tune DVB-T Freq: 613500000
 (+) Video --vid=1 (h264 1920x1080 25.000fps)
 (+) Audio --aid=1 (mp2 2ch 48000Hz)
File tags:
 Title: SBS ONE HD(SBS)
AO: [pulse] 48000Hz stereo 2ch s16
[ffmpeg/video] h264: co located POCs unavailable
[ffmpeg/video] h264: co located POCs unavailable
[ffmpeg/video] h264: co located POCs unavailable
[ffmpeg/video] h264: mmco: unref short failure
[ffmpeg/video] h264: mmco: unref short failure
VO: [opengl] 1920x1080 yuv420p
AV: 00:00:06 / 00:00:00 A-V:  0.000 Cache:  4s+0KB

That is how easy MPV is to use.

A very useful addon script to convert or crop videos from within MPV.

https://gist.github.com/Zehkul/25ea7ae77b30af959be0.

Play a video with MPV audio-only.

jason@Yog-Sothoth » Videos » $ mpv --vid no stalkersoc.avi 
Playing: stalkersoc.avi
     Video --vid=1 (mjpeg 1920x1080 30.000fps)
 (+) Audio --aid=1 (pcm_s16le 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch s16
A: 00:00:21 / 00:01:19 (27%)

These tips should be very useful to a new or experienced mplayer user who is transitioning to mpv as their main media player.


Leave a Comment

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