How to encode XviD using ffmpeg for Home Theater/DVD Player?

10,859

Solution 1

FFmpeg wiki has a page about this: MPEG-4 Encoding Guide.

Long story short: ffmpeg -i input.avi -c:v mpeg4 -vtag xvid output.avi

There are, of course, different support levels on different devices. The email exchange about a very limited device Need code to convert MP4 to DivX AVI seems to point at a lower level standard (use it if you can't test the device beforehand):

ffmpeg -i input.mkv -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v libxvid \
    -crf 24 -vtag DIVX -vf scale=640:480 -aspect 4:3 -mbd rd -flags +mv4+aic \
    -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k output.avi

Solution 2

Personally I use these options:

ffmpeg -i INPUT_FILE -c:v libxvid -q:v 5 -q:a 5 OUTPUT_FILE.avi

The point that I would like to stress is that the option -q:v 5 is crucial. This option sets the quality of the video (1 = best, 31 = worse). When this option is omitted, I got a compatible file of poor quality.

Share:
10,859

Related videos on Youtube

poqdavid
Author by

poqdavid

Not much i am just a freelance software developer :) I work for BTC and BTS.

Updated on September 18, 2022

Comments

  • poqdavid
    poqdavid almost 2 years

    I wanted to convert a file so I can play it my DVD player which only works with divx/xvid. I tried :

    ffmpeg.exe -y -i "in.mp4" -t 480.00 -vf scale=720:301,pad=720:576:0:137 -map 0:v:0 -map 0:1 -b:v 2500K -vcodec libxvid -aspect 1.25 -b:a:0 128K -ac:a:0 2 -ar:a:0 48000 -codec:a:0 libmp3lame "out.avi"
    

    I wanted to know what options I should use for the resulting file to also have these characteristics (as close as possible to the "Divx Home Theater" profile):

    Macroblocks: 40500 bps
    VBV Buffer: 384kB
    VBV Bitrate: 4854 kbps
    B-Frame: 1
    

    My ffmpeg build info is:

    ffmpeg version 2.2.git built on Sep 28 2014 08:33:32 with gcc 4.6.2 (GCC)
    

    Also my OS is Windows 7 x64

  • Zhro
    Zhro over 3 years
    I get a warning when I try to use these options: Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (output.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
  • Adi Prasetyo
    Adi Prasetyo about 3 years
    is xvid belong to mpeg4?