yuv2divx(1)

NAME

yuv2divx - build a .AVI file based on a YUV stream via avifile.

SYNTAX

yuv2divx [option] -o [output AVI]

DESCRIPTION

This utility reads a YUV stream off of stdin (in YUV4MPEG2 format) and compresses it via avifile into a .avi file for playback. There are options for adding audio and selecting the video codec.
Note that you must have avifile available in order to use this utility. If building from a CVS snapshot or copy, this will be detected at build time.

OPTIONS

-o <filename>

--outputfile <filename>
    Mandatory</fR> (except for --help, -V). The resulting encoded avi file is written to filename.

-b <kbps>

--divxbitrate <kbps>
    Specifies the output video bitrate (kilobits per second). Default is 1800.

-a <kbps>

--mp3bitrate <kbps>
    Specifies the output audio bitrate (kilobits per second). Default is 56 for mono audio and 128 for stereo.

-e <frames>

--endframe <frames>
    Encode only frames frames. Default is to encode all frames present in video on stdin (extra audio, if available, is ignored).

-c <width>x<height>+<left>+<top>

--crop <width>x<height>+<left>+<top>
    Include only the specified rectangle in the encoded output. Default is no cropping, entire frame is encoded.

-w <x>

--width <x>
    Output width. Use only if not available in video stream.

-h <y>

--height <y>
    Output height. Use only if not available in video stream.

-V

--version
    Output version and exit.

-s <rate>

--forcedaudiorate <rate>
    Overrides audio rate (if audio is present). Should only be used if rate is not correct in wav or input lav file. (This option may disappear, I can no longer find any cases where it is needed.)

-g

--guess
    Attempt to guess the argument to use for -c. This looks at the first 100 hundred frames and attempts to determine where the transition from a black border to active content occurs. It does not always work (that's why it's a guess!) but can help narrow the process down some. This is useful as an invariant border can usually be discarded to increase the available bandwidth for the active portion of the frame. When using this option, the utility exits after the first 100 frames.

-k <num>

--keyframes <num>
    Sets the keyframes attribute of the video encoder. Not all avifile encoders use this attribute, but when an encoder does, the attribute specifies the number of frames between keyframes. The default depends on the codec being used.

-C <num>

--crispness <num>
    Sets the crispness attribute of the video encoder. Not all avifile encoders use this attribute. When it is used, it affects how edges are detected and encoded. I have found that higher values may cause increased bandwidth usage with some codecs. Default 50.

-A <file>

--audiofile <file>
    Specifies the audio source for the output. This may be either a .wav (PCM) file, or a file readable by another of the lav utilities (i.e. an MJPEG AVI, MOV file or an edit-list file).

-E <fourcc>

--encoder <fourcc>
    Specifies which video encoder to use. You must specify the encoder using the "fourcc" of the codec. The default is "DIV3". Common ones include:

    MJPG - MJPEG (though why you'd use this utility for this is a bit of a mystery)

    DIV3 - Divx ;-) low motion

    DIV4 - Divx ;-) fast motion

    DIV5 - Divx ;-) low motion variable keyframe

    DIV6 - Divx ;-) fast motion variable keyframe

    There are many others. Consult your version of avifile to see which ones might be available for you.

-F <frames>

--frames <frames>
    Specifies the number of frames yuv2divx should expect in the video stream. This is used only for display of the progress line. If this value is missing, the utility will try to guess based on the amount of audio available (-A option). If no audio is given and this option isn't specified, no 'time left' will be displayed.

-v <level>

--verbose <level>
    Specifies the level of verbosity on output. All output occurs to stderr. 2 shows progress and all logging, 1 shows informative output and 0 shows only important messages.

--help
    Display a brief summary of help and exit.

EXAMPLES

By itself (no audio is present in the output):

yuv2divx -o output.avi < input.yuv

As part of a processing chain (preserving audio):

lav2yuv input.eli | \
    yuvdenoise | \
    yuv2divx -o output.avi -A input.eli

A more complicated case, including a framerate change (and a workaround for the sound source framerate problem):

mkfifo sound.fifo
lav2wav input.eli > sound.fifo &
lav2yuv input.eli | \
    yuvkineco -F 1 | \
    yuvdenoise | \
    yuv2divx -o output.avi -A sound.fifo

BUGS

No checking or handling of large output avi files is performed (i.e. output files larger than 2 GiB may break on your installation depending on a number of installation-specific parameters).

If an AVI, MOV or edit list file is specified for -A, no comparison of framerates between the audio and video streams is done.  If they do not match and the audio file's framerate is higher than the input YUV stream, not enough audio will be encoded.  This might happen after using lav2yuv foo.eli | yuvkineco | yuv2divx -A foo.eli (etc) or a similar chain that alters the framerate of an original.

<insert general pithy comment about additional hidden bugs remaining here>

AUTHOR

Shawn Sulma <lav2divx@athos.cx>
If you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is:
    mjpeg-users@lists.sourceforge.net
For more info, see our website at
    http://mjpeg.sourceforge.net/

SEE ALSO

lav2divx(1), lav2yuv(1), divxdec(1), lav2wav(1)