Gentoo Wiki ArchivesGentoo Wiki

HOWTO_transcode_divx_to_dvd

DVD Definition

Create DVD Video Index

Encode

Filesystem

Burn

edit

Contents

Intro

Warning: So far these are just notes to myself that I needed a place to save. I haven't actually tested this yet, but I am in the process of doing so. As soon as I have a DVD that plays on my DVD player I'll report back! ~CoolAJ86

This is part of HOWTO_Create_a_DVD:Encode, but was too detailed for the average joe. The goal for this document is to show by example how to use transcode to encode downloaded divx videos which have any combination of:

to a format that will play nicely on your average home DVD player, and then continue to HOWTO_Create_a_DVD:Filesystem.

emerge transcode divx4linux xvid

Transcode

An easy starting point can be found here: All to DVD. Click on the AviToVob link. This script can convert almost anything in DVD. Actually I think this script could be improved upon and turned into a program on it's own which could be installed via a gentoo ebuild. If the script doesn't work for you right away, look inside the script and just copy the lines that matter and run them one at a time at the command line to make sure they work.

First of all, no matter how ugly it may be, the transcode.org wiki is definitely worth your while.

If your video is already a standard size and the correct framerate you need only to convert from divx to mpeg2 format, which is quite simple. Otherwise see the appendix below for some examples.

$transcode -i ~/Videos/Only_C.avi -V -y ffmpeg -F mpeg2video -E 44100 -b 128 -o Only_C -m Only_C.ac3

Using tcmplex to merge the audio and video

The transcode operation should have created a *.m2v (mpeg-2 video) and an *.mpa (audio) file in the current directory. We will combine those as follows:

$ tcmplex -o showgirls-dvd.vob -i showgirls-dvd.m2v -p showgirls-dvd.mpa -m d

Appendix

Formats

The following are acceptable DVD formats for NTSC

All at 29.97 fps (with the exception of 23.976 fps for 3:2 pulldown).

The following are acceptable DVD formats for 'PAL

All at 25 fps.

Common Conversions

The most common standard conversions can be found at Transcode.org: Clipping And Resizing Guide (which unfortunately only gives examples for PAL format).

16:9 to 16:9 OR 4:3 to 4:3

If your video is already in the correct format you can simply convert it to mpeg2 format

transcode -i ~/Videos/Joan_of_Arcadia/201-Only_Connect.avi -V -y ffmpeg -F mpeg2video -E 44100 -b 128 -o 201-Only_Connect -m 201-Only_Connect.ac3

16:9 to 4:3 (letterbox)

16:9 to 4:3 (fullscreen)

Adding Padding

If your video is very nearly one of the standard sizes you can use padding to make it right.

transcode -i test-divx.avi -V -y ffmpeg -F mpeg2video -Y -32,0,-32,0 -E 44100 -b 128 -o test-dvd

The negative values for the arguments to the -Y argument tell transcode to add space to the top and bottom, whereas a positive number would remove rows from the top and bottom.

Resizing (enlarging)

  1. Find the ration between the widths: 704/624=1._128205_
  2. Multiply the smaller height by that ratio: 1._12805_x352=397._12805_
  3. The new size is 704x397, use this transcode option: -Z 704x397
  4. 480-397=83, which will need to be half top, half bottom, hence: -Y -41,0,-42,0
transcode -i title_of_video-divx.avi -y ffmpeg -F mpeg2video -Z 704x397 -Y -41,0,-42,0 --export_frc 4 -E 44100 -b 128 -o title_of_video-dvd

Glossary


Original Material

This is outdated and does not work. It is under revision, as seen above

transcode is probably the best tool I can think of for doing this. You will probably have to look at the man pages a few times to understand the command I used, and to understand what other commands you may need to add.

An easy starting point can be found here: All to DVD. Click on the AviToVob link. This script can convert almost anything in DVD. Actually I think this script could be improved upon an turned into a program on it's own which could be installed via a gentoo ebuild.

