Slow netbooks: How to convert H.264 HD movies to lower quality (but faster) DivX

What if you want to play a HD movie on a netbook? I tried it on my acer 532h, and it’s lagging; mplayer complains about the machine being too slow. The problem maybe isn’t the high quality per se, but the modern, more space-efficient algorithms (that will make files hopefully smaller, but are also slower to decode).

The most interesting way seems to be to let mplayer lower the quality on the fly. A slashdot user tells how to do it:

mplayer -autosync 30 -vfm ffmpeg \
  -lavdopts lowres=1:fast:skiploopfilter=all file

But here I’m getting a segfault. There is also a library called VDPAU, and mplayer can be compiled to use it; not sure if it will help.

Anyway, here is the script I’m using right now:

#!/bin/sh

[ "$#" -lt 2 ] && { echo "usage: $0 <input> <output>"; exit; }

rate=1600

mencoder-mt "$1" -o "$2" \
    -ovc lavc \
    -oac mp3lame \
    -vf scale=800:-3 \
    -lavcopts vcodec=mpeg4:vbitrate=${rate}

It converts the file (In my case, it’s was a mp4 file, the video being encoded with H.264, and the audio with AAC) to an old-fashioned DivX AVI, with mp3 audio. Not sure if it yeilds the best results, but I will try and see.

I was encoding the audio to ogg vorbis, but it was getting out of sync. The problem might be the AVI file format. But all other attempts with -oac lavc was out of sync too, so I’m avoiding it.

I tried to do -oac copy, but it was unsuccessful. It’s also possible to store uncompressed audio with -oac pcm, but then the file will be larger (it’s slightly faster to encode. maybe faster to decode too, not sure). If it’s still slow, try lowering the video bitrate.

More links: how to convert video files, mplayer docs (see chapters 10 and 11).

PS: Just to say, it works great 🙂 The decrease in size was smaller than I thought (I hoped a space gain of 50%, and got about 30%), but it nows runs fast! I might try another approach next time, because it was slow as hell to encode (about 10FPS).

Advertisements

About Elias

Some random geek
This entry was posted in Linux and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s