Video Encoding (Using MeGUI x264 Encoder)
MeGUI x264 Video Encoding
Published by Wishmaster
15 Aug 2010
|15 Aug 2010||#1|
--Prepare the Video for Encoding--
Step 1 -- Creating an AVIsynth Script
1) Copy the target Source to your HD (DVD or BD)
2) Create the Avisynth script.
This part will be slightly different depending on the Source (DVD or BD) but largely the same. BD will be slightly different and I will cover the differences after the DVD section.
1: Create the Script
FOR DVD Content (AviSynth Script)
1) Click the Tools Tab at the top of MeGUIs main screen and choose "File Indexer"
2) Click the button to the right of the Input File box, and go to the location of the DVD on your HD.
There will be several .VOB files. The one you want is the very first .VOB of a .99GB size.
Once its loaded, please take note of the information it gives you. As you can see in my sample here, it tells us everything we need to know.
this sample is a MPEG2 Video, its Interlaced, and has a 5.0 AC3 Audio track.
3) Once you are ready, Click the Queue Button.
4) In the Megui Main Window, go to the Queue Tab and press the "Start" button in the bottom left. This will start the job.
2: Editing the Script: (Deinterlacing)
Once the DVD has been indexed, you will get a Window that looks like this:
Notice the lines in the image?
These are interlace lines. If you remember from the 1st step, before actually indexing, it already told us the video was interlaced.
1) To de-interlace the video, go to the "Filters" Tab.
2) In the De-Interlacing box, simply press the analyze button.
MeGUI will now decide the best appropriate action.
If you didn't catch whether it was interlaced or not, running an analysis will not hurt anything, just to be sure.
If MeGUI determines the video is progressive, it will tell you and do nothing. So theres nothing to loose by running it.
3) For some DVDs, you may wish to also check the Noise Filter. How strong, is utimately up to you and how much noise the original actually has.
I would recommend either None, or Minimal.
3: Editing the Script: (Cropping and Resolution)
In the I/O tab of the script creator there a few key settings. Primarily the resolution.
1) If you wish to crop your video, crop it 1st.
You can do so manually, or let MeGUI decide with the AUTO option.
2) Resize.You have a couple options here.
A. For Fullscreen, If you do nothing, or simply click the Resize box, MeGUI will encode the video at its native resolution.
In this case 720x480.
->However, I would recommend using the "Suggested Resolution Mod16" option. this will keep the video in multiples of 16, that the x264 can handle much more efficently.
B. If the source is a Widescreen 'anamorphic"
Then use the Clever Anamorphic option. the x264 encoder will encode the video as a anamorphic encode.
You find this information on the back of the DVD case.
4: Editing the Script: (Resize Filters)
1) Choose your desired resize filter.
In the in Filters Tab, in the bottom box, you'll see Resize Filters.
These are different methods the encoder will use to resize the video.
Some have a softening effect, some neutral, others a sharpening effect.
I prefer Lanczos myself.
It is a sharp resize filter, meaning it tends to sharpen the image.
The downside is it can also produce haloing, or a "ringing" effect if the bitrate is to low.
This one is best suited for original resolution or smaller.
Lanczos4 is quite similar, but I find it is more suited to 'upsizing".
If your going for really low bitrates, you will be better off using a soft or neutral resizer, such as Bilinear
5: Upscaling the Resolution (Optional)
You can also "upsize" if you so choose. Although we can not do that from here.
Lets say we have a 'anamorphic" Widescreen Source.
1) Crop the black bars so that we are left with a 720X400 image. (16x9)
2) Go to "Script Tab" and edit your resolution manually as shown below.
Remember, if you choose this option, you will need to raise your bitrate to comply with 1280x720 or 1920x1080 resolutions.
I would also suggest the Lanczos4 resizer for upsizing DVD content.
Personlly, I would not upscale DVD to 720 or 1080P resolutions.
Although there are little gains, the final file size and bitrate required make not worth the effort.
For Widescreen DVD, one option I find works well is this.
Create the script as normal, using a mod 16 resolution, and Lanczos4 resize. Change the resolution to 768x432.
For a Widescreen DVD this works out well, because:
1) Its technically not upscaling the video. Its just as many pixels as the original 720x480 anamorphic (just a bit less actually)
2) The resolution is a true 16:9, 1.778 aspect ratio.
*Note: Some changes may require you to hit the "Preview AVIsynth Script" button to see the changes.
Once you are satisfied with your script press the "SAVE" button.
Once you save the script, MeGUI will save it, and reopen the edited script.
FOR HD Content (AVISynth Script)
For HD content, creating the script is much the same. However some differences.
You will not be indexing the source for instance, UNLESS it is a MPEG2 source.
1) Go To Tools, HD Streams Extractor
2) For Input, browse to the location on your HD where the disc was saved.
The target folder should be the Stream folder. (Inside the BDMV Folder)
The stream extractor will parse the info and give a list of titles in the folder.
3) Select the main title. It will give you all the information you need.
Video Codec, Audio Codec, Subs etc.
4) Extract the Video Source as MKV. And the Audio Source as AC3, or DTS if you prefer.
(Only choose DTS if you plan on keeoping original audio. otherwise, just convert to AC3 now)
5) If you want the option open to create a AVHD disc in the future, and wish to retain the original Chapters extract them as well.
If you use the Auto Encode option, MeGUI will encode Video/Audio and mux it into the container of your choice. if you wish to add the original chapter list, simply queue the Video and Audio (if it applies) jobs seprately, and manually mux into a MKV container. You will then have the option to add the Chapter list.
6) Once you make your selection and file type choices, Queue the job and run it from the Queue Tab in MeGUI.
NOTE**If the target was MPEG2, at this point you would Index the MKV file using File Indexer, just as you would a DVD.
Then Skip to step 8. Otherwise, Continue on..
7) Once extracted, at MeGUIs main screen, go to TOOLS, AVS Script Creator.
8) Browse to the MKV file you just extracted and open it.
9) HD content is 24FPS Progressive, so there will be no need to de-Interlace (Unless 1080i)
Just simply downsize to 1280x720, or keep the 1920X1080 resolution whichever you prefer.
Also, denoising HD content is not needed.
IMHO, theres not a huge difference between 720P and 1080P, especially if being viewed on 46" or smaller screen.
Whatever route you decide, keep in mind, Higher bit rate 720P will not only be smaller, but will look better than a low bit rate 1080P.
1080P is just over double the amount of pixels.
Step 2 -- Audio
Decide wether you want to use the original Audio, or compress it.
If you choose to compress you have 2 options.
1) Aften AC3. This will recode to AC3.
The best use, IMHO, for this is if you want to down size a AC3 640 audio file to 448 5.1 surround to save some space, or comaptability reasons.
Convert 5.1 surround to a lower bit rate stereo AC3 file.
Anything lower than 448 for AC3, you are better off just using NeroAAC.
2) Nero AAC. this is actually a very good quality audio encoder with Excellent compression, and can be 2.0 or 5.1 channels.
Also, Nero LC 96kbs, is the one you want to select.
Then raise the bit rate in the options menu. For 5.1, I would set it for at least 285kbps up to 448 if you wish.
Nero HE & HEPS are low bitrate (high effeciency). Up to 96kbps.
With the Nero AAC codec, you can choose to keep the original channels, or downmix to stereo.
I wouldn't use the "normalize" option however, as its just a 1 pass solution and doesnt seem to work that great. At least to me.
But to each their own, if you like it, use it
Aftens Setup is Quite Similar:
Step 3: Setting Bitrate
Since we already covered the x264 settings in the first part, no point going over it again.
But, I want to cover a bit about the bitrate calculator..
Previously I mentioned setting the MeGUI defaults to whichvern conatiner you prefer (MP4 or MKV) as well as "No Target Size" .
If you have a file size you wish to hit or just wish to see about how large the file will be:
Go to Tools, and choose "BitRate Calculator"
The bit rate calculator is an excellent tool to get an idea of the final File Size, as well as to adjust the bitrate to hit a target size.
Most of the info should be already be loaded from your setting in the main MeGUI window.
Double check the bit rate of audio, and the file type matches. (Output target) as well as the length of the film.
To estimate the file size for your current settings:
In the Video Bitrate, put in the bitrate you wish to use and MeGUI will estimate the fianl file size at those settings.
To specify a certain File Size:
Choose, "Total File Size" and manually put in what size you wish the file to be. MeGUI will then calculate what bitrate will be needed to hit that goal.
Also, you can experiement how the different containers will impact the final size.
For example, MP4 containers have slightly more overhead than a MKV. (usually just 1 or 2MB)
And MT2S containers will have a couple hundredMB overhead, depending on the length of the video.
Once you have decided what bitrate you need/want, go back to MEGUI main screen.
Press the "Config" to the right of "Encoder Settings" and put in the desired bit rate.
(if you did not choose to have it automatically set in the bitrate calculator)
If file Size is not a concern, put in any value you see fit or that I recommended earlier.
Step 4: Encoding the Video:
-->If you have chosen to compress the audio, all you need to do now is simply hit the "AUTO ENCODE" button in the bottom right corner.
1) In the windows that pops up, double check you container preference.
2) If all OK, Press Queue.
3) Then in the Queue Tab, press start.
When MEGUI is finished, you will have a playable MP4 or MKV, whichever you chose.
--> If you are keeping the original Audio Stream
1) Change the File Format to RAWAVC
2) Press the Enqueue button, in the Video encoding section of the main screen.
3) In the Queue tab, Press the Start button to begin encoding.
When MeGUI is finished, you will have a H264 file in the destination directory you choose.
3) In tools, go to Muxer, and choose MP4 or MKV (whichever you prefer)
Video Input = the H264 File you just encoded.
Audio = the original Audio Source.
4) You can also name the final output now, as well as additional settings such as languages.
5) Press the Queue button
6) Go to the Queue Tab in MeGUIs main windows, and press start to begin muxing the file.
Some may wish to have the BluRay content as a lossless file rather than downsizing or compressing the video.
To each their own, and fortunately for those who wish to do this, there is no extra software needed.
MeGUI has all the tools we need.
Simply follow the steps to extract the HD Video and Audio Streams as if you were going to encode the Video.
When the streams are extracted, go to Tools Menu & open MKV Muxer
In the Muxer simply add your video Stream and Audio Stream.
Mux them together and name the file.
You now have a lossless copy of the disc in the form of a MKV file
There may be occasions when you want to cut part of a film. Either the beggining, or perhaps the credits.
If for whatever reason you wish to do this, this is how you use BeSplit.
1) From the Tools Menu, open AVS Cutter.
2) Browse to and open your AVIsynth Script.
3) You will now have you Script Preview Window open again.
You can play, Stop, Pause or seek anywhere you wish.
4)Once you find the point you want the video to start at, press the "Go To Frame" button and copy that frame number to the AVS Cutter Window.
5)Repeat for the frame number you want the video to end at.
6) Now that you have your start point, and end point Press the "Add Button"
7) Next Press the "Add cuts to scirpt" button. (This will add the cuts to the video itself.
8) Press 'Save Cuts File"
You can now close the AVS Cutter. We are done with the video part.
Next, Go to TOOLS, and choose Audio Cutter.
10) Here, the input file is the original, unaltered audio file.
11) Add the cut file, the one we just made in the previous step.
12) Name it something so you know which Audio File it is. Such "CutAudio"
13) Next Create Job, and then go to the Queue tab in MeGUI and start the job.
If you are recoding (or compressing) the audio, once you have your cut audio file is created
you can now add it in the MeGUI main Window, in Audio Input Section (in place of the original audio stream)
And thats it for BeSplit
If you wish to make a backup of your HD video, and followed the AVCHD guidlines, you can seem my AVCHD Disc Tutorial here:
AVCHD Disc (How to create)
Keep in mind that not only are Encoder settings important, but final file sizes as well. More info in the AVCHD tutorial.
I know this doesn't cover all the details, but it should cover the basic principle.
MeGUI can be quite overwhelming at first, and there is a lot to learn. Especially if you are just learning.
I hope that this actually helps make it easier to get the hang of, and not just more confusing.
If anyone has any questions about MeGUI that I have not covered feel free to ask and i will do my best to answer.
|My System Specs|
|16 Aug 2010||#8|
Thank you all
You are correct. there are easier ways, and faster as well for encoding time especially for DVD.
From my own experience, this yields much better quality. At least to my eyes.
Particularly for HD content.
For example, the settings I have recommended here: For a 1hr 45min film, Downsizing from 1080P --> 720P at a 5500bit rate will take approx. 6 - 6 1/2hrs encoding time on a 3.6Ghz Quad Core (Core2)
DVD is obviously faster as lower res.
But faster encoding times are not always a good thing.
Because, keep in mind, the faster the the encoder runs through the process, the less accurate the result will be. Especially in complex scenes.
If you have any questions, I will do my best to help out.
|My System Specs|
|28 Aug 2010||#9|
Great guide. I've been looking for something this step-by-step since last year when I bought my HD camcorder. Really an excellent guide.
However, I feel that some of the settings are a bit aggressive in terms of the kind of encoding I am doing. Most of videos I shoot are just casual family/friend videos and I don't have an overwhelming need to make sure the quality is as close to lossless as possible. What does matter is encoding time, and while I realize that this guide is trying to make the best looking encoded videos, I need to pump out multiple videos in a short amount of time.
What settings can I bypass or change so that I'm not encoding at 18fps? I am running an i7 875k overclocked to 3.86ghz and from various benchmarks (anandtech, legitreviews) most people get an average of 29fps on their 2nd pass at stock speeds with the same processor.
I imagine changing from the "very slow" setting to "medium" or "fast" would help? Also how about all that stuff in frame-type, rate control, analysis, etc.?
EDIT: Also, I download a lot of HD music videos and I like re-encoding them into smaller files to put on my phone (Samsung Captivate). A lot of these videos are Xvid encoded, some MPEG-2. Can I pretty much follow the same procedure? I've been making AVISynth scripts directly using the Xvid encoded videos, but the resulting video seems to be overly bright.
|My System Specs|
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 03:25.