Dave Phillips wrote:
Greetings,
I've encoded some AVS animations that I'd like to burn as DVD-format
files. I want to be able to play the DVD in a regular DVD player/drive.
The files are currently in AVI format, with 800x600 video and 48 kHz
audio resolutions. I tried the directions (NTSC + AC3) for mencoder here:
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html
Don't use mencoder or any ffmpeg-based MPEG2 encoder to generate
DVD-compliant video streams. ffmpeg is a versatile, fast and clever
software, but it's a horrible DVD MPEG2 encoder.
DVD has fairly strict requirements for MPEG2, you can't just use any
MPEG2 stream. Among those, there's a bitrate requirement - the stream
can't go above 10Mbit/s or so.
ffmpeg has severe bitrate control problems when generating DVD-compliant
MPEG2. It is a known, old problem, acknowledged even on their mailing
list, that has not been fixed yet.
The result of that is somewhat of a russian roulette - maybe your DVD
will play fine on a given standalone DVD player, maybe not. Software
players are usually fine.
Also, the quality of the video is pretty bad. At the same bitrate, most
of the other encoders out there generate better video.
Alternatives?
Well, you could use transcode to resize the image to the standard NTSC
size, maybe adjust the frame rate too, and then from within transcode
drive mpeg2enc as the last stage of the processing - the conversion to
MPEG2. It's a slower encoder than ffmpeg, but it's standards compliant
and the image quality is better. This is what I did for some years now
to create all my DVD-based home videos.
More recently, I quit using even mpeg2enc. There's a Windows encoder,
HCenc, that works very well under WINE, that is faster than mpeg2enc (I
would suspect it might be as fast, or faster than ffmpeg too), and the
image quality is similar to costly professional MPEG2 encoders.
See attachment for a script that uses this method. HCenc is here:
http://www.bitburners.com/hc-encoder/
Nowadays I just switched over entirely to HD. :-) Bye bye MPEG2.
--
Florin Andrei
http://florin.myip.org/
#!/bin/bash
# v20080221
# Florin Andrei <florin(a)andrei.myip.org>
if [ $# -ne "1" ]; then
echo "Usage: $0 dirname"
exit
fi
# Testing pre-requisites
for exe in wine unix2dos mplex dvdauthor; do
if [ -z `which ${exe}` ]; then
echo "${exe} is not installed, bye"
exit
fi
done
name=$1
pushd $name
# File that contains the DVD structure info
xmlf="dvdauthor.xml"
# The HC Encoder executable
# Path is in Windows format (as seen inside Wine)
encoder="C:\HCenc\HCenc.exe"
aencoder="avs2yuv"
# The Unix filesystem root is what "drive letter" under Wine?
# (e.g., if drive is Z, then /home/user becomes Z:\home\user under Wine)
rootdrive="Z"
# pwd in "windows" format (replace / with \)
unixpwd=`pwd`
winepwd=`echo ${unixpwd} | tr / \\\ `
# HC Encoder general encoding parameters
# Change ASPECT to 4:3 or 16:9, depending on the source
# Change BITRATE up or down to adjust image quality and file size
# The other parameters typically don't need to be adjusted
cat - > HC.ini << HCINI
*DBPATH ${rootdrive}:${winepwd}
*MAXBITRATE 9500
*PROFILE best
*ASPECT 16:9
*AUTOGOP 18
*CQ_MAXBITRATE 5.000
*DC_PREC 10
*DVSOURCE
*NOSCD
*CLOSEDGOPS
*LASTIFRAME
*MATRIX mpeg
*LUMGAIN 1
*PRIORITY normal
*WAIT 0
HCINI
unix2dos HC.ini
rm -f $xmlf
# dvdauthor XML config head
cat - >> $xmlf << XMLHEAD
<dvdauthor>
<vmgm />
<titleset>
<titles>
<pgc>
XMLHEAD
max=`ls dv | wc -l`
n=1
for inp in `ls dv`; do
rem=$(( $max - $n ))
echo
echo -n "["
for i in `seq 1 $n`; do
echo -n "+"
done
if [ $rem -ne 0 ]; then
for i in `seq 1 $rem`; do
echo -n "-"
done
fi
echo "]"
out=`basename $inp .avi`
cat - > $out-video.avs << AVSFILE-VIDEO
AviSource("${rootdrive}:${winepwd}\\dv\\${out}.avi")
ConvertToYV12()
AVSFILE-VIDEO
cat - > $out-audio.avs << AVSFILE-AUDIO
AviSource("${rootdrive}:${winepwd}\\dv\\${out}.avi")
ConvertToYV12()
SoundOut(output="ac3", filename="${rootdrive}:${winepwd}\\${out}.ac3",
cbrrate=192, acmod=2, autoclose=true, wait=0, overwritefile="Yes",
silentblock=false)
AVSFILE-AUDIO
unix2dos $out-video.avs
unix2dos $out-audio.avs
awinerun="wine ${aencoder} -frames 1 ${rootdrive}:${winepwd}\\${out}-audio.avs -o
NUL"
echo ${awinerun}
`${awinerun}`
winerun="wine ${encoder} -ini ${rootdrive}:${winepwd}\\HC.ini -i
${rootdrive}:${winepwd}\\${out}-video.avs -o ${rootdrive}:${winepwd}\\${out}.m2v -log
${rootdrive}:${winepwd}\\${out}.log -frames all"
echo ${winerun}
`${winerun}`
mplex -f 8 -S 4400 $out.m2v $out.ac3 -o $out.vob 2>&1 | tee $out-mplex.log
echo "<vob file=\"$out.vob\" />" >> $xmlf
n=$(( $n + 1 ))
done
# dvdauthor XML config tail
cat - >> $xmlf << XMLTAIL
</pgc>
</titles>
</titleset>
</dvdauthor>
XMLTAIL
dvdauthor -o $name -x $xmlf
chmod -R 0755 $name
chmod 0644 $name/*_TS/*
sync
popd