LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   mencoder not using the correct audio stream (https://www.linuxquestions.org/questions/linux-software-2/mencoder-not-using-the-correct-audio-stream-743430/)

jakev383 07-28-2009 11:22 AM

mencoder not using the correct audio stream
 
I whipped up a script to convert VOBs to AVIs for storage on ym NFS backend. I'm using mencoder on CentOS5 to do the conversion.
For 9 out of 10 videos, this works great. There is the occasional 1 that will not have the correct audio stream however. I've tried -alang, -slang, aid, etc. to no avail. Here is my script (also in case anyone else finds it useful), but can anyone offer any suggestions on how to get the correct audio in my avi? When I open the vob in mplayer, I get English. When I run it through mencoder, I get Spanish.
Anyway, here's the script:
Code:

#!/bin/sh

# Get the filename into a managable format for saving and convert to lowercase if needed
name=$1
ext=${name##*.}
if [ "$ext" != "vob" ]
        then
        if [ "$ext" != "VOB" ]
                then
                echo "Not a VOB movie!"
                exit 1
        fi
convertname="${name%.VOB}"
echo "Changing file extention to lowercase"
mv "$name" "$convertname".vob
fi

#echo "${name%.vob}"
newmovie="${name%.vob}"
finalname="$newmovie".vob

echo "Pass 1...."
mencoder -ovc frameno -o frameno.avi -oac mp3lame -lameopts abr:br=128 -alang en "$finalname"
echo

echo "Pass 2...."
mencoder -oac copy -o /dev/null -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:vhq:vpass=1:vqmin=1:vqmax=31 -vop scale -zoom -xy 720 "$finalname"
echo

echo "Pass 3...."
mencoder -oac copy -o "$newmovie".avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:vhq:vpass=2:vqmin=1:vqmax=31 -vop scale -zoom -xy 720 "$finalname"

echo
echo "Clean up temp files...."
rm -f frameno.avi
rm -f divx2pass.log
echo
echo "All done."
echo


disturbed1 07-29-2009 12:12 PM

Remove pass 1, and Add -oac mp3lame -lameopts abr:br=128 -alang en to your current pass 2 and 3. (or just 3)

Quote:

Originally Posted by man mencoder
-frameno-file <filename> (DEPRECATED)
Specify the name of the audio file with framenumber mappings created in the first (audio only) pass of a special three pass encoding mode.
NOTE: Using this mode will most likely give you A-V desync. Do not use it. It is kept for backwards compatibility only and will possibly be removed in a future version.

emphasis mine.

Code:

echo "Pass 1...."
mencoder -oac mp3lame -lameopts abr:br=128 -alang en -o /dev/null -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:vhq:vpass=1:vqmin=1:vqmax=31 -vop scale -zoom -xy 720 "$finalname"
echo

echo "Pass 2...."
mencoder -oac mp3lame -lameopts abr:br=128 -alang en -o "$newmovie".avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:vhq:vpass=2:vqmin=1:vqmax=31 -vop scale -zoom -xy 720 "$finalname"

Some DVDs have more than one alang=en. -aid 128 could be 5.1 english, -aid 129 could be 2.0 english, -aid 133 could be 2.0 director's comments, -aid 160 2.0 lpcm english. I've seen some DVDs put director's comments as -aid 128, and 5.1 english as -aid 129.

You may have to code in a prompt to identify which aid to use. mplayer -identify blah.vob will list the audio streams.

jakev383 08-19-2009 07:59 AM

Took some tinkering, but finally got it.
Thanks!


All times are GMT -5. The time now is 11:24 AM.