MeGUI H.264 Conversion Guide

Original Page URL: http://www.digital-digest.com/articles/MeGUI_H.264_Conversion_Guide_page1.html
Author/Publisher:
Date Added: Nov 24, 2006
Date Updated: Jan 9, 2010


MeGUI is one of the newer tools that has been designed with H.264 encoding in mind, while supporting other types of conversion, such as XviD. This guide shows you how to encode a H.264 (MP4) using MeGUI from a DVD as the primary example (instructions for converting other types of video files are also included).

Update: There is now a version of this guide for encoding Xbox 360 compatible H.264 files, also using MeGUI. Read our Xbox 360 H.264 Conversion Guide to find out more.

This guide is aimed at intermediate users, basically users that are familiar with DVD conversion/backup and want to experiment with H.264 and MeGUI. As such, basic knowledge of DVD ripping and conversion is required, although brief instructions will be provided in any case.

Software you'll need (all freeware):

Step 1: Installation

If you're using Windows XP, the first thing you need to do before you can even install MeGUI is to download and install Microsoft's .NET Framework version 2.0. It's a fairly large file and installation could take more than half an hour. If you're already using Windows Vista or 7, then the .NET Framework 2.0 is already installed.

The next thing you need to download and install is AviSynth.

If you're using Windows 7, because Microsoft now includes their own codecs pre-installed with the OS, this interferes with the way MeGUI works and you'll need to install compatible codecs (for example, ffdshow) and use the Preferred Filter Tweaker for Windows 7 to change the settings so that the Microsoft codecs won't be used within MeGUI. You can download and install ffdshow (remember to choose the 64-bit version if you're using 64-bit Windows), and then you can download and run the Preferred Filter Tweaker for Windows 7 tool individually, but if you're starting with a brand new Windows 7 system, you might want to install the K-Lite Codec Pack, which works well with MeGUI (I recommend the Full version of the codec pack). If you're using 64-bit Windows (Vista or 7), then you should also download and install the K-Lite 64-bit add-on pack after you install one of the K-Lite packs (Full or Mega). The advantage of using the K-Lite pack is that it installs both ffdshow and the Preferred Filter Tweaker for Windows 7 tool, and in a configuration that is tested to work well.

In any case, once Preferred Filter Tweaker for Windows 7 has been installed, start the tool and in the section where you configure the preferred DirectShow decoding filters for Windows 7, you need to make sure at least the "H.264" option is set so that ffdshow is used, instead of the Microsoft codecs (for those experimenting with VC-1, you need to set its settings to ffdshow as well). If you're trying to load or encode any video format in which MeGUI appears to hang, or give you an error in relation to AviSynth, then you can come back to this tool and ensure the video format is using the ffdshow codec, and not the Microsoft one. Press "Apply" to apply the changes and then exit the application.

Preferred Filter Tweaker for Windows 7


You can now go on and download MeGUI.

Install MeGUI. Start it up and most likely, it will prompt you to update the software used by MeGUI - click "Yes" to launch the update Manager.

MeGUI: Update Prompt


MeGUI: Updater


Press the "Update" button to start the update process - MeGUI will automatically download and launch the install for the required software. Note that when MeGUI asks you to import H.264/XviD/Audio/... profiles, right click and select "Select All" to import all of them (overwrite existing ones if asked). You will most likely get a "1 file had problems" error, this is because the "neroaacenc" software cannot be downloaded automatically from MeGUI. To download it, go to this page, and download the ZIP archive. There are several files in the ZIP archive, but the files we need is NeroAacEnc.exe. Extract the .exe files to your "megui\tools\neroaacenc" folder (eg. "c:\program files\megui\tools\neroaacenc\win32\neroaacenc.exe"), creating one if it does not exist.

When all the updates are completed, you can now close the MeGUI updater.

If you've extracted neroaacenc, you might need to access the "Settings" option from the "Options" menu, and go to the "External Program Paths" section. For "NeroAacEnc", use the browse button to locate where you extracted the neroaacenc executable file (eg. "c:\program files\megui\tools\neroaacenc\win32\neroaacenc.exe"). Press "Save" to close the settings window.

