encoding video for dvd burning

Larry Grover lgrover at zoominternet.net
Sat May 21 03:28:25 UTC 2005


Michael Beattie wrote:
> On 5/19/05, Larry Grover <lgrover at zoominternet.net> wrote:
> 
>>Michael Beattie wrote:
>>
>>>Thanks for all the help... I have a quick question.  Do you know how
>>>to change one of these into a more usable format?  I dont need
>>>anything complicated but I have tried mplayer and ffmpeg and I cant
>>>get any of them to accept it.
>>>
>>>$ file mvi_0077.avi
>>>mvi_0077.avi: RIFF (little-endian) data, AVI, 320 x 240, ~15 fps,
>>>video: Motion JPEG, audio: uncompressed PCM (mono, 11024 Hz)
>>
>>Can you clarify, which format are you having trouble playing:  the
>>mpeg2 video you made for burning to dvd? the dvd itself? or the
>>original AVI file?
>>
>>Thanks,
>>Larry
>>
> 
> 
> This is actually a different file from a different camera.  This one
> comes off a canon sd110.  The other stuff you said worked beautifully
> for what I was doing before.  But if you have a way of encoding that
> thing into a format that mplayer could use, I can just use the
> mencoder process you specified before to work with it.
> 
> Thanks
> 


Since I don't know which libraries/codecs you have installed on your 
system, I can't predict what will work for you and what won't.  But 
I'll try to give a few suggestions.


You can find out which codecs mencoder knows about by running these 
commands:

(1) mencoder -oac help
to find out what audio codecs are available (oac = output audio codec)

(2) mencoder -ovc help
to find out what video codecs are available (ovc = output video codec)

On my system, running these two commands results in:

audio codecs:
    copy     - frame copy, without re-encoding (useful for AC3)
    pcm      - uncompressed PCM audio
    mp3lame  - cbr/abr/vbr MP3 using libmp3lame
    lavc     - FFmpeg audio encoder (MP2, AC3, ...)

video codecs:

    copy     - frame copy, without re-encoding. Doesn't work with
		filters.
    frameno  - special audio-only file for 3-pass encoding, see DOCS.
    raw      - uncompressed video. Use fourcc option to set format
		explicitly.
    nuv      - nuppel video
    lavc     - libavcodec codecs - best quality!
    libdv    - DV encoding with libdv v0.9.5
    xvid     - XviD encoding


The general form for using mencoder is:

mencoder -oac <acodec> -ovc <vdocec> -of <file format> file-to-encode 
-o output-file

For example, I have a video name "02_careless.avi". Here's a little 
information about the file:

grover at sleek:~/video$ file 02_careless.avi
02_careless.avi: RIFF (little-endian) data, AVI, 640 x 352, ~30 fps, 
video: DivX 4, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

So the video is divx4 and the audio is mp3

I ran mencoder like this:
  mencoder -oac mp3lame -ovc xvid 02_careless.avi -o 
02_careless-mp3-xvid.avi

After several minutes I had a new file:

grover at sleek:~/video$ file 02_careless-mp3-xvid.avi
02_careless-mp3-xvid.avi: RIFF (little-endian) data, AVI, 640 x 352, 
~30 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)

My new file is xvid encoded video with mp3 audio.


Much of the power (and also complexity) of mencoder comes from the 
options you can use with codecs during encoding.  To do this you add 
an option to the mencoder command.  The general form is:

-<codec>opts <option1>:<option2>:<option3>

To give a concrete example, if I am using the lavc codec for video, 
and I want more control over the encoding, I can add the option:
-lavcopts vcodec=mpeg1video

to specify that video codec is mpeg1.


Here's a complete example:
mencoder -oac lavc -ovc lavc -lavcopts acodec=mp2:vcodec=mpeg4 
02_careless.avi -o 02_careless-mp2-mpeg4.avi

Here I'm using lavc with two options:  mp2 for audio codec and mpeg4 
(divx4) for video.  At the end of the mencoder run, I have a new video 
file:

grover at sleek:~/video$ file 02_careless-mp2-mpeg4.avi
02_careless-mp2-mpeg4.avi: RIFF (little-endian) data, AVI, 640 x 352, 
~30 fps, video: DivX 4, audio: (stereo, 48000 Hz)

The video is divx4 (mpeg4), and the audio is mp2.


Finally, you should look over the mplayer/encoder man page, and 
experiment a bit.  The man page is long and detailed (and a bit 
overwhelming at first).  For using mencoder skip down to the section 
titled:  GENERAL ENCODING OPTIONS (MENCODER ONLY).

You'll need to experiment to find out what works for you and gives 
acceptable results.

Have fun!

Regards,
Larry





More information about the ubuntu-users mailing list