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
(Crossposted from
https://miriam-e.dreamwidth.org/334594.html at my Dreamwidth account. Number of comments there so far:
)