Here's an example of a command I used, to convert a standard divx in widescreen format (ie. no black bars on top or bottom) which you might find on the Internet. I then converted it into a letterbox 1.5:1. What does that mean? Well, originally the size was a widescreen 1.73 aspect ratio (not quite 16:9) at 720x416. Possible sizes for NTSC DVDs are 720x480, 704x480, 352x480 and 352x240. So I wanted to convert it to 720x480 (which has aspect ratio 1.5). All I needed to do that, without losing any information, was to add 32 rows of black to the top and bottom of the image.

$ transcode -i test-divx.avi -V -y mpeg -F d -Y -32,0,-32,0 -E 44100 -b 128 -o showgirls-dvd

The negative values for the arguments to the -Y argument tell transcode to add space to the top and bottom, whereas a positive number would remove rows from the top and bottom. Often, your video will already be in 720x480 (or some other format which works) so you don't need to resize it. In that case, just leave out the -Y option from transcode.

Warning: OUTDATED!

TODO: Update && Cleanup (see next chapter, MEncoder)

Here's what some of those command line arguments mean:

Code: transcode --help
-V     use YV12/I420 as internal video codec [off].
       This is usually much faster than RGB processing but some import
       modules may not support this format. Always use this option when
       possible.
-y vmod[,amod]
       video[,audio] export modules [null].  If omitted, transcode will
       encode to the null module. A full-blown transcode installation
       has the following export modules:
 <snip>
 mpeg - (video) MPEG 1/2 | (audio) MPEG 1 Layer II
     At compile-time nasm must be available.  This module has no run-
     time dependencies.  Support for this module is good.
         Interface to the bbmpeg library (included in transcode). It can
         encode generic mpeg1, VCD, SVCD, MPEG2 and DVD type video.
         Encoded video goes into a elementary file to be multiplexed
         with the corresponding audio file after encoding.
-F codec_string
       encoder parameter strings [module dependent].
       The -F parameter has different meanings for different export
       modules.
<snip>
        -y mpeg:
          Syntax: -F "<base-profile>[,<resizer-mode>[,user-profile]]"
            <base-profile> can be one of
              '1' = MPEG 1 (default)
              'b' = big MPEG 1 (experimental)
              'v' = VCD
              's' = SVCD
              '2' = MPEG2
              'd' = DVD compliant
            <resizer-mode> can be one of
               0 = disable resizer (default)
               1 = 352x288
               2 = 480x480
               3 = 480x576
               4 = 352x240
            <user-profile> is a filename of the profile file. You can
        either specify the absolute path to the file or if you transcode
        will look for it in the directory where you started transcode.
-Y top[,left[,bottom[,right]]]

       select (encoder) frame region by clipping border. Negative val-
       ues add a border [off].
-E r[,b[,c]]
       audio output samplerate [Hz], bits per sample and channels [as
       input]. The option "-J resample" must be provided for export
       modules not capable of re-sampling.
-B n[,m[,M]]
       resize to height-n*M rows [,width-m*M] columns [off,32]. M must be
       one of 8, 16 or 32. It makes no difference which M you use.  You
       might look at the fast flag of the -Z option if you don not want to
       calculate n and m yourself.

-b b[,v,[q,[m]]]
       audio encoder bitrate kBits/s[,vbr[,quality[,mode]]] [128,0,5,0]
       The mode parameter specifies which modus lame should use for
       encoding.  Available modes are:
          0    Joint Stereo (default)
          1    Full stereo
          2    Mono
-o file
       output file name, default is [/dev/null].

If for example your video was 728x424, you would type something like the following.

$ transcode -i showgirls-divx.avi -V -y mpeg -F d -B 1,1,8 -E 44100 -b 128 -o showgirls-dvd

Also, see the -X option for making your video larger.

Using tcmplex to merge the audio and video

The transcode operation should have created a *.m2v (mpeg-2 video) and an *.mpa (audio) file in the current directory. We will combine those as follows:

$ tcmplex -o showgirls-dvd.vob -i showgirls-dvd.m2v -p showgirls-dvd.mpa -m d
Retrieved from "http://www.gentoo-wiki.info/HOWTO_transcode_divx_to_dvd"

Last modified: Sat, 15 Sep 2007 11:39:00 +1000 Hits: 33,609

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