Mencoder: Optimal Script with mencoder filters
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. :D |
Brilliant :mrgreen:
I just encoded one of my samples again with this line, and this is almost as good as the MA script :D Now if I could just get mencoder to read my fake avi created with MakeAVIs :x Edit: But it's slow slow slow :lol: But that's to be expected :cool: -kwag |
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 |
@Kwag,
Use only VM's build http://www.jltoca.uaivip.com.br/file...2004-fixed.zip. Otherwise you can't use makeAVIS :wink: Don't know what Vinicius did but it was great :D Cheers |
Quote:
-kwag |
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 |
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 :wink: Cheers |
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 |
Quote:
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 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 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. :D @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. :wink: For a 1:1.85 movie, being encoded at 352x480 using this filters, I get around 30 fps! 8O |
Quote:
Quote:
Thanks, -kwag |
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. |
Quote:
<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. :D |
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. :wink:
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. :wink: <edit>Added -1:-1:1 to expand, otherwise subtitles keep overlapping. |
Quote:
Bilu |
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,... :lol: 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 :wink: |
Quote:
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 |
Quote:
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 |
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 |
I'm doing -ofps 29.97 and softpulldown because it's multi-platform.
AFAIK there is nothing like pulldown.exe for Linux :? Bilu |
Quote:
Code:
type D:\vobs\*.vob|D:\mencoder\mencoder -include ... -vf ... -lavcopts ... -o D:\encoded\1pass.m2v - It's working for me. When encoding, mencoder complains in the begining: Code:
Reading from stdin... |
Quote:
The correct way is use a IVTC filter, -ofps 23.976 and do pulldown later. Pulldown can probably be compiled in linux or other Unix OS. The Source code is here:http://www.inwards.com/inwards/?id=36 I downloaded and compiled under cygwin (just had to make a very small change), so it must compile easily under gcc in unix enviroment. @digitall.doc This is for KVCD/KSVCD encoding. You can also use for 10 hours 352x480 CVD. Read my post for easy VOB input with no warnings. :wink: |
Quote:
Just what I needed :cool: BTW, for Unix users, it would be: Code:
cat /vobs/*.vob | ./mencoder/mencoder -include ... -vf ... -lavcopts ... -o /encoded/1pass.m2v - -kwag |
Quote:
I knew there should be a command to replace cat (cause I already knew that way from Linux) but I never thought they had "invented" it for win32. BTW who would name a command "type" when it's supposed to show file contents...M$... Cheers |
Quote:
Bilu |
kwag, rds,
nothing to thank at all. I'm just a learner here. I learnt this from someone else (can't remember now) and I share with you all now... :D (this sharing thing also learnt from you all :wink: ) vmesquita, if this filtering chain is for KVCD/KSVCD, then it will be even easier to design a light filtering chain for 4-5 hours KDVD. As soon as I find some continued hours (I'm slooow :oops: ) to read filters info in man_page, I'll post a proposal... |
Quote:
@digitall.doc Actually I created this filter chain using the optimal script as a basis... I don't think KDVDs really need filtering, nor I know any KDVD-recommended scripts... :D But if you have any ideas... Let us know! @all I don't understand: why not use my DVDDecrypter solution and create a big VOB? It's much faster... :? Of course, in UNIX the pipe is the best bet. :wink: |
Quote:
That's the best solution, but it just so happens that most of my VOBs already on the disk are splitted :lol: So for new ripps, yes, rip to a single VOB. Then use MovieStacker, get the resize parameters/overscan/etc. parameters, and edit the filterchain line and "expand" to the correct output size ;) I was actually thinking about doing a little program to read a .avs script, and generate a corresponding .ini file :cool: :idea: :idea: -kwag |
Yes, kwag, that's just the point, I didn't explain well. For those of us with splitted vobs in the hard disk, piping I think is the way. For my future "decryptings" I'll use one vob vmesquita way :wink: , of course.
BTW, vinicius, do you know a way that IFOedit, when muxing, output also just 1 vob file. Since when I load then in DVDlab, it loads each vob as a different film... it would be easier for me to have the film muxed with IFOedit in just 1 vob. (I mux with IFOedit to add 2 audio tracks and a subtitle) kwag, it's coming the time that you, advanced programers, create some tools to work with mencoder... don't you think so 8) (If it was so easy as just say that :lol: :lol: :lol: ) |
Quote:
about 2 audios or more using ifoedit, vobedit,menuedit.... and how to get a big vob too! please, take a look in that post, :arrow: i did, still doing and works perfect . don't know if can be used here but.... "who knows", it can help ! http://www.kvcd.net/forum/viewtopic.php?t=9332 of course, excuse my english! |
Quote:
http://forum.doom9.org/showthread.php?s=&threadid=69199 And some Decomb experience: http://forum.doom9.org/showthread.php?s=&threadid=65985 But I'm in a "don't care" phase now ;) Idea is to have a tool/script/whatever that can be used everywhere, even if you don't have analisys tools like Avisynth around (FreeBSD/Linux/others) And many people I know just want to backup the DVD, don't care about pre-processing it. But I do agree with you it would be better :) Bilu |
Quote:
At least that's my point of view :) -kwag |
Quote:
But this isn't what I was looking for. I do my menus with DVDlab from scratch, since I fit 2 films per media. I load my video stream, 2 audio stream and subtitle file without a problem in IFOedit. But when IFOedit muxes all this, generates several vob files. And I would like just 1 vob file. I still don't now how to do it in IFOedit. Sorry me if I'm a little noob. |
Quote:
wrote more: "But when IFOedit muxes all this, generates several vob files. And I would like just 1 vob file. I still don't now how to do it in IFOedit. Sorry me if I'm a little noob." little noob ? :lol: this is my title! i did that taking ideas from here and from everywhere,mixing all... there was only the idea.....now you can get a big vob: Creating a single title compilation using DVD Shrink, IFOEdit, and VOBEdit. NOTE: This method should probably only be used if the clips have the same audio and subpicture streams (as a two-sided or multi-disc movie would). Let's say we want to create 3 clips and then join them into a single title. Clip 1: 1) Use start/end feature in re-author mode in Shrink to select desired region 2) Apply compression if desired (I generally only do a final compression over the joined clips) 3) backup clip 1 to directory A. Change Shrinks Preferences to NOT split files at 1GB and proceed with clips 2 & 3. This is necessary for the proper operation of VOBEdit. Clips 2 & 3: 1) Use start/end feature in re-author mode in Shrink to select desired region 2) Apply compression if desired 3) backup clip 2 to directory B. 4) backup clip 3 to directory C. For the purposees of this example, let's say that Clip 1 as three VOB files VTS_01_1.VOB, VTS_01_2.VOB, and VTS_01_3.VOB. Let's also assume that the order we want the clips to play is 1, 2, and then 3. Change VOB Ids for clips 2 & 3: 1) Go to directory B and rename the single VTS_01_1.VOB file to VTS_01_001.VOB 2) Launch VobEdit and open the VTS_01_001.VOB file in directory B 3) Select from the Edit menu "Join Clips" 4) allow vobedit to save the destination as VTS_01_1.VOB in directory B 5) Set the VOB Id to 2 (since the VOB Id of clip 1 is 1 and we want consecutive numbering) 6) click OK and let VobEdit do its thing 7) Go to directory C and rename the single VTS_01_1.VOB file to VTS_01_001.VOB 8) Launch VobEdit and open the VTS_01_001.VOB file in directory C 9) Select from the Edit menu "Join Clips" 10) allow vobedit to save the destination as VTS_01_1.VOB in directory C 11) Set the VOB Id to 3 12) click OK and let VobEdit do its thing In this example, let's say that VObedit now has created VTS_01_1.VOB & VTS_01_2.VOB in directory B and VTS_01_1.VOB, VTS_01_2.VOB, and VTS_01_3.VOB in directory C. Rename VOB files for clips 2 & 3. 1) Since the last VOB file in directory A is VTS_01_3.VOB we need to rename the VOB files in directory B from VTS_01_1.VOB to VTS_01_4.VOB, and VTS_01_2.VOB to VTS_01_5.VOB. 2) Copy VTS_01_4.VOB and VTS_01_5.VOB from directory B to Directory A 3) Since now the last VOB file in directory A is VTS_01_5.VOB we need to rename the VOB files in directory C from VTS_01_1.VOB to VTS_01_6.VOB, VTS_01_2.VOB to VTS_01_7.VOB, and VTS_01_3.VOB to VTS_01_8.VOB. 4) Copy VTS_01_6.VOB, VTS_01_7.VOB, and VTS_01_8.VOB from directory C to Directory A Now in directory A we have VIDEO_TS.IFO & BUP, VTS_01_0.IFO & BUP, and VTS_01_1.VOB through VTS_01_8.VOB. Create new IFOs: 1) make a temp sub-directory in directory A and move all four IFO & BUP files into the temp directory 2) Launch IFOEdit and click on the "Create IFOs" button 3) browse to directory A and select VTS_01_1.VOB 4) make sure to select "Create 1 PGC only" and "Create Chapter for each cell" and check the "same as source" box for the new IFO destination directory 5) Click OK and let IFOEdot do its thing. 6) When complete there will be new VIDEO_TS and VTS_01_0 IFOs and BUPs in directory A I find that in order for rewind and reverse skip to work properly the VOB files must be processed once more with IFOEdit to fix navigational structures. Final Fixup with IFOEdit: 1) Launch IFOEdit and open the VTS_01_1.VOB in directory A 2) Click on VOB Extras and make sure all check boxes are checked EXCEPT: Remux, Rebuild PTS, Split to 2 DVD-Rs, and Remove IIvu/Angle Point. 3) Select a new destination directory (for this example "D"). 4) Click OK. 5) make sure Correct IFO Tables checkbox is checked. 6) check all streams that are to be kept (probably since this has been preprocessed by shrink already). 7) Click Strip It. 5) make sure Correct IFO Tables checkbox is checked. 6) check all VOB Ids. 7) Click Strip It and let IFOEdit process the files In directory D you will now have a DVD file set that can be further processed by Shrink. In this example, it will certainly be necessary since there are over 5GB of VOB files. Don't forget to change back the Shrink preference to split files at 1GB... A few notes: I doubt that this method will work very well if the number of audio streams and subtitle streams don't match from clip to clip (or if the IDs are different between clips). If you have clips with different audio or subtitle streams, it is best to keep each clip as a separate title and simply use the re-author method in Shrink directly. The audio stream and subtitle stream information in the IFOs created by IFOEdit will not contain the correct language information, nor will the subtitle colors be correct. However, using the information from the original IFOs (in the temp directory in directory A for example), IFOEdit can be used to restore the information. The chapter points in the new IFOs in directory A may not match up with the original chapter points as each cell has been designated as a chapter. Cells that shouldn't be chapters can also be easily adjusted using IFOEdit. I generally make all adjustments before making the final compression pass with DVD Shrink. This will result in seamless playback of all three clips and will allow skipping forward and backwards by chapters as well as FF and RW as one would expect. Note that if all that is really desired is to be able to go from the last chapter mark of a clip to the next clip, one could use this method to append a single cell 15 frame VOB file to the end each clip and leave each clip as its own title. This will result in a 1/2 second delay between titles, but it will at least allow one to use the skip button to get to the next title instead of having to use the title button. However, you won't be able to skip backwards from title 2 to title 1 for example. too big but simple! :wink: |
jorel,
8O 8O 8O 8O I just saw you answered my question. Now I'm going to look for a "editing vobs for experts" dictionary to understand what yo wrote :lol: :lol: :lol: Just a joke. Didn't read it thoroughly nor in depth, but it seemed to me quite clear. Don't know if too much, I just wanted an option in IFOedit that did allow me to output 1 vob instead of several ones... :) |
Quote:
Bilu |
Quote:
|
I know that for ages :twisted:
But I'd like a program to do it itself, just like AutoGK does now (and I helped len0x with hybrid Decomb thresholding). And just like the algorithm i suggested in that Doom9 thread I posted. I'm after set-and-forget encodings: "just one click" :) Bilu |
vmesquita,
I posted in mencoder 2pass thread my tests with 2pass, and "problems" (not really problems) with vbitrate=1500. I also tested with your filter chain, but just crop black borders and resize to 704x576. Encoding speed went down to 12 fps (from 26 fps), similar to what I get when using avisynth... don't know if ytou get similar results, at this high resolution. Related to the effect the filter make: hmmm, not bad. Very little blurred and washed and shaved, but little, not bad. As I said, I have to try some light filtering for KDVD encoding, and I'll propose it here, in case you wanted to test it. ... and no, the filtering also didn't solve the microblock problem. I'm afraid it's due too low average bitrate, and difficult to solve. But I did notice that it lowered max bitrate and raised a little quantizers. |
Quote:
thanks |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.