miriam_e: from my drawing MoonGirl (Default)
miriam_e ([personal profile] miriam_e) wrote2020-06-05 01:32 am

playing hevc videos on old mplayer that doesn't support that format

Woo hoo!!!! I just enjoyed a lovely bit of Linux magic. My favorite Linux is a bit old, but I have it working just how I like, with a lot of programs installed and a lot of things I've set up exactly how it suits me.

Unfortunately time moves on, and I was given some h265 (hevc) encoded videos recently. My favorite video player, mplayer, doesn't have a codec to play them though (at least, not this older version), so I've been converting them using ffmpeg into h264 format, which I can play. It takes about an hour to convert a video, and I end up having to store the video twice, once for each format.

Tonight an idea hit me. If I can get ffmpeg to decode the hevc video and pipe it out the standard output (stdout) to mplayer through its standard input (stdin) then maybe I can play videos directly. After experimenting for a while I found a way that actually works!!!!

ffmpeg -i "video.mkv" -f mpeg - | mplayer -cache 10240 -

-i tells ffmpeg to use the video file "video.mkv"
-f tells it to output mpeg format
- by itself tells it to output on stdout
| is the pipe character
-cache tells mplayer to use a cache (in this case a large one) to prevent seek problems
- by itself tells mplayer to take its input from stdin

Now I just need to work out how to get it to display subtitles as well. I'm so deaf these days I have to watch everything with subtitles.

Ah... I think I've just worked out how to show subtitles. Mplayer has an option that lets it take its subtitles from a separately named file. I'll give that a shot.

Yes! It works! Extracting the subtitles from the original file takes just a few seconds:

ffmpeg -i video.mkv subtitle.srt

Then I add the -sub subtitle.srt option and I'm good.

ffmpeg -i "video.mkv" -f mpeg - | mplayer -cache 10240 -sub subtitle.srt -

Ta-da!!!!! :D
greylock: (Default)

[personal profile] greylock 2020-06-05 09:43 am (UTC)(link)
Admittedly I've not updated VLC for a while (or linux, same reasons) but it also struggles to play h265 (hevc). And increasingly x264 files are broken in my Western Digital player.

Once again, I rage against the changing of formats.
greylock: (Default)

Re: Apologies for my late reply

[personal profile] greylock 2020-08-09 12:24 pm (UTC)(link)
No stress. DW is less the daily check-in that is used to be.

But yes, many hardware players are an unavoidable casualty in this step of the march of progress.

Amusing you posted this on a day Disney is rumoured to be ending* physical releases, in favour of its Disney+ service.

I've looked into a software upgrade, but it's old tech, and as I understand it the hardware lacks the capacity to decode the H.265 format. It is what it is, and there's still other formats.

[*I've seen a few different versions of the rumour, but I'm also old enough to remember the days when things went "into the vault" to create an artificial scarcity.]