Converting FLAC audio to MP3 in an MKV video

Let’s say that you have somehow acquired a video in MKV format, where for no particularly good reason the creator has chosed to encode the audio as FLAC (we shall neglect for the moment their poor taste in embedded fonts for animated karaoke and special-effect subtitling).

If for device-compatibility reasons you would prefer a better-supported audio format like MP3, and you’d really rather not re-encode the video to MP4 with hardsubs, the simplest solution is to extract the FLAC audio with mkvextract (part of Mkvtoolnix), decode it to WAV with Flac, encode it to MP3 with Lame, and then reinsert it with mkvmerge.

You also have to figure out which audio track, if any, is FLAC-encoded, but mkvinfo will do that for you, in a relatively-sane format. I have of course automated the whole task with a small Perl script.

Finding a video player that can smoothly scrub forward and backward through an MKV video for screenshots is left as an exercise in frustration for the reader.