Final rendering of VHS videos

When finished with filtering and audio editing,
the video will be finally rendered.
Settings for Virtualdub

Preface

The choice of container and codec for image and audio depends on which device the videos shall be played on.

Possible output formats

  1. Standard Video-DVD (needs spezial encoding software)
  2. Computer video (no limitations)
  3. Compressed video that can be played by modern Divx/MP4 DVD players
  4. Compressed video for specific consoles, smartphones, etc.

Variant a) is usually outdated and inefficient.

Variants c) and d) require a precise adjustment to the requirements of the target device (consult manual). Mostly only specific codecs and resolutions are approved. This would affect the quality of the finished video (low bitrate, low resolution). Avidemux is suitable for these cases, which brings profiles for some widespread consoles.

However we will compress the videos as efficiently as possible, but without loss of quality. This could be easier done with Virtualdub.

Final encoding

We will gett the smalest files when using the H264 codec. This codec can be operated easily via GUI with Virtualdub and Avidemux.

Update 2011: I have changed from Avidemux back to Virtualdub.
Avidemux wrongly decodes MJPEG coded gray levels, if they are in the range of 0 … 255 (PC levels). It considers the grey levels to be normed to the range 6 … 235 (TV levels) and then it throws away all values below 16 and above 235.
Configuring the X.264 encoder in Avidemux is a bit awkward, because the standardized profiles are not supplied that we will use.

In Virtualdub you can easily encode with H.264 if the free codec H264vfw is installed. Thanks to its prepared profiles using h.264 with virtualdub is very easy.
The only drawback: With Virtualdub you are bound to the AVI container format, and to the standard audio codecs that are possible in AVI (we recommend MP3 with constant bit rate).
Who wants to put his video in a MKV container can do that later with Avidemux.

H264vfw settings for VHS material
H264vfw settings for VHS material

Typical H264vfw settings
Virtualdub > Video > Compression settings: select h264vfw
Preset: medium
Tuning: grain
Profile: main
Q= 23 … 30

Audio compression
Virtualdub > Audio > Compression settings: select MPEG Layer-3 (MP3)
Resolution: 192 kBit/s (or less)

Explanation of the settings used here (H264 profiles)

A good German description is Brother Jons Encodingwissen.

Compressions templates (--preset)
Compression template make a tradeoff between encoding speed and size / quality of the target video.

medium - for encoding with a moderately fast computer
slow   - needs 40% more processing time and reduces the file size by about 8%

Tuning templates (--tune)
Tuning templates fit the parameters to the type of video material used.

grain - Psy-optimisation for grainy / noisy video,
        if the grain / noise is to be maintained. 
        Leads to relatively high bit rates (larger files),
        but the picture is less blurred.
        Select this for VHS video.
film  - general Psy-optimization for movies.
        If your input video contains noise it will be blurred.
animation  - Psy-optimization for cartoons / Anime.
fastdecode - disable CPU-intensive options for playback.

The grain tuning setting fits well with requirements for VHS recordings, because usually they contain much more noise than typical movies from DVD.
 

h.264-Profile templates (--profile)
Profile templates force compatibility with specifoc H.264 profiles. The H.264 level etc. are not affected.

baseline - Disables B-Frames, CABAC and 8×8-DCT.
           Custom matrixes are not possible.
main     - Disables 8×8-DCT and custom matrixes.
high     - No restrictions.

Videos that are coded with Profile--main will play with all software players and with all common computers.

Comparison of different settings

I rendered a test sequence with different settings. Here are the resulting file sizes, the encoding speed (frames per second, fps) and some remarks on the image quality.

Profile           Q      fps           File size for 1h with 448×336 and MP3 196kBs 
medium grain main q23:   14 fps ---    420 MB -----------------
slow                     10 fps --     390 MB ---------------  -8% size, but encoding is 40% slower
medium grain main q25:   16 fps ---    292 MB ------------
medium grain main q30:   25 fps -----  156 MB ------           Details are blurred out

medium film  main q23:   15 fps ---    280 MB ----------- Details are blurred
medium film  main q25:   19 fps ----   208 MB --------    Details are strongly blurred
medium film  main q30:   28 fps ------ 124 MB -----

Encoding speed and file sizes at different settings.

The first thing you see that compression - slow does not benefits much. One gets 8% smaller file size, but it needs 1.5 times as long to render.
By using the film settings files get up to 1/3 smaller with the same Q factor, but this happens at the expense of quality. The picture got blurred significantly.
The quantize factor Q adjusts the temporal and spacial compression. If the VHS video shows noise you should chose Q=23. When you have sucessfully reduced the noise a Q=25 will be enough. Q=30 should be taken only if audio is more important and the picture does not matter (lectures). The worse the Q-factor, the faster the encoding.

With the same resulting file size I better liked the video that was coded with grain and Q = 25 than that which was coded with film and Q=23.

Link: Example screen shots and temporal resolution with different Q settings

Tip: Before rendering the whole file you first should start a test rendering. Render a short selections of your file with Q=23, Q=25 and Q=30. Compare the visual results.

If you'd like to use Avidemux, look at settings of the X.264 encoder in Avidemux

Alternatives

If you want to encode the videos for a DivX compatible video player, it goes like this:
You have to first look in the manual, which container and what codecs are allowed.

In most cases this typical settings will do it:
Container: Avi (up to 2 GB in size)
Video-Codec: Xvid with Q=3
Audio-Codec: MP3 with 196 kBs or less (or wma, Ac3)

You can easily encode with Virtualdub using the free Xvid-Codec. The resulting files have to be burnt to data DVD (Iso format). (But standard Video DVDs are using UDF format.)

Most DVD players also accept the lower resolutions and scale them to full screen size.

Setting the Q factor for Xvid videos:

Q=2 high quality
Q=3 briefly a bit restless after disturbances, blocks are not visible
Q=4 short block artifacts are visible after disturbances (do not use this)

Using a Q better than 2 makes no sense. Use Q=2 when encoding high quality movies from DVD. For digitized VHS videos Q=3 is sufficient.

[Counter]