Also, MeGUI often doesn't update to the latest x264 version, so you will have to do this manually. First, from within MeGUI, go to the "Tools" menu and select "Settings". Go to the "Program Paths" section and see where MeGUI accesses the x264.exe file.

Then go to our x264 software page and check the latest version - if it is newer than the version listed in MeGUI, download and save the x264.exe to where MeGUI accesses the x264.exe file to replace the old file (usually c:\program files\megui\tools\x264\x264.exe - you might want to keep a backup copy of the old version of x264, just in case the new version isn't compatible with MeGUI). Note that a 64-bit version of x264.exe is also available to download here.



Step 2: DVD Ripping

If you are using a commercial DVD, you will need to rip the DVD to your hard-drive. Because ripping a commercial DVD may be illegal in your country, we won't cover these steps here.



Step 3: D2V Creator

For more information on all the settings of MeGUI, please refer to the MeWiki website.

This step will use MeGUI's D2V Creator tool to create a D2V file needed for MeGUI/AviSynth to handle MPEG-2 files. This step is required only for MPEG-2 files - all other types of inputs do not require a D2V file and can be loaded straight into AviSynth and therefore, you can skip this step and go to the next page/step (Step 4: AviSynth Script Creator).

Start MeGUI. I like to first clear the job queues of previously finished jobs. This is optional, but it might help to make things clearer. To do this, click on the "Queue" tab and then click on the "Clear" button.

From the "Tools" menu, select "File Indexer". In the "Input File" section, load the first VOB file of the movie titleset (the rest of the files in the set will be loaded automatically - if not). You will get an error message about not being able to find DVD Decrypter generated info files, this is fine (as we did not use DVD Decrypter's IFO mode) and press "OK" to skip this error.

MeGUI: D2V Creator


Select which audio track(s) to demux - you can select more than one track if you want the encoded file to have multiple audio tracks. Alternatively, you can just select the demux all the tracks and then choose the correct audio track(s) later on.

The default save directory is the same directory as your loaded DVD VOB files - change this if you want to. Select both the "On completion load files", "and close" checkboxes and press the "Queue" button. You are now returned to MeGUI - click on the "Queue" tab and press the "Start" button to start the D2V creation. When processing has finished, the status of the queued job will read "Done" and the created D2V file will be loaded into the AviSynth Script Creator ready for the next step. This can take a while, so please be patient - the status window's progress bar may not move, but don't worry, DGIndex is working.

Please note that if for some reason MeGUI refuses to process the VOB series (only processes the first file in the series), then you may have to use DGIndex manually to create the D2V file. This guide can help you do so, and DGIndex is already included as part of MeGUI under the "Tools" folder (for example: C:\Program Files\MeGUI\Tools\DGIndex\).



Step 4: AviSynth Script Creator

For more information on all the settings of MeGUI, please refer to the MeWiki website.

This step will use MeGUI's AviSynth Script Creator tool (Tools -> AVS Script Creator) to create an AviSynth script. If you followed Step 3, the AviSynth Script Creator tool should already be started with the D2V file created loaded. Otherwise, you'll need to load the media file you want to convert into the "Video Input" section.

AviSynth is able to open almost any video file that you are able to play with a Directshow based multimedia player, such as Media Player Classic or Windows Media Player. You may need to select the "All Files" option when opening the file to be able to see it (eg. FLV files). In most cases, you'll need to install a video codec, an audio codec and a splitter filter for the format you wish to convert.

For example, if you want to convert FLV files using MeGUI, you will first need to make sure you have the required video, audio and splitter filters to make FLV files playable in Windows Media Player. Instructions on how to do this can be found in the FLV playback section of our YouTube, Google Video Download and DivX Conversion Guide.

The "Input DAR" is the aspect ratio of the input video. In most circumstances, it should be automatically set for you. Anamorphic DVDs will be set to "ITU 16:9", for example.

Press the "Auto Crop" button to remove the black bars from the input video if it has any (most widescreen DVDs will).

Next, check the "Suggested Resolution" checkbox and change the resolution to one that you require. For DVD conversion onto a single CD (700 MB) using H.264, you can get away with using the maximum resolution (720x***). If you have specific requirements, such as conversion to iPod/PSP compatible files, please make sure the resolution you select matches your playback device's capabilities.

MeGUI: AviSynth Script Creator


Click on the "Filters" tab. For films on DVDs, you usually do not need to run a deinterlacing analysis. If the content you have is TV based, then you might need to click on the "Analysis" button to see if the video requires de-interlacing. Select "Source is Anime" if that's what you have.

MeGUI: AviSynth Script Creator


Again, if you followed my advice for keeping the resolution for DVD sources, then you don't need either the resize of the noise filters. Otherwise, if you chose to reduce the resolution, then you can choose how the resize will look like ("Bicubic (Neutral)" is recommended as a middle of the road choice). If the source has lots of noise, you can choose to enable the noise filter and choose how much noise is present in your source. The other options can be left alone ("Colour Correction" is automatically checked for D2V input sources).

If your source is not DVD, then you can click on the "Edit" tab and edit the AviSynth script manually to enable audio (you don't need to do this with DVD sources if you have followed this guide, since we have already demuxed the audio using D2V Creator). Simply change the "audio=false" entry to "audio=true".

MeGUI: AviSynth Script Creator


Make sure the "On save close and load to be encoded" option and press the "Save" button to save the AviSynth script (by default, in the same directory as the D2V file, the filename is not important). Don't worry too much about the AviSynth Script Creator tool's preview window - it can be a little buggy where cropping and resizing and concerned. After saving, the AviSynth file should be loaded automatically into MeGUI - MeGUI's preview window does work fine and please make sure the video looks alright, especially for DVD sources with cropping/resize.



Step 5: Video Encoding Options

We'll now set up the H.264 encoding options in the x264 encoder. This step has the most options to configure, and too many to cover in this guide alone. What I'll recommend is to use one of Sharktooth's profiles, and if you need further explanation of the options, refer to our x264 Options Explained article.

In the MeGUI "Input" section, select one of the "x264" profiles for the "Encoder setting" option. We do not need to set a container as we will do that later using the "AutoEncode" function.

MeGUI: Video


As for which profile to select, a full explanation of what each profile is used for can be found on the official forum thread for the profiles. The "standalone" set of profiles offer the most compatibility with standalone players, like Blu-ray players or even game consoles like the PS3 or Xbox 360. You can click on the "Config" button to manually configure each profile, although it's not necessarily unless you know what you're doing.



Step 6: Audio Encoding Options

Now it's time to set up the audio encoding options. If you've followed this guide for DVD conversion, then the demuxed audio track we selected in the D2V Creator should already be loaded in (if not, load in the .ac3 file that was created). If you are not converting from a DVD source, then you can either load in a separate audio file or if you edited the AviSynth script (set "audio=true"), then load in the AVS file into the "Audio Input" section (meaning both video and audio inputs are the same AVS file). If you want more than one audio track, right click on this audio aread and select "New Track". If you changed your mind about including an audio track, click on the "X" button to remove the audio from being included.

MeGUI: Audio


Now we select an audio codec to use. I prefer AAC audio, especially with H.264 as video - AAC is to MP3 what H.264 is to DivX/XviD, better compression + better quality. So which audio codec should you use? I prefer Nero AAC (Nero Digital), so select it if you agree with me. We can now choose a "Nero AAC" profile for the "Encoder settings" option. "NDAAC-LC-96Kbps" is the one I like, as it will give you roughly the same quality as a 128 Kbps MP3 file and using LC, it retains maximum compatibility with standalones. Alternatively, you can click on "Config" and modify any existing profile, and then save that as a new profile (in the screenshot above, I've created a new "NDAAC-LC-128Kbps" profile.

For more information on AAC audio options, please refer to this MeWiki page or this Wikipedia entry.


Step 7: Cutting, Bitrate Calculator and AutoEncode

If you wish to cut your input so that you don't encode the entire video, it is possible to do this using MeGUI's AVS Cutter tool. To launch it, go to the "Tools" drop down menu and select "AVS Cutter". You will be asked to load in your AVS file (the one generated in Step 3) - do it.

MeGUI: AVS Cutter


MeGUI: Preview Cut Position


What's going to happen here is that a list of "zones" need to be added. Each zone has a start frame and an end frame, and all frames in between will be kept (and all frames outside of the zones will be cut). You can either manually enter the desired frame number into the "Start Frame" and "End Frame" input box of the AVS Cutter tool and then press "Add" to add the zone, or use the video preview to skip to the appropriate sections and press the "Zone Start" and "Zone End" buttons to set a start/end frame, and then the "Set" button to add the zone to the list. If you specified multiple zones, you can also specify a transition between the zones (fade is the default setting). Once you are all done, press the "Add cuts to script" button and the cuts will be added to your AVS script. Press "Close" to close the "AVS Cutter" tool.

Press the "AutoEncode" button to launch the Automatic Encoder setup windows.

MeGUI: Automatic Encoder


This is pretty straight forward - just specify the output size of your video file either as a file size, or as an average bitrate and make sure the Container is set correctly, to "MP4" for the purpose of this guide. Note that certain profiles, which are based on quantizer selections, do not let you set an output file size (for the Xbox 360 or PS3 profiles, only the "2-pass" profile allows you to set the file size). For AVI/DivX/XviD conversion, you can get the same quality video at roughly 80% of the original AVI/DivX/XviD file's filesize. For 720p/1080p QuickTime HD (MOV) files, these are already using H.264 so you should try and match the file size whenever possible. The output location can be changed as well - this file will be the final output file that you want, so make sure you remember where you put it and don't accidentally delete it when cleaning up (I like to put this file in a different folder to all the other files, just in case). Press the "Queue" button and all the necessary jobs will be added to the encoding queue.

Click on the "Queue" tab and all the jobs should be listed there. Below is an example job queue where I have two video clips "tdk" and "seu" to be encoded, an explanation of the queued jobs shown in the screenshot below:

  • job1: Encoding audio track for clip "tdk"
  • job2: Encoding video, 1st pass for clip "tdk"
  • job3: Encoding video, 2nd pass for clip "tdk"
  • job4: Muxing audio and video to MP4 for clip "tdk"
  • job5: Encoding audio track for clip "seu"
  • job6: Encoding video, 1st pass for clip "seu"
  • job7: Encoding video, 2nd pass for clip "seu"
  • job8: Muxing audio and video to MP4 for clip "seu"

    MeGUI: Queue


    New in MeGUI 0.2.6 or above is the idea of "workers". This has been introduced to take advantage of multi-core processors, allowing parallel job execution (processing more than one job at a time). Of course, certain jobs are dependent on another previous job being completed before it can begin (for example, job2-4 above requires job2-3 to be finished, and job2-5 requires all previous jobs to be finished), and so parallel execution is not always possible. But if you are encoding multiple video clips at the same time, then parallel execution allows each core of your CPU to be fully utilized at all times, allowing up to 4 video encodings at the same time on a quad core processor, for example. In essense, each "worker" represents a CPU thread that can be run on an individual core - so if you have a dual core processor, then you might want to create two workers, quad-core => 4 workers, etc. Even if you have only a single core CPU, you will still need to create at least one worker before MeGUI can start encoding video. To create a worker, from the "Worker" menu, select the "Create New Worker" option and then enter a name for this new worker.

    MeGUI: Create New Worker


    Create as many workers as you need (again, 2 for dual-core, 4 for quad-core ...). You can right click on each job to specify which worker it will use, or you can leave it unset and MeGUI will automatically assign workers (recommended). You only need to do this the first time you use MeGUI, as worker settings are remembered.

    MeGUI: Send to Worker


    When you are ready to start encoding, press the "Start" to start the encoding. For the above job queue example where I had two video clips "tdk" and "seu", when I press the "Start" button, both encodings will start with different workers, thus allowing me to encode two video clips at the same time (which would only be of benefit if you have multi-core or multi-CPU setups, of course). You can view the status of your workers by selecting the "Workers Summary" option from the "Workers" menu.

    MeGUI: Worker Summary


    When it's all finished, your MP4 file should be ready. You can delete all the other files, unless you plan on making more encodings from them.

    We're done :)



About Digital Digest | Help | Privacy | Submissions | Sitemap

© Copyright 1999-2011 Digital Digest. Duplication of links or content is strictly prohibited.