Quantcast Mencoder: Optimal Script with Mencoder Filters - digitalFAQ.com Forums [Archives]
  #1  
04-11-2004, 05:25 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
After encoding the same movie in mencoder without filters (very fast) and with the latest optimal script for DVD (2~3 times slower). I decided to try to reproduce the optimal script using mencoder internal filters. What I did was basically:
1) encode the sample with M.A. script
2) encode with some filter combo
3) Check frame by frame the difference using stackhorizontal.
4) change my mencoder filter chain to make the output more like the Optimal Script Output and go back to step 2.

After many tries, I came to a filter chain that gives results close (but still a little worse) than the optimal script. Also note that M.A. filering is not possible with mencoder. This filter chain is intended to low bitrate targets, like near 2 hours CVD. All the tests were done using 2 Pass VBR:

vf=detc,yuvcsp,scale=336:336:0:0:60,unsharp=l3x3:0 .6,hqdn3d=3:6:8,unsharp=l3x3:-0.7:c3x3:-1.5,expand=352:480:-1:-1:1
ofps=23.976
fps=23.976

You have to change scale and expand to the correct values. (use fitcd or moviestacker to find out). If you examine the static optimal KVCD script and this filter chain, you'll see that they share the same idea.

Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-11-2004, 06:09 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Brilliant
I just encoded one of my samples again with this line, and this is almost as good as the MA script
Now if I could just get mencoder to read my fake avi created with MakeAVIs

Edit: But it's slow slow slow
But that's to be expected

-kwag
Reply With Quote
  #3  
04-11-2004, 06:12 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hmm,
That's all very nice.
I once thought about that too.
But from what do you encode the movie?
From VOB?
If so how can you make the whole movie?
You'll get between 6 to 10 m2vs because that's around the amount of VOB files a DVD has.
You join the m2vs in the end?
From AVS script only with Mpeg2Source and have MEnc's internal filters do the job?
C ya
Reply With Quote
  #4  
04-11-2004, 06:16 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
@Kwag,
Use only VM's build http://www.jltoca.uaivip.com.br/file...2004-fixed.zip.
Otherwise you can't use makeAVIS
Don't know what Vinicius did but it was great
Cheers
Reply With Quote
  #5  
04-11-2004, 06:18 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
@Kwag,
Use only VM's build http://www.jltoca.uaivip.com.br/file...2004-fixed.zip.
Otherwise you can't use makeAVIS
That's what I'm using

-kwag
Reply With Quote
  #6  
04-11-2004, 06:23 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Don't use makeAVIS that comes with latest FFdshow
Use the old ones that came with FFvfw.
I had the same problem today.
I even had to remove FFdshow...
Cheers
Reply With Quote
  #7  
04-11-2004, 07:01 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hi,
I'm talking with guys near to the developers at the official forum to see if they implement native support for avisynth scripts in Mencoder
See it here http://article.gmane.org/gmane.comp....yer.cygwin/526
This makeAVIS thing is a real nightmare.
It even crashes sometimes...
Just imagine thousands of newbies complaining about that
Cheers
Reply With Quote
  #8  
04-11-2004, 07:20 PM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
One very special rule to have makeAVIS work:
- choose your source script
- choose your destination fake avi
- tick the "store script in AVI"
This last one is very important
Otherwise it won't work at all...
Cheers
Reply With Quote
  #9  
04-11-2004, 09:30 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rds_correia
But from what do you encode the movie?
From VOB?
If so how can you make the whole movie?
You'll get between 6 to 10 m2vs because that's around the amount of VOB files a DVD has.
You join the m2vs in the end?
From AVS script only with Mpeg2Source and have MEnc's internal filters do the job?
C ya
It's very easy, easier and faster than with Mpeg2source! There are two ways:
1) The lazy way: encode straight from DVD, with no need for ripping. Since you have a slow machine, I recommend you get some kind of cache if you intent to do that to avoid problems leaving your drive on for too much time. Anyway, encoding speed is slower when coming straight from DVD. But you have the option!
Code:
mencoder -include kvcd.ini -lavcopts vbitrate=873:vpass=1 -dvd-device=F: dvd://TITLE  -o encoded.m2v
replace TITLE with the main movie title number (you can check this using DVD Decrypter) and F: with your DVD-ROM letter

