How to convert a messy mkv file for playback on a crappy PC. —

I recently made a post about my HTPC “Test” that I have hooked up to my 10 year old 54 inch Wide Screen Standard Definition TV 🙂 .. it’s all old school.. but I wanted to watch digital files on it.. as I hooked up the PC I built to the TV I noticed that many of the files I had would studder, artifact, and the sound would slip.. SOMTHING HAD TO BE DONE!

I had a few options:

Option #1 – Burn these files to DVD using DeVeDe (I use linux.. and this works well for me.)

Option #2 – Ignore it till I got a better HTPC.

Option #3 – Convert this media from MKV to somthing a little leaner.. and maybe scale it down a bit.

So Option#1 is like taking a step in the wrong direction.. in the end my goal is to have all my digital media on a SAN in my home, and not on DVD’s.. Physical Media is DEAD. I’ll put my Albums and DVD’s in a box.. I don’t really need to keep them around you know? Option #2 what am I a quitter? So Option #3 is the way to go.

To do this we need to learn a little about video files.. and what an MKV is, and if it’s too much for a slow PC what might be acceptable.

In the digital video world you have many different file types, and many different kinds of Video Compression methods I can’t possibly explain the differences between them, but some tax your system more than others, and alot of the time whn you come across Video that someone else has encoded, it’s h.264 which is a standard fit for HD, so often the Video is in HD quality.

MKV‘s are “Matroska” files, they are neat in the respect that they are a container format that will allow for multiple audio tracks, and multipe subtitle tracks, they also work well with Substation Alpha and SRT Subtitles (actually you can use just about any kind of subtitles even vobs) and these can include custom fonts.. it’s quite elaborate what you can do actually.

Your player sadly has to render this HD video.. high quality audio… and then overlay the subs with fonts in real time.. so.. whats a poor Pentium 4 gonna do? Nothing..:D it breaks..

I use Linux.. and to do this it requires the following: mencoder, mkxtoolnix, mplayer.

Step #1 I rename the files I’m going to convert to input.mkv.. and I made everything a shell script because I don’t wanna retype stuff..

at a command prompt I type:

mplayer input.mkv -ao pcm:fast:file=audio.wav -vc null -vo null

This converts the audio from the MKV to a WAV file called audio.wav, it plays the default track from the file, usually the 2nd track.

Step #2 I convert the video to an avi and shrink it’s variable bit size down some.

mencoder input.mkv \
-ffourcc divx \
-ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=3000 \
-audiofile audio.wav \
-oac mp3lame -lameopts vbr=3 \
-o output.avi

This encodes the Video to an LAVC /AVI and writes on the track as an MP3, the resulting file is called output.avi

You may rename output.avi whatever way you wish.. keep the mkv tho.. if your audio slips a little.. redo this and don’t touch the machine you are doing it on.. a laggy processor may make the audio skip a second.

File ‘input.mkv’: container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AC3)
Chapters: 6 entries
File ‘input.mkv’: container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AC3)
Chapters: 6 entries
File ‘input.mkv’: container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AC3)
Chapters: 6 entries

Categorised as: Geeking Out

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.