Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
> 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.
-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...
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.
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.
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...
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.
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.