Welcome to yet another episode of “Refusing to Just Use Windows (TM)” !
Yes that’s right. Despite the general ease with which most mkv’s play on Linux systems, I discovered a couple of mkv’s just the other day that simply wouldn’t – not on VLC, mplayer, ffplay, kaffeine – nothing. Even with every last available codec pack (and their grannies) installed. Well, the audio plays well enough – but I get no video. Blank. Zip. On the other hand I was told that the files play on a properly set up Windows machine. So what else is new :)
Of course, the thing about mkv’s is that it’s a wrapper format – different mkv’s can hold video/audio/subtitles that require vastly different codecs, so being able to play one mkv doesn’t guarantee that you’ll be able play the next. This case is a classic example of that little principle. So next step would be to find out what is the internal video format being used. Some probing with ffmpeg and mplayer on the command line reveals that the video’s codec id is “V_MS/VFW/FOURCC
“, and is actually an flv4, which should be decodable on Linux. However playing the file results in one form of complaint or another in the way of “V_MS/VFW/FOURCC
” not being recognized as a codec. The result: No video – only the audio track plays.
To cut a long story short, after clamping my teeth down on it and doing my requisite googling (yes, Refusing to Just Use Windows), I put the clues together and managed to find a not-too-difficult way to the bottom of the issue. The idea is to manually specify/force the video decoder to use, since the players are incapable of automatically finding the right one. None of my players appear to allow me to do this though, so I used ffmpeg to decode and reencode it into a nicer format instead:
ffmpeg -vcodec vp6f -i inputFile.mkv -b 20000k output.avi
The -vcodec vp6f part is the important bit here of course. This should decode that pesky mkv and spit out a much friendlier avi file that should easily play on mplayer, vlc or the like.
If your mkv has subtitles, you’ll need to do some extra stuff, since ffmpeg to the best of my knowledge does not play nice with subs. The above step should get you an avi with video and audio. To also add subs, you first need to extract them from the mkv. One way to do this is using mkvextract, which you should be able to install in your system by installing the “mkvtoolnix” package. mkvextract lets you extract a track from your mkv. The subtitle track is usually track 3, so you’d do something like:
mkvextract tracks file.mkv 3:output.subs
You can check which track your subtitles are on by doing ffprobe file.mkv. Once you have the subs extracted, you can simply direct your player to the extracted subtitles file and it should display. If you name your subtitles file after your avi file, some players would even automatically load it. All I needed to do was:
mplayer output.avi -ass
Of course, if you feel like it, you can also burn the subtitles into the video file itself. You can use mencoder for that, or you can use avidemux following instructions here
Hope that helps someone ;)
822
Rate this post
Thanks!
An error occurred!
Recent Comments
SMB Business Solution
"At SMB Business Solution, we offer Salesforce customization services to tailor your platform ..."
Marc Wayne Schechtel
"Das ist eine super hilfreiche Anleitung! Vielen Dank, dass du die Schritte so ..."
Hochzeitsplaner
"Great Article. Thanks "