My favorite feature is "video-sync=display-resample". This gives you perfect frame pacing by synchronizing the video to vertical refresh and resampling the audio to match. If you set your refresh rate to an integer multiple of the frame rate, every frame will be shown for the exact same time. The audio resampling compensates for very small discrepancies between speeds by imperceptibly changing the audio speed. It's similar to the proprietary DirectShow filter "ReClock", but AFAIK ReClock does not dynamically adjust the speed to compensate for clock drift like MPV does, in which case you could theoretically still get imperfect frame pacing. (I haven't actually used ReClock so I could be mistaken here.)
Also great is MPV's support for arbitrary OpenGL shaders. This can include very complicated shaders, e.g. real-time neural network upscaling:
One of my least favorite features of VLC (tied with network stream interruptions killing the playback rather than reconnecting) is that VLC guesses your audio hardware's sampling rate itself (rather than using the hardware's self-reported rate), and resamples even audio-only files that match your hardware's self-reported rate. And every time you seek in a file, VLC's guess of the hardware sampling rate is thrown off, causing VLC to start pitch-shifting the sound just enough (usually just barely, but sometimes up to 1 semitone) for you to notice and start doubting your sanity, if the audio pitch actually changed or if you're hallucinating things. There's a long-running bug report at https://code.videolan.org/videolan/vlc/-/issues/14287.
I think PipeWire does something similar to synchronize multiple audio devices without a shared word clock, but I haven't tested how much its rate analyzer drifts when starting/stopping playback or in steady state.
> tied with network stream interruptions killing the playback rather than reconnecting
So I'm not alone in hating this! How come this was never fixed?
I didn't want to switch from MX Player (Android), which worked quite well, for ages, but finally gave up because with MX Player you have to go look for some codecs.zip every (major?) update. (must be related to the licenses)
On top of VLC not being able to reconnect to the source, it also doesn't show the title of the video. So every time the stream dies I have to remember which episode I was on.
Exactly the same thing happens with mpv if you shift the audio manually. I experienced that recently. After shifting, whenever I go forward or backward it gets out of sync + the performance decreases ( without the shift going forward or backwards is instant)
I have experienced this with IPTV on Kodi, but I've only ever noticed it on the BBC News countdown tune, sining a semitone up and down. AFAIK that's using ffmpeg
> Also great is MPV's support for arbitrary OpenGL shaders. This can include very complicated shaders, e.g. real-time neural network upscaling:
Holy shit, I had no idea about this (that mpv could load OpenGL shaders nor that there is shaders that do RT neural upscaling), literally blowing my mind.
When I first experienced it, it made me realize how terrible VLC is; VLC can't play back video at a consistent framerate, and this is particularly noticeable in panning scenes in videos, especially anime.
People talk about VLC like it's a poster-child of open source, but really, I just see a bloated, crash-prone program that doesn't even do its primary function particularly well or efficiently.
VideoLAN is responsible for a whole lot of open source code that benefits the entire video ecosystem, like x264/x265/dav1d. Even if you dislike VLC, I think this is underselling their contributions to the world.
Also, I find VLC is a safe recommendation for someone who just wants to casually play some video files. It's fairly user friendly, it runs on literally everything, and it supports most multimedia formats anyone could ever care about. I like and use MPV, but I use VLC on some Android TV devices because it's readily available and runs buttery smooth on crappy hardware.
This is probably a interference of a chosen output method and a system compositor behavior (or its recent changes). Compositor redirection broke synchronization for most old code, and available interoperation and bypass methods have been changing with time. This was the reason media players and games introduced new fullscreen modes. Players, including VLC, have been capable of stutter-less video output for decades, the problem is that there is usually more to show on screen than just the video, and the user wants other things to happen in parallel.
It's true that VLC requires arcane knowledge of its architecture to configure all of its options, but basic operation still assumes you've read the fine manual.
Computer monitors are not all 60hz, and I cited anime as one example; TV and movies also have jerky playback.
VLC does the behavior described (jerky playback) on both a Mac with 60hz display that is several years old, and on a cutting edge PC that has a refresh rate more than five times the framerate of anime and supports variable refresh rate.
mpv plays anime butter-smooth on both systems.
I love it when I get a supremely condescending explanation that is also wrong.
> Computer monitors are not all 60hz, and I cited anime as one example; TV and movies also have jerky playback.
The ones that are 60hz are 60hz, and that's not the reason monitors aren't TVs. They aren't TVs because they don't have one of 1. black frame insertion 2. 60->120fps motion interpolation, so you have persistence of vision issues. (aka motion blur, jerkiness, or both at once)
Movies are also 24fps, though of course they're different from animation because they have built in motion blur (same as if you recorded with 1/24 exposure time vs 1/1000).
mpv's video retiming works some of the time, but means it changes the pitch of audio which is sometimes unacceptable, same as old NTSC->PAL transfers.
…if your monitor has variable refresh rate why are you using retiming?
>They aren't TVs because they don't have one of 1. black frame insertion 2. 60->120fps motion interpolation
Most older LCD TVs do not have either black frame insertion or motion interpolation. BFI causes motion artifacts (trailing ghost images) if the frame rate of the video is less than the refresh rate. Motion interpolation also adds its own artifacts.
>mpv's video retiming works some of the time, but means it changes the pitch of audio
The best way to use it is to set custom monitor timings (e.g. with xrandr) so that the adjustment needed is too small to detect. There are various scripts to automate this, although I haven't personally tried any (I just change mode manually).
>if your monitor has variable refresh rate why are you using retiming?
I have a VRR monitor, but I still use retiming because it only has a 6 bit panel, and VRR makes temporal dithering artifacts ("frame rate control") visible.
Yeah, those LCD panels aren't actually good enough to be TVs. A lot of them were 60hz as well, or at best 120hz with HDMI 2.0 which didn't support VRR so your playback device probably wouldn't send them 24fps.
Amazing! I tried it with a 360p video and scaling the player window to 1080p and it's looking sharp. The original looks blurry when you scale the window to 1080p.
You can force it to do that if you really want to, but by default it will speed it up to 24.00fps and play it alternating between 2 and 3 screen refreshes for each frame (i.e. 3:2 pulldown without the interlacing).
Is there any way to make it work with adaptive refresh to play the video at exactly its native speed and adjust the display refresh rate instead? Or should that just work automatically?
VRR support for MPV is disabled by default in /usr/share/drirc.d/00-mesa-defaults.conf. I am not sure why, because it works for me if enabled. Just fullscreen MPV and it will change the display refresh rate. This requires VRR enabled in both Xorg and your monitor's settings. I have not tried this with Wayland.
No, I forget what the exact limit is, but it does change the speed more than ~0.5%. So going from 59.97 to 60 or vice versa, but not 24 to 30 or 50 to 60.
But Yeah, I am in LOVE with this feature, even for 30fps footage on a 60fps screen. The more stable frame times make a huge difference.
Shouldn't display adaptive sync work better for syncing to video framerate though? Trying to resample the video to display refresh rate instead sounds like a worse approach.
If VRR works well with your hardware then it is probably a better option. You can edit /usr/share/drirc.d/00-mesa-defaults.conf to enable VRR with MPV.
I have a freesync 165hz display. What is the best mpv setting? In theory it should be possible to perfectly show video on my monitor without any stretching or pacing problems.
Unfortunately this is not quite the same thing, It just plays around with how the existing frames are displayed instead of generating new ones based on the motion vectors in video files.
How much does it have to adjust playback speed to get frames to an even multiple of refresh rate? Like 2%, or 20? This feature isn't for me -- I'm a big fan of the +/- 10% playback speed '['/']' buttons -- but it sounds neat.
> All in all, I believe this proves that software developers as a whole and as a culture produce worse results than drug addicted butt fucked monkeys randomly hacking on typewriters while inhaling the fumes of a radioactive dumpster fire fueled by chinese platsic toys for children and Elton John/Justin Bieber crossover CDs for all eternity.
This the final paragraph after the author wrote a novel in the git commit message.
"To justify this emotional outbreak potentially insulting
to unknown persons, I will write a lot of text. Those not comfortable
with toxic language should pretend this is a religious text."
"Interesting" is certainly one way to put "author displaying blatant homophobic attitudes."
Edit: referencing anal sex and two musicians, one of whom is effeminate and the other gay(and famously popular among gay people), all as insults. The author is a mix of misogynistic and homophobic.
I think the reference to Elton John and Bieber is more a dig at the quality of Bieber's music, not anyone's (actual or perceived)sexual orientation, and that it's inclusion on the same CD is tainting Elton John's legacy.
So if anything he respects and likes the famously gay person, so wouldn't characterize that as homophobic.
Won't speak to the anal sex reference because I haven't read the whole thing yet.
> referencing anal sex and two musicians, one of whom is effeminate and the other gay(and famously popular among gay people), all as insults.
It sounds like you believe that only gay people have anal sex, and that only gay people enjoy the music of Elton John and Justin Beiber, is that correct?
Maybe not everyone's mind goes where yours seems to. In particular your analysis depends heavily on Bieber being effeminate, which is not an adjective I'd associate with him. Maybe this guy's just making fun of their music? Or are gay musicians exempt from all mockery now?
I use this in combination with https://addons.mozilla.org/en-US/firefox/addon/send-to-mpv-p... as my pimary way to play video content on the web. It's nice having everything play in a consistent player with consistent controls as well as tons of useful features.
Or if you want to play something without video at all for e.g. music livestreams, that can be done too. Example below uses the famous lofi girl stream.
Maybe that behavior is Linux-exclusive? Under macOS and Windows, if I only use --ytdl-format='bestaudio/best' with livestreams mpv will spawn a window with the video.
I'm on Windows as well. Just get rid of the 'best' argument for '--ytdl-format'. Also, 'bestaudio' is mostly only known as a keyword for Youtube videos.
It can also use SDL or DRM to render video on the console. I use this for viewing video and images (even pdfs, with imagemagick) without a graphical environment.
Shove that into ~/.config/mpv/mpv.conf (each parameter on its own line and without the dash prefix) if you don't want to repeat yourself over and over again.
For some reason hwdec doesn't seem to make much difference for me in terms of power or CPU usage. Also worth mentioning is profile=gpu-hq (can just uncomment in the example config).
I recommend this for watching lectures & other long videos. Compared to the web player mpv gives finer control of playback speed and seeking forwards and backwards.
Really great for studying other languages too. Can quickly go back and relisten to the same section over and over and over again without an ad popping in midway through a listen.
Writing scripts for mpv is really fun. I would recommend it for anyone especially for people who are learning programming. There is a lot of room for innovation and creativity. The development feedback loop is quick, interactive and visual.
For anyone already acquainted with emmylua/vscode-lua I'd recommend using my type declarations for mpv—need to push some commits for recent changes but it's completely functional
LUA is essentially build as a plugin language. It's simple and well behaved, very easy to spawn when you need it and throw it away when you are done with it. It can also be isolated, if you don't want to give people access to file-io functions for example, you just don't load them into the interpreter and everything works as expected.
Most other language are not like that, they rely on global state and want to take full control your program. The interpreter also tends to be full of functions you can't get rid of, so they are impossible to secure. Even simple things like spawning two independent interpreters are often not supported. A language like Python really wants you to extend Python with modules, not extend your program with Python.
As an example, the MMORPG "Elder Scrolls Online" [1], uses Lua as the interface and plugin ("addons") language. This allows feature-rich, very useful UI modifications such as "Bandits User Interface" [2]
Lua is so similar to Python that you could learn the basics in one afternoon since you already know Python. The official book is a great start: https://www.lua.org/pil/1.html
It is very easy to embed to C/C++ codebase, much faster than almost any other scripting languages (luajit) and adds a minimal amount to the binary size.
My favourite feature of mpv is small but neat: going frame-by-frame forwards and backwards with the keys "." and ",". VLC can step forwards, but not backwards, which frustrated me a fair bit, because I like first stepping really fast forwards to go into the general vicinity of the frame I wanted to catch, necessarily overshooting the target a bit and then backing off a bit and narrowing down the frame with greater precision. VLC didn't allow me to do that, overshooting meant I needed to do the whole thing all over again; but mpv got me covered.
And worse yet, on VLC, often after single-stepping enough times, the video player or decoder stops advancing on pressing e. Resuming playback will either take a while to start playing or stop the file altogether.
One of my favorite things about Mpv is that it's basically a clear cut example on how to use the FFmpeg api. It's written in a way that's fairly straightforward to follow, and was rather instrumental in me understanding the hardware acceleration API of FFmpeg.
Yes, that's true. I even contributed one feature to mpv. It was easy to port some features regarding VAAPI post processing - extra deinterlace modes and correctly handling bottom field first videos that Kodi had, but mpv didn't at the time.
I was surprised to learn that mpv doesn't support the Raspberry Pi, and the maintainers don't seem interested in supporting it[0] even though VLC works fine.
MPV is great for setting upscaling filters like Anime4k or Nvidia Image Scaling. All you have to do is add a glsl file to the shaders folder and voilà, you get a crisp, clean image on the other side. I often watch 1080p to upscaled 4k shows and anime through this method.
It's the go-to player for watching a video with two subtitles, quite essential if you happen to watch a movie with someone and both need different subs.
I really like mpv and use it on my laptop, but I thought the package in the raspberry pi os repo didn't support acceleration? Which is why I've been using vlc for videos (e.g. hevc 4k videos).
don't forget to enable hardware accelerated decoding.
i found it to be off by default in many installations.
press "i" during playback to see if it's being utilized. or simply compare CPU usage before and after (should be drastic). also radeontop and intel_gpu_top will help in debugging / getting it working.
I disabled hardware acceleration, it was on by default. I think seeking is faster with it off and I believe there was another advantage, which I don't remember now. I find that CPU usage is negligible, but YMMV.
On older hardware it makes a huge difference. Also very useful if you are on a battery, in my experience it can be the difference between 2 hours or 6 hours of battery life. I think it's off by default because hardware acceleration sometimes introduces visual artifacts but these are so minor I would prefer the extra 4 hours of battery life and not giving a hot laptop. YMMV and indeed it may not be noticeable on newer hardware and maybe not an issue if there are no batteries.
If you use elfeed its nice to watch video entries in mpv without a side trip to the browser. Stolen from Prot somewhere or other.
(defun prot/elfeed-mpv-dwim ()
"Play entry link with external `mpv' program.
When there is an audio enclosure (podcast), play just the audio.
Else spawn a video player at a resolution that accounts for the
current monitor's width."
(interactive)
(let\* ((entry (if (eq major-mode 'elfeed-show-mode)
elfeed-show-entry
(elfeed-search-selected :ignore-region)))
(link (elfeed-entry-link entry))
(enclosure (elt (car (elfeed-entry-enclosures entry)) 0)) ; fragile?
(audio "")
;; Here the display width checks if I am on the laptop
(height (if (<= (display-pixel-width ) 1366) 720 1080))
(video (format "--ytdl-format=bestvideo[height<=?%s]+bestaudio/best" height))
;; (buf (pop-to-buffer "*elfeed-mpv-output*"))
)
(run-hooks 'prot/elfeed-mpv-hook)
(if enclosure ; make this its own parametrised function
(progn
(start-process "f fuckoff audio-mpv" nil "mpv" enclosure)
(message (concat "Launching MPV for " (propertize enclosure 'face 'success))))
(start-process "f fuckoff video-mpv" nil "mpv" video link)
(message (concat "Launching MPV for " (propertize link 'face 'success))))))
At one point I wrote script to prompt for a name if passed more than one argument and create a playlist and remember the last n playlists and regular files opened so you could in turn pull up this list and narrow with rofi but as of late I'm just adding videos to jellyfin.
Umpv is a script that emulates single instance mode whereby arguments are simply pushed to the existing players playlist instead of opening a new player.
I have never understood why this player doesn't have a GUI where settings can be adjusted. It only has a bare-bones window. Command-line has it's place, but I don't think poring over man pages to find the command-line switch to change an algo or whatever is called for is the correct interface for a video player.
A video player is an interface for the human. Command-lines are better for things that need to interface with a computer.
There are plenty of wrappers for it that are even older than it (because they were once for mplayer/mplayer2.)
If you're confused that the programmers of media playing and manipulating software aren't interested in GUIs that plenty of other people have volunteered to write, I don't know what to tell you.
My favorite (really the only one I've used for many years) is smplayer. It gets everything about GUI right that VLC gets horribly wrong. Notably, its developers only work on a GUI, and don't develop mpv. It's cross-platform, too.
> I have never understood why this player doesn't have a GUI where settings can be adjusted.
I'll start by saying that `mpv` is likely not for you.
Personally, I see little value in such complex GUI. 99% of the times I double click on a video and I want it to play. I don't need a fancy wizard to customise any settings.
I just have tiny config file I created in 2016 and it still works today -- and the fact that it's a text file means it's just been part of my dotfiles all this time and carries over onto new systems.
I never invoke mpv from my command line shell, I invoke it through my file managers (Dolphin or dired). I configure mpv using my text editor to edit the configuration file at ~/.config/mpv/mpv.conf. If I want to make on-the-fly changes I use my mouse and keyboard to invoke key bindings. If I don't have a keybinding set for whatever I want to change and don't want to edit my config for it, then I can use the built-in REPL to change it (but I very rarely have a reason to do this.)
> correct interface for a video player.
That 'correctness' is subjective. It isn't correct for you, but it is for me.
Text is the universal interface. It can be easily be output and input by both people and computers.
That said, there are plenty of video players with very robust GUIs. What's wrong with having one that is focused on people who want to use the command line?
> I have never understood why this player doesn't have a GUI where settings can be adjusted.
I'm not into MPV, but as a MPlayer (http://www.mplayerhq.hu) user, I perfectly understand your point, however there's a reason some software still uses TUIs. Video players are different beasts compared to other apps; very often you end up changing one or more settings in a per video basis, which makes the text interface a lot more useable than having to look for that control to tweak among hundreds. Also, external interfaces can be added almost trivially; Mpv itself is embedded in a lot of GUI software without the user even noticing.
When I first started using MPlayer (ages ago, had to compile it every time, codecs back then had to be "imported" from Windows, etc.) I also thought the text interface was clumsy and old looking, then I familiarized with it, used it on a daily basis to transcode videos using the MEncoder companion encoding software, and after some time MPlayer became, and still is, my favorite video player under Linux.
> A video player is an interface for the human. Command-lines are better for things that need to interface with a computer.
I have memories of assistants learning Wordstar key sequences faster than many current geeks learn vi ones. It's wonderful how sometimes humans can adapt.
Just to clarify: I love well made GUIs; it's just that sometimes they're less necessary than we think.
I think the man page for MPV is a little too detailed. Sometimes all you need is a list of flags and a brief description of what they do - but some documentation (looking at you rsync and mpv) is designed to teach you mastery over the tool - which is a little overkill most of the time.
The detailed manpage is great. The more details the manpage has for each flag, the easier it is for me to find the flag I'm looking for by searching for related terms. Longer descriptions means a greater chance of my related search term hitting a relevant result.
Common flags and short descriptions of them can be found with `mpv --help` or `tldr mpv`
rsync is another example of a manpage I love. Very detailed means very useful. With a detailed manpage, I don't have to waste my time figuring out where the real manual is.
I share your sentiment. People make GUIs for MPV but I'd rather just use a media player designed for GUI users out of the box. Got nothing against ffmpeg, wonderful tool, just some things I think need a proper GUI.
I'm sorry if this is obvious, but did you double-check your mpv was built with Sixel support? `mpv --vo=help` will list the video outputs your build of mpv supports; sixel should be listed there if your mpv was built with it, but I suspect most distros package mpv without sixel support.
A problem I had with MPV was that turning it up past 100% had very obvious distortion whereas VLC didn't have this when at the same volume so unfortunately, I am stuck with VLC on Linux unless I figure out whats wrong.
I've been using mpv for the last couple of years as my main media player simply because it was the best one I could find that supports ReShade, because I'm a weirdo who likes fuzzy CRT shaders on my 90s television rips (and other things too)
It loads much faster than VLC and it also seems faster in general. The GUI is very minimalistic and you can leave only the video itself (with the 'no-border' setting). It has a bunch of nice little features/settings, but it requires some exploration and changing config files...
I switched from VLC to mpv some years ago and never looked back. It's just better for opening random video/audio files, IMO.
For one thing, VLC on macOS has become so unreliable it's more or less unusable. Randomly won't play valid video streams, slow or completely broken seeking, and even intermittently crashes.
I switched to IINA and haven't looked back, it's incredibly good for most cases. Unfortunate that it's Mac-only software; not a multi-platform capable solution.
mpv has better support for playing videos from the web. You can paste a youtube link into vlc's "Open Network Stream..." dialogue, but because VLC doesn't use yt-dlp for this it often doesn't work at all (it presently doesn't work for me) and works with fewer websites than mpv.
Also mpv's json IPC interface is easier to use with better documentation than any of VLC's numerous remote control protocols (which aren't mentioned in the manpage, and have incomplete hand-wavy documentation spread across numerous poorly organized wiki pages.)
I have the impression that the “Ten Thousand” [1] effect has increased quite significantly in the last couple of months.
I have seen multiple submissions from different users pointing to homepages of software that is already very popular. I guess this is a sign that the current most active Hacker News users are also in the youngest age group, which makes all these programs look new.
Just the other day someone posted about the Vala programming language [2].
SpaceVIm [3], although, this was mostly a 2.0 release announcement.
I wonder if Hacker News administrators have considered creating a separate page for these submissions to keep the front page clean. Basically, put previously-submitted links into a “revival” page, and novelty links in the “new” page.
It's the reddit effect. As reddit's popularity keep increasing for the past 5 years or so, HN links posted on the platform get that much more attention. Specially true for indians, pakistanis and chinese.
mpv also does fine as a simple image viewer. Bind image mime types to /usr/bin/mpv, and you're golden. If you want a slideshow, run `mpv /path/to/image/dir`.
I prefer feh normally but I did for some reason prefer it for viewing the hourly weather (US specific but maybe similar is available elsewhere). I bind a key to
followed by the weather.gov url (the image link there with selected options goes to the current. I also have a kitty +kitten icat alias for viewing in the terminal, although for hourly weather I usually use mpv. Also small radar images that are available (0 = latest 9 = oldest, radar names shown on main radar.weather.gov page next to the circled checkmark):
Those I look at via icat since I'll keep them around to see how things are moving if I don't head out right away. For longer term weather there is a text forcast:
I'm glad that Plex is using mpv these days. Makes it a lot nicer to use on my Apple TV, since you can basically throw anything at it without the need for transcoding.
Makes sense to me. Software for common people, but not for corporations or people with an abnormal legal paranoia. WTFPL is probably also good for this, lawyers seem to hate it but normal people are free to use it without worry.
Imagine the motivation somebody might have for releasing their software under a noncommercial freeware license. AGPLv3 is not a noncommercial freeware license but it de facto filters big tech corps as a noncommercial license might, with the added bonus of allowing the use of any GPLv2-or-later code. Best of both worlds.
Also great is MPV's support for arbitrary OpenGL shaders. This can include very complicated shaders, e.g. real-time neural network upscaling:
https://github.com/igv/FSRCNN-TensorFlow/releases
SD video can look surprisingly good after upscaling with this.