LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-15-2003, 09:13 AM   #1
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Rep: Reputation: 15
mencoder quality low


Dear All,

Ok, it's my first day here and my second thread, but this just occured to me.

I've been using mplayer and mencoder for less than a week and really like it on the whole. I'm using them on SuSE 8.2 on a really nice Compaq nx9005 with a whizzing 1.8GB processor and 256MB of RAM, so no really performance issues.

The question I have is this: I've tried using both 2 and 3 pass encoding of a couple of DVD's I borrowed from a friend, but find that the quality really isn't very good unless I crank up the bitrate to silly proportions (1800 plus) which then makes a 1.6GB file. Whew! Man, that's just too big!

I know nothing about video technology, so small steps (and small words) would be appreciated. The only thing that occurs to me is this: I have a couple of DivX's (avi's) from a friend and they are both in a much smaller, "letterbox" format and the clarity and resolution are perfect!

If I rescale the DVD's at rip time, will this go a long way toward improving quality and making the file sizes smaller? I'd like to keep the films to 2 CD's max.

Thanks in advance for all replies.

gonniff
 
Old 09-15-2003, 09:26 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
1) what commands are you using?

2) have you tried my program? http://acidrip.sf.net
 
Old 09-15-2003, 09:42 AM   #3
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Original Poster
Rep: Reputation: 15
acid_kewpie,

Glad to see your reply! I've read some of your postings, so that's why I joined linuxquestions! (flattery, flattery).

I've just downloaded it and will give it a go when I get home.

Here are the commands I've used so far:

2 pass encoding:

mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o movie.avi

mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o movie.avi

3 pass option:

mencoder -dvd 1 -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi

mencoder -dvd 1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=<bitrate>

mencoder -dvd 1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=<bitrate>

