# MeGUI/Guides/Basic Guide/Video
## Basic Info

This section is divided into three sub-sections:
* Creating the Avisynth script file for the video
* Calculating the bitrate for the video
* Encoding the video

## Creating the AviSynth file

* Open up MeGUI and start the avisynth script creator from the tools menu
* Set your d2v file as the video input
* If "Input DAR" ratio is a different ratio to the aspect ratio of the preview window, it means the DVD is anamorphic. You can either resize to a non-anamorphic resolution, or keep the video anamorphic by checking the "anamorphic" button. If you encode anamorphic, the video will be stretched on playback to maintain correct Aspect Ratio
    A little info on the three anamorphic modes:
   * "Resize to mod16" will only resize the video if the width or height are not equally divisible by 16.
   * "Overcrop to achieve mod16" do the same as above, but instead of resizing, the video will be cropped.
   * "Encode non mod16" will not resize or crop the video, but if the resolution is not mod16, the compressibility of the video will suffer. This loss is basically negligible unless you are going for extremely high quality encoding.
* If the video has black bars around the edge, you should crop them with the tool.
* If you want to resize your video, check "suggest resolution" and change to the resolution you want. If you want the highest quality file, do not resize.
* Flip over to the second tab. Under deinterlacing, check the "source is anime" box if your source is anime or cartoon, then click the analyse button. The analyser will make one or two passes to determine the optimal filter. Choose whichever option it gives you for deinterlacer.
* Choose your resize filter. Use spline36 unless you know why you should use another.
* Enable denoising and pick the appropriate level. Denoising reduces noise, which makes the image look better (less flickering) and compress better (less flickering = lower complexity). Always enable at least minimal. Medium & High denoising should be used sparingly.
* Use MPEG2 deblocking only if there is noticeable blocking in the source. Very few DVDs need this.
* Save the avs (it should automatically load into MeGUI once you do this) and proceed to the next section.

## Calculating the bitrate

* If your avs file is not loaded, load it now (by clicking the [...] button next to "Avisynth script").
* Open the bitrate calculator in tools. Once it opens, MeGUI should automatically fill in the information such as length and framerate.
* Choose the format and container that your final video file will be in
* Choose your final desired size ("total size")
* Click the "select" button in the Audio 1 area and select the audio file you created.
* The required video bitrate should appear in the lower right corner, write this number down and click apply.
* For more information on the Bitrate Calculator click here.

## Encoding the video

* You should already have the avs video file loaded into MeGUI - if not, load it now (click the top [...] button).
* You have two options for choosing the video format to encode in: XviD and x264. It is beyond the scope of this document to give a large discussion of the differences between these two formats. Suffice to say:
   * XviD is a very popular encoding format - it is used almost exclusively for 'scene' TV and movie rips. It use the MPEG-4 Part 2 or ASP standard. It has been around for a long time and offers a reasonable level of quality for filesize. You can compare it to mp3 in many respects.
   * x264 is a 'new' codec. It use the MPEG-4 Part 10(H.264) or AVC standard. Both new disc formats (HD-DVD and Blu-Ray) will support x264 encoded files, and it looks set to become the successor to XviD. It has not yet reached a large level of support yet, although support and use is constantly growing. It gives better quality than XviD, especially at bitrates under 1500kbits or so.
* To encode in XviD:
   * Select your codec as 'XviD: *scratchpad*', and choose your container as AVI
   * Click the config button
   * On the first page:
      * Set mode to "automated 2pass" and check "turbo"
      * Set your bitrate to the figure you got from the bitrate calculator
      * Set the keyframe interval to ten times the framerate (which you got from DGIndex)
      * Set the VHQ mode to 4.
   * Click OK
* To encode in x264:
   * Select your codec as 'x264: *scratchpad*, and choose your container as MP4
   * Click the config button
   * On the first page:
      * Choose the preset as what you want. Faster the preset, lower the quality. I personally recommend Slower, you only run the encode once and the quality will stay forever.
      * Set mode to "automated 2pass".
      * Set your bitrate to the figure you got from the bitrate calculator
   * Click OK
* Click the 'Queue' button, move over to the tab and click to start the job.
Once you've done this you will need to wait for all the audio and video encoding to finish before you move onto the last step, which is muxing the files together.
Main Page Setup Ripping Audio Video Muxing