GUIDE 7: RE_COMPRESSION OF 1080p MTERIAL TO 720p WITH MEDIUM AND HIGH QUALITY SETTINGS.
To do this you can miss out GUIDE 2 and progress strait here or you can do do GUIDE 2 and do this at a later stage it makes no differance.
First extract the x264 encoder to a folder of your choice and then open up graphedit. Choose graph, then insert filter, then under directshow choose the haali media splitter you will then get a new window asking for a file to split:
You may have to change file type to all files to see your mkv, select the video and then depending on what the fideo is encoded in i.e. AVC, VC-1 etc we need to choose the correct decoder. In the case of the example the file is in VC-1 so we need the "WMVideo DMO" filter so we add that. We are now done with filters and just have to connect the video out pin to the in0 pin (do this manually by draging the mouse between them...do not choose to render the pins automatically or your encode will not work):
save the graph under something memorable into your x264 directory.NOTE IMPORTANT: YOU WILL REQUIRE A DIFFERENT FILTER FOR EACH FORMAT AND AS SUCH NEED ALL THE ONES THAT HD-DVD/BLU RAY SUPPORT. THE ABOVE FILTER "WMVideo decoder DMO" is ONLY for VC-1 (used by Warner & Universal alot). IF YOU HAVE AVC (typically Sony, Fox Paramount) YOU WILL NEED EITHER CoreAVC or ffdshow (Cyberlink decoders will not work). ffdshow is good for MPEG-2 material.
Next we need to create a avi script so open up notepad and type the following:
DirectShowSource("shining.GRF", fps=23.976, framecount=172108, audio=false). bicubicResize(1280, 720)
The 2 important things here are framecount (get this from your eac3to log) and fps (always 23.976 for film, may differ for TV again eac3to log at the top where it gives info on video streams).BicubicResize is an older filter which has since been replaced by LancsozResize, Lancsoz4Resize and spline36Resize ....use these instread, you willl get much sharper results. The format is the same i.e. filtername(1280, 720)
Save this with the extention .avs just as you did for the eac3to .bat files, again in the same folder as x264. If you want to add other options here like Trim(0, 3000) to encode the first 2 mins make sure that each additional term is added after a fullstop i.e. after every set of brackets. There are many options that can be specified and I'll cover some more in the blu ray/advanced guide
Now we move to the final step, creating a .bat file for the encoder. For a goog quality set of settings use the following code:
x264 --bitrate 9500 --progress --threads auto -b 3 --b-bias 5 --b-pyramid --weightb --b-rdo --bime -8 -t 1 -o NUL shining.avs
x264 --bitrate 9500 --progress --threads auto -b 3 --b-bias 5 --b-pyramid --weightb --b-rdo --bime -8 -t 1 -o shining.mkv shining.avs
Those two lines make a decent two pass x264 encode in just a few hours (~8-10). You have to obviously adjust the input/output files, and can do the same with the bitrate (9500 in our example) as well as any other option if you want. Save this as a .bat file (same directory as x264.exe again) and run it by double clicking.
If you want the best image quality, the the following code:
x264 --pass 1 --bitrate 9500 --bframes 3 --b-pyramid --direct auto --deblock -3:-3 --subme 1 --analyse none --me dia --threads auto --thread-input --progress --no-psnr --no-ssim -o NUL shining.avs
x264 --pass 2 --bitrate 9500 --ref 5 --mixed-refs --no-fast-pskip --bframes 3 --b-pyramid --b-rdo --bime --weightb --direct auto --deblock -3:-3 --subme 7 --analyse all -8 --trellis 1 --me umh --threads auto --thread-input --progress --no-psnr --no-ssim -o shining.mkv shining.avs
Reencoding the video with these settings will probably take around a full day on an average dual core computer (you can just copy and paste these and change what you need same with the avi script tp prevent any situations arising with spelling mistakes etc....sounds silly but many have come unstuck
). Of course, a whole book could be written on the pro- and contra of various x264 settings.
This should leave you with 4 files in your x264 directory and a fith/sixth on completion depending on what settings you use:
Once you have finnished then go back to GUIDE 2 and remux your new re-encoded file with your audio .Note if you have already done step 2 previously and don't have the origional audio, subs etc you can just import the origional file and uncheck the origional full bitrate/size video but delays etc still have to be applied so i would recomend holding on to your log files.
GUIDE 8: Re-encoding HD media using meGUI
This method uses MEGui to convert any DirectShow compatible video source to H246 (x264). With this guide you will be able to convert DVD, Blue-Ray, HD-DVD etc basically anything that can be played via the DirectShow interface. You will still need step 1 & 3 of first post (3 can be performed in MeGUI but not going to do it here, same priniple. Also m2ts/EVO can be directly brought into MeGUI but their is no way to join them so be warned and also the time to rip with eac3to is simular to just ripping ....nobody wants their Blu/HD drive working through out a re-encode).
MEGui ( http://sourceforge.net/projects/megui
Note: there are many sub tools that are loaded under MEGui. Those tools are downloaded automatically the first time you launch MEGui. In addition to these you will also need everything you would need to impliment the origional x264 encode above i.e. x264.exe, AVISynth, Graphedit and all the relevent codecs i.e. WMVideo DMO (VC-1), CoreAVC/Cyberlink h264 decoder (AVC) ffdshow or eqiverlent for MPEG-2.
Before you can get to using MeGUI you first need to set it up, go to options->settings and set up "main" as shown below, then go to the "program paths" and set up each of the program paths we are going to use i.e. x.264.exe, Mkvmerge etc ...you can set up all the paths if you want i.e. mencoder, faac etc but they are not required here.
Ok so now are almost ready to get started but first I've been playing with different resizing algs and sharpening filters and have set on a nice combination (thought your encodes looked good well wait till you see this
). You will need:
Undot block noise reduction:www.trbarry.com/UnDot.zip
asharp adaptive sharpening filter;http://ziquash.chez-alice.fr/
Etract both of these and then place the .dll in the AVISynth Plugin folder and you are done (UPDATE: Don't use asharp anymore ...not required, instaid use LancsozResize (see below)).
The first screen of MeGUI looks like this:
Go to "tools" then "AVISynth script creator" and you will get a window like this:
Drag and drop or open normally your mkv and you will be pressented with the folowing:
Once I select my Source mkv file in the AVISynth Script Creator screen I see a preview window. The preview window size can be changed by dragging the window edges. Bigger sources makes the window unwieldy so I would suggest you make it small enough so that you can see the MEGUI interface underneath. Leave the preview window open as we'll be modifying some elements on the preview screen. The Input DAR (Display Aspect Ratio) should be displayed 1.778 in the example. Directly below that is a checkbox for 'Clever (TM) anamorphic encoding', check this and in the opposite dropdown box choose "Resize to Achieve Mod 16". Below that you will see the resize options, you should enter them here i.e. 1280 x 720.
On the "filters tab" choose the spline36 resize filter (If not using asharp use Lancsoz or Lancsoz4 ...will give you just as good results put requires less processing power) and check noise filter, this will give you the sharpest resize with the least loss of detail. I would suggest you always leave "Minimal Noise" selected, even for 'clean' sources. For older source material, I would suggest you select "Little Noise". Anything beyond that can have a noticeable softening affect which you may find unpleasant. Experiment here to find what you see as acceptable. This setting can have a very beneficial effect on Bit Rate usage even when the noise isn't immediately obvious to you. If you suspect that you have an interlaced source then use the "analysis" button first.
The "EDIT tab" allows you to make any final modifications to your AVISynth script before saving it. For instance if you wanted to tweak some of the filter functions, resize it or add an additional filter, etc. We are going to add the "asharp" filter (Note: This step is not required if you are using Lancsoz), at the bottom choose "load dll" and load in the plugin from the avisynth/plugin directory you placed it in at the begining:
Now we add the modline as follows in the following screen (note that I have 20+ tests and (10,4) is the best quality that I have found by my eye ....think you will be pleasently suprized how good your new encodes luck now
1080p eat your heart out).
If you have no other modifications to enter, you can just click SAVE in the bottom right corner of the AviSynth Script Creator window (save to the same directory as your mkv ...for ease). Next you need to supply the x264 encoder with a video profile so across from this click "config". You will be pressented with the following:
Your screen wants to look like mine, obviously change bitrate if you would like. Also check "turbo". Next we move to the ZONES TAB
This tab allows you to specify custom bitrate zones much like MPEG-2 encoders used. Its not required here since the source should be very 'clean' being HD. Just be aware that if you have a problem scene that seems to be getting excessive macroblocking you can tweak that 'zone' here.
The RC and ME Tab has four subsections - Rate Control, M.E., Misc, and Quant Options. These sections contains the guts of the H264 codec. These settings also have a huge impact on the speed that your PC will encode your output. The items of interest are highlighted.
Rate Control section
Leave the Rate Control section at the defaults.
Set your M.E. Algorithm to a minimum of Hexagon. If you have the CPU power I would suggest you set it on Multi-Hex.
I would not suggest you go any higher than '6 - RDO (Slow)'. RDO Level 2 is EXTREMELY slow for very little gain. 6 - RDO is required to use 'RDO for B-Frames' on the Advanced Tab. I would suggest you select 6 - RDO.
Set your Keyframe interval to 10 times your output video's framerate. If your encoding video that is 23.976 frames per second, then set the Keyframe Interval to 240. If you wer encoding video at 29.97 fps, then set your keyframe interval to 300.
For the Min GOP size, set this to the rounded value of your framerate (ex: for 23.976 framerate video set it to 24).
Trellis: Set this to none ... causes slight speed increase with macroblacks but a spead penalty with other operations.
Number of Reference Frames: Set this to from 5 to 8. This value can have a big impact on your processing time. The lower the number the faster the encode. The higher the number the slower the encode, but the better the quality. Note that values over 5 give marginal improvements. You can go as high as 16. Do not set this value lower than 3.
I have included a good set of options for all here ....this will give you a good looking encode without taking days (much experiemntation went into finding these
so I would suggest these as a good referance but please feel free to have a play
For the "advanced" tab use the following:
If you want you can enable some macroblock options but this will slow your encode and as long as the bit rate is not too low you shouldn't really need them. If you detect macroblocking in your encode and decide to use them (unlikely) use all of them to get real benafit.
If you want to save these settings in a new profile rather than overwriting one of the default profiles then click the 'New' button and give your profile a new name. Otherwise, just click the 'Update' button and then click OK.
This will put you back to the Main MEGUI page. At this point, you can begin encoding your video if you like.
Remember your output file should be set to mkv (very limited with mp4) and if you haven't checked "autostart queue" in the setting you will have to go to the "Queue" tab and start it manually. If all goes well you will get a screen like this:
Once its completed
then you need to either go to "tools"->"muxer" to create your full mkv or use GUIDE 2 (More options with mkvmerge) to complete. Happy encoding guys and girls and remember any Qs and I'm more than happy to help.