LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-24-2004, 01:32 AM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
mencoder: DVD to avi. What did I do wrong?


I grabbed a DVD and encoded the VOB files with mencoder like this:
#!/usr/local/bin/bash
dire=/path/to/movie/VIDEO_TS
rm $dire/frameno.avi
cat $dire/*.VOB | nice -19 mencoder -ovc frameno -aid 129 -o $dire/frameno.avi -oac mp3lame -lameopts vbr=3 -
cat $dire/*.VOB | nice -19 mencoder -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=632:vpass=1 -vop scale=576:448 -zoom -oac copy -o $dire/movie.avi -
cat $dire/*.VOB | nice -19 mencoder -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=632:vpass=2 -vop scale=576:448 -zoom -oac copy -o $dire/movie.avi -

The result is of very bad quality:
- speach is sometimes silent sometimes loud, and there is a constant high-frequency hiss in the sound
- very often there are visible squares in the picture
- the movie has a bad aspect ratio ("egg-head" effect)

I wonder how to correct my encoding commands to avoid these problems.
Could you help me?

P.S. Re-scaling the movie is a must for me, since my machine has proven to be to slow to do the scaling (zoom) during playback.
 
Old 03-24-2004, 06:25 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
why on earth are you encoding the vob files directly?!?! did you never actually read the manpage?? you really need to have a read...

mencoder dvd://1 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=632:vpass=2 -vop scale=576:448 -zoom -oac copy -o $dire/movie.avi
 
Old 03-24-2004, 04:43 PM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
> why on earth are you encoding the vob files directly?!?!

'cause there is no DVD drive in that machine. Pretty good reason, heh?
(the DVD is ripped on a Windows machine and copied over to the unix one through the network)

> did you never actually read the manpage?? you really need to have a read...

Thanks for your advise, but reading the mplayer and mencoder docs, and google searching the web for solutions that worked for others have been my main activity in the past two weeks.
However, there are some very basic questions that the authors of the docs might have found too trivial to deal with in detail, while they are not trivial at all for me, the green newbie.
E.g. now I suspect that my sound problem might be due to the fact that I choosed an AC3 audio track and an incompatible audio encoding device (lame) for it.
I was in the belief that I could encode an AC3 track with the lame encoder, which will manage to detect and encode all AC3 channels. Now I suspect that I was wrong: either I should have choosen a stereo track or I should have just copied the AC3 track to the output.
Can you confirm this?

An other example: I thought that mencoder is aware of the aspect ratio of the original video input, and it will not let me distort the picture even if I give it specific x and y values to use.
Why I thought that? Simply 'cause it seemed for me meaningless to distort a movie, so I thought mencoder will automatically override my settings to avoid that.
Now I think I should check the original movie and calculate the best resolution myself.
Is that so?

An other example: I see I should crop the movie if I re-scale it during encoding. But when to do it? Is it possible to correct one or more commands of the three-pass encoding process, or should it be an additional, separate step? Again: the docs describe the crop parameter in itself, but they do not describe how to practically use it during the three-pass encoding method.

Last edited by J_Szucs; 03-25-2004 at 01:20 AM.
 
Old 04-03-2004, 09:01 AM   #4
Gundares
LQ Newbie
 
Registered: Apr 2004
Location: Russia
Distribution: RH 8.0
Posts: 2

Rep: Reputation: 0
Mencoder...

2J_Szucs:
Thanks for script
You have "egg-head" effect because of frame format in VOB files is 720x576 (4:3)!!! Only when U r playing it - U see 16:9

I have great result with this script (based on Ur):

#!/bin/sh
dir=/d/writehere/DVD
rm -f $dir/frameno.avi
cat $dir/*.vob | nice -19 mencoder -ovc frameno -o $dir/frameno.avi -oac mp3lame -lameopts abr:br=224:aq=2:mode=0 -
echo "Enter desired bitrate:"
read BR
cat $dir/*.vob | nice -19 mencoder -ovc lavc -lavcopts vcodec=mpeg4:keyint=250:vhq:vbitrate=$BR:vpass=1 -vf crop=640:392:40:90,scale=640:304 -zoom -oac copy -o $dir/movie.avi -
cat $dir/*.vob | nice -19 mencoder -ovc lavc -lavcopts vcodec=mpeg4:keyint=250:vhq:vbitrate=$BR:vpass=2 -vf crop=640:392:40:90,scale=640:304 -zoom -oac copy -o $dir/movie.avi -

-vop is obsolete (manpage) -vf used
CROP removes black areas around picture, then
SCALE with -zoom removes "egg-head" effect
You can try it with "-endpos 100" (first 100 seconds)

Result is great! (IMHO)
P.S. I agree, manpage is written not for newbies...

Last edited by Gundares; 04-03-2004 at 10:05 AM.
 
Old 04-04-2004, 12:50 AM   #5
Onemessedupjedi
Member
 
Registered: Sep 2003
Location: Oregon
Distribution: Slackware 9.1
Posts: 194

Rep: Reputation: 30
I'm a newb and was able to produce a good quality file after a few shots. I do think man pages could use more understandable language.

Also, if you rip the dvd as an ISO you can mount it as a loop device and specify -dvd-device as where you mounted it and it'll be plenty happy. you MIGHT not even have to copy the file over the network, if you're willing to 1) clog up your network 2)encode slow.

I was able encode as I watched the movie from the encoded file and it looked just fine and sound was in sync and all.
Then again, that was from a dvd drive.
 
Old 04-04-2004, 03:12 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can also use a directory in place of a dvd device. "mplayer dvd://2 -dvd-device /home/fred/dvd" if you have all the lovely ifo files there as on the dvd then it will behave EXACTLY like any real dvd.

aspect ratios... not sure what you mean.. if you access the data files properly then you can scale it all you want. useful hint.... try scale=123:-2 the -2 will enforce the original aspect - the aspect is defined in the ifo files afaik, so encoding from a vob will not know about the aspect.

as far as cropping... you use it whenever you are encoding video.... so on a 3 pass encoding, not on the first one as that's only for audio.
 
Old 04-08-2004, 03:17 PM   #7
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
2Gundares:
> Thanks for script
Your welcome!
However, I must warn you that my "script" (and yours) lacks a very important command from the beginning:
cd $dir

This is needed because mencoder will look for the frameno.avi file (containing the audio encoded in the first pass) in the current directory in the third pass.
But your frameno.avi will be in $dir, which is not necessarily the current directory, unless you actually cd into $dir previously.
You might not notice the problem because once mencoder cannot find the frameno.avi file, it probably falls back to copying the original audio from the VOBs.
Consequently, you have the audio in the resulting avi, but your file size calculations are completely ruined if the size of the original audio differs from the one you create in the first pass with mp3lame.

2AcidKewpie:
> you can also use a directory in place of a dvd device. "mplayer dvd://2 -dvd-device /home/fred/dvd" if you have all the lovely ifo files there as on the dvd then it will behave EXACTLY like any real dvd.

Unfortunately not:

"mplayer dvd://2 -dvd-device /home/fred/dvd" results in the following error for me:

Unknown protocol: 'dvd'
Unable to open URL: dvd://2
Cannot open file/device
Exiting

I get the same error with dvd://1.

I do not know why, but this works for me:
mplayer -dvd 1 -dvd-device /home/fred/dvd
(I wonder if anyone knows what makes the difference...)

However, it does not give me any better results than "cat the VOBs and pipe them to mencoder".
By the way: the only (and last) dvd 2 avi example in the mencoder manual just cats the VOBs to mencoder...
(But in fact I began to use the "-dvd 1" syntax in the last days, just because it looks nicer)

However, in the case of some DVDs I have harder issues than the aspect problems, (which I could solve by the bash script detecting the dvd properties and using "hard-coded" scale parameters for each aspect ratio).

My present problem is that sometimes mencoder identifies subtitle IDs and audio IDs in the DVD, then it will not find them when you want to use them for the resulting avi.

But those are different threads of mine at this forum...

Last edited by J_Szucs; 04-08-2004 at 04:04 PM.
 
Old 04-08-2004, 04:41 PM   #8
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
As for the dvd:// syntax: I suspect that mencoder not accepting that might be a platform dependent bug.

I found an old thread at the mplayer-users forum, where some users reported the same problem, which was denied by some mplayer core team members. The latters insisted on that mencoder should accept that syntax as of version 0.90.

Now I see that my freshly-downloaded mencoder version 0.92 still does not accept that syntax, or at least not on FreeBSD.

Last edited by J_Szucs; 04-08-2004 at 04:49 PM.
 
Old 04-09-2004, 02:51 AM   #9
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
I have a bad news for you AcidKewpie:

When encoding a dvd rip into avi and you want a language other than the default (id 128), you just CANNOT avoid analyzing each individual VOB file!

Look what I have found:

> mplayer -v -identify -dvd 1 -dvd-device /path/to/dvdrip
# [open] audio stream: 0 audio format: ac3 (5.1) language en aid: 128
# [open] audio stream: 1 audio format: ac3 (5.1) language hu aid: 129
> mencoder ... -oac frameno ... -aid 129 ... -dvd 1 -dvd-device /path/to/dvdrip
# No audio stream found ==> No sound

Now, let's see the VOBs:
> mplayer -v -identify /path/to/dvdrip/VTS_01_1.VOB
#==> Found audio stream 128
> mplayer -v -identify /path/to/dvdrip/VTS_01_2.VOB
#==> Found audio stream 128
#==> Found audio stream 131
> mplayer -v -identify /path/to/dvdrip/VTS_01_3.VOB
#==> Found audio stream 128
#==> Found audio stream 131
... and so forth...

As you can see, there is no aid 129 audio in the VOBs, in spite of the fact that mplayer reported that when analyzing the dvd as a whole.
And, actually, mencoder could not find aid 129 when it came to using it (resulting in no audio encoded). The "-alang hu" option did not work, either.

But analyzing the VOBs showed that there is an audio stream on id 131, and actually "mencoder ... -aid 131 ..." encoded the hu sound correctly into the avi.

So, I should correct myself: Mplayer rocks. But NOT THAT MUCH :-(

Consequently, I have to correct my bash script to check if the aid reported by mplayer for the whole dvd actually exists in the VOBs, and, if not, use the aid that it finds in the VOBs, instead.

Now I also suspect that there may be a similar reason for my recent failure to insert a hu subtitle into an avi when encoding an other dvd.
I will check it out.

Last edited by J_Szucs; 04-09-2004 at 04:59 AM.
 
Old 04-09-2004, 05:34 AM   #10
Gundares
LQ Newbie
 
Registered: Apr 2004
Location: Russia
Distribution: RH 8.0
Posts: 2

Rep: Reputation: 0
Guys, are you using SmartRipper to rip DVD?
If so, you can rip only audio track you need..
One, or two, then split it using NanDub (Secondary stream option)
 
Old 04-12-2004, 03:22 PM   #11
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
I do not use SmartRipper, but it should not matter, because all other media players I tried played the dvd rip correctly (except for mplayer).
 
  


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 compress avi zuessh Linux - Software 9 02-21-2007 05:54 PM
Audio delay when ripping DVD to AVI with mencoder mikis Linux - Software 2 11-06-2005 05:52 AM
mencoder mpegopts "not an option" format=dvd (converting avi to dvdauthor compliant) Emmanuel_uk Linux - Newbie 1 09-16-2005 01:52 PM
mencoder: dvd rip to avi, no sound J_Szucs Linux - Software 0 04-08-2004 08:21 AM
DV 2 avi with mencoder NeptunEz Linux - Software 3 02-29-2004 03:01 PM

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

All times are GMT -5. The time now is 02:58 AM.

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