2) Rip the VOBs using DVDDecrypter, but let it joint automatically:
Go to Tools/Settings/IFO Mode and change File Splitting to none. This way DVDDecrypter will produce a big VOB and you just have to do:
Code:
mencoder -include kvcd.ini -lavcopts vbitrate=873:vpass=1 VTS_01_01.VOB  -o encoded.m2v
Remenber, since you are using the VOBs directly, you have to reverse the 3:2 pulldown to recover the progressive frames in case you are dealing with NTSCFilm matherial. That's why you need filmdint in filters chain. if you are dealing with PAL, remove this filter. Mencoder offers 3 IVTC filters, this one seems to be the fastest, but I don't know which one is best qualitywise.

Nice idea native support for avisynth (as an alternative), but I still think we should use the internal filters since they are 2~3 times faster and multiplatafrom.

@kwag
Use the package with MakeAVIS only, the link is in rds_correa begginers guide. That's the one I am using. The latest FFDShow didn't come with MakeAvis.
You can use the AtlhonXP version if you have a AtlhonXP, Duron Morgan, Pentium III 1Ghz+ or Pentium IV. It's about 10% faster. For a 1:1.85 movie, being encoded at 352x480 using this filters, I get around 30 fps!
Reply With Quote
  #10  
04-11-2004, 09:43 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vmesquita
but I still think we should use the internal filters since they are 2~3 times faster and multiplatafrom.
And I second that too
Quote:

@kwag
Use the package with MakeAVIS only, the link is in rds_correa begginers guide. That's the one I am using. The latest FFDShow didn't come with MakeAvis.
Will do

Thanks,
-kwag
Reply With Quote
  #11  
04-11-2004, 09:51 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
I did a 1h48m encode to test this filtering with a Real-World example. The movie is "The Lawnmover Man", and it's 1:1.85 AR. The target: 352x480 CVD with 128 kbps audio in 1 80 min CD. The bitrate for that would be 873. I also asked for a Max_rate of 2500.

1st Pass: Average 833 kbps.
2nd Pass: Average 832 kbps.

Averages smaller than asked generally means that quantisizer couldn't be lowered even more. This seems to be the case here, my average quantisizer in second pass was 2.53 (very close to 2, the minimmum). The maximmum bitrate was 2908. It's over the asked value, but maybe it's just a peak that is using VBV buffer. Or maybe it's a problem, but if this is the case it can possibly be fixed playing with rate control. Max quantisizer was 12.95, so mencoder did try to enforce max bitrate.
Aspect in BV: we seen a quantization line with aproximatelly the same shape of the bitrate line. Normal behavior of 2pass VBR.

I'll burn and check the quality in my stand-alone, and report back.
Reply With Quote
  #12  
04-11-2004, 09:54 PM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Brilliant
I just encoded one of my samples again with this line, and this is almost as good as the MA script
Yes, and I did it today, alone, trying to reproduce Optimal Script effect. The optimal script has been improved for many people over a lot of months. You see, there's still a lot of room for improvement.

<edit> I watched the encode in my 29" TV. There are DCT blocks in low light areas. Most of the movie look good, this is the only problem. But this is a encode problem, not a filtering problem. I can think of two ways to improve this:
1) Encoding settings: I remember that Bilu proposed a special setting for low bitrate encodes
2) Add a little noise. This will make loss of compressibility but at least with this movie, there's bitrate to spare.
Reply With Quote
  #13  
04-12-2004, 06:30 AM
vmesquita vmesquita is offline
Invalid Email / Banned / Spammer
 
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
filmdeint was not droppping frames and making the image jump up and down... I only realized wen I tried detc and saw the difference. So I replaced with detc. This should make the video more compressible and end the sync issues.

Also this is needed to avoid tons of framerate change messages:
ofps=23.976
fps=23.976

<edit>In case anyone needs subs (like me), use this:
sid=0
And replace 0 with the subtitle track number.
<edit>Added -1:-1:1 to expand, otherwise subtitles keep overlapping.
Reply With Quote
  #14  
04-12-2004, 09:56 AM
bilu bilu is offline
Free Member
 
Join Date: Jan 2004
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vmesquita
filmdeint was not droppping frames and making the image jump up and down... I only realized wen I tried detc and saw the difference. So I replaced with detc. This should make the video more compressible and end the sync issues.

Also this is needed to avoid tons of framerate change messages:
ofps=23.976
fps=23.976
Are you doing DVDs with this framerate?

Bilu
Reply With Quote
  #15  
04-12-2004, 11:18 AM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Very nice vmesquita!,
I, as rds, had this in the to do list. But didn't decide to because was too lazy to read and understand the manpage, to look for the filters combo.
But you, da man,...

You say this is for KDVD encoding. But I don't really think there's a single optimal script for KDVD encoding. Sure your filter combo will be very good (I have to test). But there's also Dialhot suggestion (with fluxsmooth and tempcleaner, or with deen), kwag suggestion (just the MA part with unfilter and tempsmoother),...
I tell you since we could (I'll try to also) make several filter chain and see what is better and faster for mencoder. Maybe mencoder benefits from an special combo of filters. And as you said, this was just (just?) the result of your work. With everybody help we can fine adjust it... if possible
Reply With Quote
  #16  
04-12-2004, 11:46 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bilu
Quote:
Originally Posted by vmesquita
filmdeint was not droppping frames and making the image jump up and down... I only realized wen I tried detc and saw the difference. So I replaced with detc. This should make the video more compressible and end the sync issues.

Also this is needed to avoid tons of framerate change messages:
ofps=23.976
fps=23.976
Are you doing DVDs with this framerate?

Bilu
If the source is FILM, yes you should
If not, you would be encoding at 29.97fps, loosing a lot of quality.
Then run pulldown (or use the internal softpulldown, I believe it's called )

-kwag
Reply With Quote
  #17  
04-12-2004, 12:16 PM
bilu bilu is offline
Free Member
 
Join Date: Jan 2004
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
If the source is FILM, yes you should
If not, you would be encoding at 29.97fps, loosing a lot of quality.
Then run pulldown (or use the internal softpulldown, I believe it's called )
IMHO softpulldown+detc or pulldown.exe+detc should use -ofps 23.976, but softpulldown alone should use -ofps 29.97 fps.

softpulldown isn't capable of creating MPEG-2 RFF flags like pulldown.exe
It copies a field into the stream and it becomes hard-telecined 29.97fps.
Of course IVTC works just the same over hard-telecined


Bilu
Reply With Quote
  #18  
04-12-2004, 12:47 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, so then the correct way is as vmesquita posted, and then running pulldown.exe on the resulting .m2v file.
Which is the same process as if the file was encoded with ffmpeg.
Well, actually, it is, because mencoder really uses libavcodec, so the result is identical to an ffmpeg encode

-kwag
Reply With Quote
  #19  
04-12-2004, 01:01 PM
bilu bilu is offline
Free Member
 
Join Date: Jan 2004
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
I'm doing -ofps 29.97 and softpulldown because it's multi-platform.

AFAIK there is nothing like pulldown.exe for Linux


Bilu
Reply With Quote
  #20  
04-12-2004, 01:07 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by vmesquita
Quote:
Originally Posted by rds_correia
But from what do you encode the movie?
From VOB?
If so how can you make the whole movie?
You'll get between 6 to 10 m2vs because that's around the amount of VOB files a DVD has.
You join the m2vs in the end?
From AVS script only with Mpeg2Source and have MEnc's internal filters do the job?
C ya
It's very easy, easier and faster than with Mpeg2source! There are two ways:....
And I'll give you the third one. I don't want to say it's better, but just one else to use. You have got all your vobs in a folder. And you feed mencoder through piping, this way:
Code:
type D:\vobs\*.vob|D:\mencoder\mencoder -include ... -vf ... -lavcopts ... -o D:\encoded\1pass.m2v  -
The keys are "type" and | in the begining of the command, and "-" in the end.
It's working for me. When encoding, mencoder complains in the begining:
Code:
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
MPEG-PS file format detected.
And then it doesn't show the percentage encoded, nor the aproximate final file size, nor time left... but it works. Just try if you think it does worth.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Mencoder: Making a vcd with mencoder on the command line? sk545 Video Encoding and Conversion 17 06-11-2004 12:36 PM
Found a comprehensive comparison of Mencoder filters Fluffbutt Video Encoding and Conversion 6 05-21-2004 09:08 PM
Mencoder: Filters, Crop, resize? Prodater64 Video Encoding and Conversion 24 05-06-2004 10:31 AM
Mencoder: Changing/Setting field order in mencoder tuco1979 Video Encoding and Conversion 1 04-17-2004 09:06 AM
Mencoder: Problems compiling Mplayer/Mencoder rds_correia Video Encoding and Conversion 6 03-18-2004 09:11 AM

Thread Tools



 
All times are GMT -5. The time now is 01:28 PM  —  vBulletin © Jelsoft Enterprises Ltd