Gentoo Wiki ArchivesGentoo Wiki

MEncoder/DivX_compatible_MPEG4

This article is part of the Hardware series.
Laptops TV Tuner Cards Wireless Servers Storage Other Hardware Motherboards Related

Contents

Introduction

Since DivX has created a certification program, there are some DVD players that can play DivX movies.

This howto will cover the basics of creating media files that can be played on this hardware, using tools already available in portage.

MEncoder

DivX player-compatible movies can be created with MEncoder (see MPlayer to install), as long as you record them to MPEG4 using ffmpeg's libavcodec.

Here's a basic example of how to create a compatible DivX file:

mencoder movie.avi -o divx.avi -ovc lavc -oac mp3lame -ffourcc DX50

Those are the generic instructions. For a slightly more advanced setup that is known to work, here's another example:

mencoder filename.avi -o divx.avi -ovc lavc -oac mp3lame -ffourcc DX50 \
 -lavcopts mbd=0:vbitrate=1152 -lameopts vbr=2:aq=3:q=3 -vf harddup=1 -channels 2 -srate 32000 -ofps 29.97

There are a few configuration options that you should be sure to use, to make sure the files are compatible. One is the -ffourcc argument, which tells the player that this movie is a DivX 5.0 file (-ffourcc DIVX is sometimes more effective for older players).

Another is that you must use -ovc lavc. Using XviD instead of lavc doesn't seem to work too well.

Those basic settings should work well. Once you've created your AVIs, you can burn them to as a data CD project using K3B. Your hardware player should bring up a file browser menu when you put it in, and you'll select the movies from there.

Movies with this configuration were successfully tested and play wonderfully with perfect A/V sync on the Philips DVP-630 and Sony DVP-NS32

ffmpeg

Encoding anything with ffmpeg to mpeg4 and mp3 or pcm audio should work as well. See the man for examples.

http://ffmpeg.sourceforge.net/faq.html#SEC17

ffmpeg -i movie.avi -f avi -vcodec mpeg4 -acodec mp3 -vtag DX50 divx.avi

General Notes

No matter what program you use to create the DivX movies (transcode, ffmpeg, mencoder), it's probably a good rule of thumb to pass as few advanced options as possible so as not to throw something strange that the player can't handle.

For some reason, lavc works awesome with the Philips player, but encoding with XviD would make the whole thing skip badly. Using lavc to encode the audio instead of mp3lame should be fine as well. Creating the movie with uncompressed audio (PCM) should work very well too. Please post your experiences and what works and what doesn't.

My Pitfalls and Tips

I have spent almost a year (on and off) trying to get mencoder to encode successfully for my DVP630, and finally achieved it yesterday after finding some tips on the web. The key facts that I needed were that the player can only play movies with square pixel aspect ratios. i.e. The aspect ratio specified in the AVI file must match the resolution dimensions. Due to this, specifiying aspect rations during the encoding by using either 'autoaspect' (an lavc option) or -force-avi-aspect can make the movie unplayable if the aspect ratio of the source material doesn't match the ratio you are scaling to. As I have been trying to encode widescreen material to an anamorphic ratio, I fell foul of this. An example correct command line follows. This converted a 2.42:1 aspect movie (1280x528) to a cropped 16:9 anamorphic one (704x528). mencoder casmp3.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=4400:vhq=2:v4mv:mbd=2:vmax_b_frames=0:trell -vf crop=940:528:170:0,scale=704:528 -idx -ffourcc DX50 -o 16x9squarepixel.avi

I have also found that even when I produce a playable AVI, I seem unable to fast wind through it without the playback crashing. This means I have to stop and return to the beginning of the AVI (very annoying). I believe this is due to using b-frames (hence the setting of b-frames to zero in the above example).

Stuart. 17th March 2008.

Retrieved from "http://www.gentoo-wiki.info/MEncoder/DivX_compatible_MPEG4"

Last modified: Sun, 31 Aug 2008 18:34:00 +1000 Hits: 18,960

Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.