The quality until now (and I've only done two versions of one DVD - Buena Vista Social Club (100 minutes long) has been grainy and what I can only describe as "mosaic" - that is, blocky segments instead of clean, crisp resolution.

A colleague here at work reckons it's due to the file sizing itself just like it does when I play the DVD - a large square in the center of the screen rather than a nice, smaller "letterbox" shape.

The MEncoder docks say that resizing (rescaling) is a bad thing. Don't know what to try first, to be honest.

Gonniff
 
Old 09-15-2003, 09:51 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
saliong isn't a problem really... in theory it's not as good, but hey... that's life. works fine for me.

add some extra options to lavcopts, e.g "vhq:vqmin=2". if you're going to encode manually, i'd suggest doing a -vop cropdetect before hand and whopping off any widescreen bands for extra quality.

i also habbitually resize to about 480 to 560 by whatever.... you really need to work out the average bits per pixel value, and aim to hit around 0.20 for a good divx quality. less and it's ugly, more and you're throwing away file space that could be used to actually encode at a larger dimension etc....

personally i noramlly only encode 1pass, and it's fine for me.
 
Old 09-15-2003, 10:01 AM   #5
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Original Poster
Rep: Reputation: 15
acid_kewpie,

Thanks!

I don't really follow what you mean about the pixel values(honestly, I know nothing about this technology). Can you give me a bigger hint plus a site where I might can learn more? Do I need an extra bit of software to figure out these pixel values?

Or could you give me an example based on one of the lines of script I'm running currently (that is, does it matter where in the string of commands I place any of your suggested options?).

I apologize if it sounds like I'm lazy. I'd just like to rule out any user errors due to me being new at this (and copy the two disks before my friend starts to miss them too much).

Would this be right for a possible cleaner option?
===================================

mencoder -dvd 1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy vhq:vqmin=2 scale=640:480 -o my_movie.avi

Thanks for your help.
 
Old 09-15-2003, 10:12 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
this is a little script one of the mencoder guys wrote.... there is an indepth discussion of bpp in the mplayer mailing list if you search for "calcbpp.pl" in google....

Code:
#!/usr/bin/perl -w

use POSIX;

sub round {
  my $v = shift;
  
  return floor($v + 0.5) != floor($v) ?
    floor($v + 0.5) :
    floor($v);
}

if (scalar(@ARGV) < 4) {
  print("Please provide a) the cropped but unscaled resolution (e.g. " .
        "716x524), b) the aspect ratio (either 4/3 or 16/9 for most DVDs), " .
        "c) the video bitrate in kbps (e.g. 800) and d) the movie's fps.\n");
  exit(1);
}

($unscaled_width, $unscaled_height) = split('x', $ARGV[0]);.$encoded_at = $ARGV[1];.if ($encoded_at =~ /\//) {.  my @a = split(/\//, $encoded_at);.  $encoded_at = $a[0] / $a[1];.}.$scaled_width = $unscaled_width * ($encoded_at / (5/4));.$scaled_height = $unscaled_height;.$picture_ar = $scaled_width / $scaled_height;.($bps, $fps) = @ARGV[2, 3];..printf("Prescaled picture: %dx%d, AR %.2f\n", $scaled_width, $scaled_height,.       $picture_ar);.for ($width = 720; $width >= 320; $width -= 16) {.  $height = 16 * round($width / $picture_ar / 16);.  $diff = round($width / $picture_ar - $height);.  $new_ar = $width / $height;.  $picture_ar_error = abs(100 - $picture_ar / $new_ar * 100);.  printf("${width}x${height}, diff % 3d, new AR %.2f, AR error %.2f%% " ..         "scale=%d:%d bpp: %.3f\n", $diff, $new_ar, $picture_ar_error, $width,.         $height, ($bps * 1000) / ($width * $height * $fps));.}.
basically though it's the bitrate divided by the total area times the number of frames per second. i.e. the number of bits that each single pixel is given to store the data.
 
Old 09-15-2003, 10:14 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
mencoder dvd://1 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 vhq:vqmin=2 -vop scale=640:480 -o my_movie.avi -oac mp3lame -lameopts abr:br=128

just noticed you're using audio copy... hell no wonder the fiels were so big!
 
Old 09-15-2003, 10:21 AM   #8
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Original Poster
Rep: Reputation: 15
Acid,

Thanks for all that. The Perl stuff goes a bit over my head, but I'll find that google posting you mentioned and read up on it.

Thanks, too, for the script. I'll take that home now (just going home) and run it on that DVD.

I'd really like to learn more about this. Had no idea that the copy option for the sound was the problem - just followed the guidelines in the docs. Should have guessed, though. Makes sense on reflection (but then, most things do, I suppose).

I'll let you know how the general quality pans out.

Really appreciate your time.

Gonniff
 
Old 09-16-2003, 03:06 AM   #9
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Original Poster
Rep: Reputation: 15
Acid,

I took your suggested values home and had a go.

The first run failed (seems my mencoder doesn't like the "://" redering. I also found I had to put the values in a different order to get it to accept them (said I hadn't selected any -oac values when I first tried the given format).

Anyway, it ran and the quality was pretty good, but it still has some blocky output. I'll try a second pass rendering tonight.

I also just printed out an article I found when searching for the perl script you printed above:

http://www.mplayerhq.hu/DOCS/tech/encoding-tips.txt

Again, the first string of entries listed failed:

mencoder dvd://1 -o /dev/null -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:\
vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01:vpass=1 \
-vf crop=716:572:2:2,scale=640:480

To me, not surprising as it was directed to /dev/null to start with. Hmmm.....

I removed this and moved the -oac settings around and it ran, but still produces one big block in the center of the screen rather than the nice "letterbox" format. I'll keep reading and keep experimenting.

And I haven't forgotten about your acidrip! I need to install the other components first and then I'll give it a go.

Are there any pointers or things I should be mindful of since you first put this out that might make using it more successful?

Thanks in advance for your help.

Gonniff
 
Old 09-16-2003, 04:34 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,373

Rep: Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962Reputation: 1962
well the biggest thing there is still that you are straight copying the audio, so are including a 400kbps stream rather than a more suitable 128kbps in mp3 format.

/dev/null is being used as that is the first pass, and so you only really want the divx2pass.log file, not the actual video.
 
Old 09-16-2003, 05:40 AM   #11
gonniff
LQ Newbie
 
Registered: Sep 2003
Distribution: SuSE 9.0
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks. Any ideas why the script failed with /dev/null included? Only ran once I took that out.

Also, I just used it as is the first time, but put in your suggested mp3lame settings on the second go. Output wasn't that bad.

You mentioned that this would produce a log file (I'm assuming like with the 2 pass method I've used up to now). Will this de facto increase the quality or have I misunderstood? You mentioned you use single pass encoding with good results.

One last point that struck me when trying to encode "Crouching Tiger" last night: I did a test run of about 45 seconds and found when I played it back it had the commentary as default and not the Mandarin or English soundtrack. How weird is that?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Using mencoder masand Linux - Software 10 05-27-2007 01:12 PM
low sound quality aral Suse/Novell 10 08-21-2005 01:35 PM
mencoder jackstoage Linux - Software 9 04-22-2005 10:02 PM
Low quality sound with ALSA on a Laptop don_eros Linux - Newbie 0 05-23-2004 01:18 PM
Sound static-y and low quality in RedHat 9 with SIGMATEL STAC 9700 AC97 velvet stasis Red Hat 1 11-16-2003 12:52 PM


All times are GMT -5. The time now is 07:38 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration