LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-28-2009, 11:22 AM   #1
jakev383
QmailToaster Developer
 
Registered: Dec 2005
Location: Burlington, NC
Distribution: CentOS, Voyage, Debian, Fedora
Posts: 220

Rep: Reputation: 31
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
 
Old 07-29-2009, 12:12 PM   #2
disturbed1
Senior Member
 
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
Blog Entries: 6

Rep: Reputation: 224Reputation: 224Reputation: 224
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.
 
Old 08-19-2009, 07:59 AM   #3
jakev383
QmailToaster Developer
 
Registered: Dec 2005
Location: Burlington, NC
Distribution: CentOS, Voyage, Debian, Fedora
Posts: 220

Original Poster
Rep: Reputation: 31
Took some tinkering, but finally got it.
Thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mencoder and lavc audio @ngelot Linux - Software 2 01-09-2006 02:23 AM
mencoder audio resample mrsolo Linux - Software 0 11-17-2004 11:03 PM
mencoder audio off-snyc help estatik Linux - Software 1 03-12-2004 08:02 PM
MEncoder audio codec problems ddpicard Linux - Software 16 05-29-2003 03:49 AM
mencoder jpeg stream encoding bakuretsu Linux - Software 0 10-10-2002 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration