[MPlayer-users] Bad quality ("horizontal lines on movement") an mpeg2->divx
Steven Adeff
adeffs at rpi.edu
Mon Jul 15 00:12:02 CEST 2002
Corey, I actually used that bash scripting page to write the script I'm
using. I'll have to look over what you wrote below and see if i can
figure out how to do the parsing...
for anyone interested, here's my script so far. basically you give the
name of the mpeg you wish to 3-pass convert. I'm going to keep working
on it. Right now I'm setting it up for TiVo mpeg conversion, but if I
can get that correct and working, I'll add extra options so you can
change the audio and video bitrate, etc. from the command line
paramaters.
-------------mpeg2divx--------------
#!/bin/bash
echo
echo "We will now convert \"$1\" to a divx file..."
echo
if [ -n "$1" ]
then
filename=$1
else
echo "no file name given, exiting"
exit 1
fi
if [ -e "frameno.avi" ]
then
rm frameno.avi -f
else
echo "frameno.avi not found, not a problem, it just means we have
nothing to delete."
echo
fi
if [ -e "lavc_stats.txt" ]
then
rm lavc_stats.txt -f
else
echo "lavc_stats.txt not found, not a problem, it just means we
have nothing to delete."
echo
fi
echo "Beginning Audio Encoding..."
echo
mencoder $1 -ovc frameno -oac mp3lame -lameopts br=128:vbr=4:q=0 -o
frameno.avi
if [ -e "frameno.avi" ]
then
echo "Audio encoding done, starting video encoding pass 1"
echo
else
echo "Audio encoding failed, exiting"
exit 1
fi
mencoder $1 -npp lb -ovc lavc -lavcopts vcodec=mpeg4:vhq:vpass=1 -oac
copy -sws 2 -o output.avi
if [ $? -eq 0 ]
then
echo "Video Pass 1 done, beginning video encoding pass 2"
echo
else
echo "Video encoding pass 2 failed, exiting"
exit 1
fi
mencoder $1 -npp lb -ovc lavc -lavcopts vcodec=mpeg4:vhq:vpass=2 -oac
copy -sws 2 -o output.avi
if [ $? -eq 0 ]
then
echo "Video Pass 2 done, file renaming time!"
echo
else
echo "Video encoding pass 2 failed,exiting"
exit 1
fi
if [ -e "output.avi" ]
then
echo "renaming output file"
filename=${filename%.*g}
mv output.avi $filename.divx
else
echo "conversion failed at some point, no output.avi file found!"
exit 1
fi
echo "Done converting!!"
ls -lh $filename*
-------------mpeg2divx--------------
On Sun, 2002-07-14 at 17:26, Corey Hickey wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> Corey Hickey wrote:
> > As far as I know, you need to parse the mencoder output. I could tell
> > you a way to do that, but I don't know enough about scripting to write
> > a nice, clean method. Perhaps someone else here can help you out with
> > that.
>
> On second thought, I just checked the output, and the parsing is easier
> than I thought. You just need to have something like this:
>
> #---snip---
> #do the first pass, redirect stderr to stdout,
> #and copy stdout into output.log
> mencoder -whateveroptionsyouwant 2>&1 | tee output.log
>
> #extract the recommendation line. Change $3 to suit your purposes
> RECOMMEND=$(grep "$3MB CD" output.log)
>
> #strip the longest instance of anything that starts with R and ends
> #with (space) from the beginning of the variable
> BITRATE=${RECOMMEND##R* }
>
> #do whatever you want
> mencoder -allyourotheroptions -lavcopts vbitrate=$BITRATE
> #---snip---
>
> -Corey
>
> _______________________________________________
> RTFM!!! http://www.MPlayerHQ.hu/DOCS
> Search: http://www.MPlayerHQ.hu/cgi-bin/htsearch
> http://mplayerhq.hu/mailman/listinfo/mplayer-users
>
--
Steven Adeff
ADEFFS at RPI.EDU
Rensselaer Polytechnic Institute
AOLIM:"IndieRockSteve"
Those who can think, do; those who cannot, dress funny.
"Bodies are for hookers and fat people" - Bender
You can teach the ignorant, with the stupid there is no hope.
"You see, eventually your music will help put an end to war
and poverty, it will align the planets and bring them into
universal harmony, allowing meaningful contact with all
forms of life."
-Bill 'n' Teds Excellent Adventure
More information about the MPlayer-users
mailing list