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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-21-2008, 02:30 PM
|
#1
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Rep:
|
How can I get top quality video with mencoder?
Hello, i want to encode mpeg-2 video files from my ubuntu gutsy computer to xvids. I've seen some of the torrents where they get a whole movie in around 700mb, and the video quality is very great.
How do i achieve such quality? When i try to encode, the quality is just so so.
I've been scouring the web for good command line examples but have really not found anything. I have been able to find great lengthy tutorials, but i just want something simple as most of it is gibberish to me.
-Thanks
|
|
|
|
04-21-2008, 03:28 PM
|
#2
|
|
Member
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209
Rep:
|
The most important thing is to use multipass. Without it, the bitrate won't be adhered to, so the final size will be way off. Here's the script I use for ripping dvd's (for a target size of 750meg, and 192kbps mp3 audio):
Code:
#!/bin/sh
targetsize=750
abitrate=192
#Calculate the bitrate
vidlength=`midentify "${1}" | grep 'ID_LENGTH=' | sed 's/ID_LENGTH=//'`
audiosize=$(( $abitrate*1000*${vidlength%.*}/1024/1024/8 ))
videosize=$(( $targetsize-$audiosize ))
vidbitrate=$(( $videosize*1024 ))
mencoder "${1}" -ovc xvid -xvidencopts bitrate=-$vidbitrate:pass=1:vhq=4:turbo:threads=2 -oac copy -o /dev/null
mencoder "${1}" -ovc xvid -xvidencopts bitrate=-$vidbitrate:pass=2:vhq=4:threads=2 -oac mp3lame -lameopts br=$abitrate:vol=2:aq=2:mode=0:vbr=0 -o output.avi
mv output.avi "${1}-xvid.avi"
There's plenty of other options for xvidencopts in the manpage. Have a play around to see what you want. The above is fine from my point of view. You may decide you want better quality.
|
|
|
|
04-21-2008, 05:57 PM
|
#3
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Original Poster
Rep:
|
Great, that works nicely. --Thanks
|
|
|
|
04-21-2008, 09:01 PM
|
#4
|
|
Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
I think multiple threads will decrease quality. If the MPEG-2 has a lot of noise or is blocky, the xVid encoder will have a hard time guessing. I suggest use video filters to smooth out the noise. I have used hqdn3d with values 2:1.5:3 to clean out noisy videos (mainly DVD movies). Other video filters can be used to enhance the compression algorithm of xVid.
If the video is a DVD movie or came from a PVR card, you will have to worry about the interlace material in it. This means you will have to worry about catching all the frames and de-interlace the video if you want a progressive video.
|
|
|
|
04-21-2008, 09:20 PM
|
#5
|
|
Member
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209
Rep:
|
Interesting, I didn't know about multiple threads hurting quality. To be honest the xvid encoder doesn't seem to scale over multiple threads well at highish quality. I'll have a play myself to see if it's worth it.
Thanks for the tip.
|
|
|
|
04-22-2008, 09:58 AM
|
#6
|
|
Member
Registered: Oct 2006
Location: California, USA
Distribution: Antix 12, Mythbuntu 11.10, Kubuntu 11.10, but mostly Lubuntu 12.10
Posts: 461
Original Poster
Rep:
|
OK, so my content is from a pvr-500 tuner but i'm using my cable box and connecting it to the svideo port. --how do i apply these so called filters?
-Also, what other filters can i try? I want to try to find a one size fits all setting so that it just works for each video file and i don't have to fiddle with it for every encoding i do.
-Thanks
|
|
|
|
04-23-2008, 07:42 PM
|
#7
|
|
Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
I use the following syntax to playback DVD movies.
Code:
mplayer -pp 0 -vf-clr -vf pullup,yadif=1,hqdn3d=2:1.5:3,scale=-1:-1:0 -ssf ls=100 dvd://
For MPEG-2 content from a PVR card might be different on applying video filters. I suggest check the MPlayer manual to know how to use the video filter and know what they do.
Let us assume that hqdn3d=2:1.5:3 is a good way to clean up MPEG-2 and yadif=1 is a good decent de-interlacer. I would say that the following should work ok for most content.
Code:
mplayer -vf yadif=1,hqdn3d=2:1.5:3,scale=-1:-1:0
Maybe adding -ssf ls=100 will increase the sharpness of the content to bring out the details of the video. With mencoder, it is a little different on what options you can use compared to mplayer, so play around with the settings.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:16 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|