Between Linux and Anime

Kind of like Schrodinger's Cat

Playing “V_MS/VFW/FOURCC”, “FLV4 / 0x34564C46” mkv files on Linux

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!


  • Facebook
  • Twitter
  • Identi.ca
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • RSS
  • Reddit

Previous

Angel Beats 11

Next

NUS SoC Linux guides now on the Document Repository!

5 Comments

  1. Paul

    Ran into the same problem. I didn’t want to deal with reencoding, though, and found this workaround: http://linux.derkeiler.com/Mailing-Lists/Fedora/2010-03/msg00311.html

    In short, get a copy of the codecs.conf file from the mplayer sources, and stick it in your ~/.mplayer directory. Find the section headed “videocodec ffvp6f” and change the line “fourcc VP6F” to “fourcc VP6F,FLV4”.

    It would be better to find a cleaner way to override just this one codec, as version will hang around after upgrades, possibly mucking other things up.

  2. WindPower

    That’s weird… If ffmpeg could convert it, how could ffplay not play it?

  3. Jason "moofang"

    @Paul: Thanks for the tip :) I found something similar but couldn’t find my codecs.conf file. Didn’t know I could just get one and stick it in ~/.mplayer.

    @WindPower: ffmpeg only successfully converts it if I explicitly tell it which decoder to use (hence -vcodec vp6f). ffplay doesn’t allow me to do so afaik, so it fails to play =/

  4. Confused

    Awesome! Helped me out – tried installing codecs.conf but that didn’t work. Thanks a lot!

  5. Jason "moofang"

    Glad I helped :)

Leave a Reply

Powered by WordPress & Theme by Anders Norén