playing hevc videos on old mplayer that doesn't support that format
Friday, 5 June 2020 01:32 amWoo 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!!!!
-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:
Then I add the -sub subtitle.srt option and I'm good.
Ta-da!!!!! :D
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
no subject
Date: 2020-06-05 09:43 am (UTC)Once again, I rage against the changing of formats.
Apologies for my late reply
Date: 2020-08-09 10:16 am (UTC)I too get annoyed at the unnecessary proliferation of different video formats, but I have to admit that h265 (hevc) is a genuine major step forward. Filesize is much reduced, while retaining excellent image quality. I don't know how they managed such a feat, but loathe as I am to take on yet another video format, I do now embrace this one.
But yes, many hardware players are an unavoidable casualty in this step of the march of progress. Maybe the firmware can be updated. Some companies let people download updates onto a flash drive that can enable machines to upgrade their capabilities.
Re: Apologies for my late reply
Date: 2020-08-09 12:24 pm (UTC)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.]