video encoding&cleaning

Encoding with Xvid4PSP

The naming of this application is a bit misleading (which may be the cause of it being so little known) - it is neither restricted to Xvid nor specific for PSP. Instead, it is a general purpose video (and audio) encoding application, with a very versatile batch handling.
What it cannot do is logo removal, encoding with multiple audio tracks, and some special filterings. This is why the VirtualDub/X264enc solution is still needed. But for the bulk of TV recordings and other recompression tasks, Xvid4PSP offer a very quick and good solution.
Here I feature the version 5 only. A version 7, with a totally changed user interface, is in the making, but still beta for a long time. I couldn't appreciate the new interface so far, and many of the features of version 5 still appear to be missing or unaccessible, so I stay with version 5 for the time being.


Xvid4PSP comes as a self contained all-in-one package that just copies itself into a program folder. Apparently it changes no system settings, except that it wants to install the latest runtime packages of visual studio etc., which is OK but may be skipped if you already have them installed.

For TV recordings, I recommend recording as transport stream, both for MPEG2 and h264 (HD) transmissions. These can easily be cut with SmartCutter. Very simple cuts (start/end) can also be done with Xvid4PSP itself, but only if audio is recoded. I prefer using the original audio, as recompression here won't render much smaller files anyway, and always has a potential for quality loss.

Codecs: hard to find a general solution that fits all. But the Shark advanced codecs pack finally appears to be recommendable. No problems so far, testing this for a year  (note: contains adware; to avoid this, you may unpack the installer with 7zip or similar and then run the file advanced.exe only, for installation).

Some of the program's default settings happen to be quite opposite to my preferences. This of course depends on what you want to do with it. Here are some hints that may perhaps be helpful.

For the video preview to work, I had to use these settings. this may be different on other machines - just try.
Auto joining sequentially named files is good for DVD sources. For other sources, it may  be the exception.
The volume would be normalized by default (only with re-encoding). You may want to turn this off..
Auto cropping is default in some encoding software, but In think staying with standard video formats is better. If there really is a source with superfluous black borders, it should also be resized to a standard format, using a good resizer such as Lanczos..
The interlace analysis may sometimes be useful, but normally one knows the format. The analysis can be run manually as well, if needed. But it is not so reliable. If you want to know if there is interlacing, better open the source with VirtualDub at 100% scale and scroll through the video, looking for comb edges. If yes, one knows that TV is TFF field order and DV (digital tape camcorder) is BFF.
Some more settings suggestions..
Some more settings suggestions..
A very convenient feature is the inheriting of format settings for batch encoding. Simply open a file in a folder, set the right formats, the select "File, Open Folder" from the menu, and all files in that folder will be enqueued for encoding, using the same formats. You can preselect which format details to inherit and which to leave.
I experienced problems with the default AC3 decoder - it stopped encoding of audio after the first second or so, leaving the rest of the file mute. Using the default DirectShow filter is a good alternative, especially if you have installed a good codec pack.
Normally, just copying is a good choice for audio; There is no big gain in compactness with re-encoding.
If you want to cut with Xvid4PSP, you need to re-encode. A compact choice of a format is AAC. There are several choices, I would normally take the one shown here...
... and use the settings (wheel) button to tweak it a bit. Q.50 is OK for normal users, audiophiles may want more.
The current standard for compact and as well high quality video is AVC (h.264).
The default settings offered here are extremely quality biased. They take long computing times even on fast machines (I'm talking on quad core at 4 GHz).
Here is a simple tweak for speed and size: slider set to 'fast', Q to 25 (higher value means less quality).
I checked this frame by frame for several HD TV sources an couldn't find visual differences. The H.264 encoder is really very good and I even use medium and Q 28 wherever quality is not very important. 
With SD sources on an HD TV set, or with very crisp HD sources, there is a small gain in crispness perceivable with a lower Q values.
22 to 25 are good choice in this case. Going to 20, the file size grows over proportional; can be considered master quality..

There are several choices for the output container.
MKV is the current standard and supports virtually any kind of video and audio stream formats.
Note that .MP4, e,g, should be avoided: It has a limited allowed file size.
Many sources, TV in particular, may have interlacing and/or anamorphic aspect ratios. You may very likely want to allow these (this here is the settings window of the MKV format).
Interlacing is a nuisance. Standard full HD TV, alas, is 1920x1080 interlaced. You may want to change this to progressive, double frame rate to keep the motion resolution. This can be done as shown here.
But be aware it produces larger files, and some players can't cope with 1920x1080 progressive.

Many TV sources transmitted in full HD are really not full HD at all.
In this case. stepping down to 1280x720 using a resizer like Lanczos, which delivers a very crisp result, may be a good choice with no compromize in quality, especially if also the frame rate is doubled as shown above..

More settings
The cropping and black framing functions   are very useful for eliminating black or unclean borders, news tickers etc. They are simple enough not to require a lot of explanation. Be aware, though, that yo may sometimes have to switch to the 'manual'
 settings tab and back, in order to enforce what you intend. The settings fields are partly a bit too automated and stubborn in their behavior.

The frame rate setting has an option "convertMFlowFPS". This generates intermediate frames based on motion vectors. Although not perfect and quite time consuming, it delivers really good looking results (e.g., upconverting from 24 to 25 or 50 fps).
Note: if you want to remove logos from videos as well, do this first, in a separate step, with Virtualdub2 (as described below), an then convert the framerate separately. This is due to the fact that the motionflow conversion may produce little artifacts around logos if the image content moves behind them. 
If the original source is a 'fake' 50 fps, for example, just containing every frame from an original 25 fps souce twice, you can eliminate the extra frames and generate true intermediates concurrently.

Batch hints
You may add files for batch encoding at any time, with the Enqueue button, even after the batch has been started (with the Encode button).
You may therefore continue to work on setting up files, even change the settings for the jobs already in the queue (by double clicking on them), change the job sequence, etc.

Normalizing audio
Some sources have audio levels greatly deviating from normal. The settings shown here will normalize the average track volume to -6 dB, which is a most common level. If and when to apply is selected via Settings / Auto Volume.

Multi audio
Xvid4PSP does not support multiple audio tracks, but if you do not cut with it, you may add more tracks to the compressed file from the original source. In case of MKV, the tool for this is MKVtoolnix. More on this here.
An encoding alternative here is Avidemux from version 2.7 on, which can handle up to 4 audio tracks at once. It has less features however and its batch processing is more cumbersome to use.

What about de-logo?
Unfortionately, Xvid4PSP cannot read signpost files from VirtualDub (more here). The only way of transfer without a quality loss would be saving the video from VirtualDub either uncompressed, or with Huffyuv (not in YUY2 mode!), both producing extremely large files. But that woluld be some overkill.
A very high quality can be retained with motion JPEG, PICmjpeg for example.
My best recommendation is doing de-logo with  Virtualdub2, with x.264 encodig at constant quality Q=20, and saving the video in avi format, if further processing with xvid4psp or other software is intended. If nothing but de-logo is intended, Virtualdub2 can readily be used to save an mkv video with x.264 or others, and audio encoding, at any Q setting.

Xvid4PSP has a filters selection pane, apparently showing a number of AVIsynth filters, Alas, the explanation popups are all in Russian.
More useful is the color correction option in the video tab:
It can show histograms in the video window, very useful for a correct contrast / color contrast setting.  But beware: you must switch the histograms off before encoding, or they are encoded into the video!
Also take care to reset the color corrections to default before the next job,as they stay persistent!

Avisynth tricks (example: 3D side swapping)
Menu select "Avisynth-Edit filtering Script", or, just type "S", and you can add anything Avisynth can do for you. Just insert your script sniplet at the right pace. The following example swaps sides of a Side-by side encoded 3D video (added lines are bold):

Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\AudioFunctions.avs")
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\functions\VideoFunctions.avs")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\FFMS2.dll")
Import("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\FFMS2.avsi")
LoadPlugin("C:\Program Files (x86)\XviD4PSP 5\dlls\AviSynth\plugins\bass\bassAudio.dll")
video = FFmpegSource2("F:\3D\My_Film 3D-SBS.mkv", rffmode=0, threads=1, cachefile="D:\Temp\My_Film 3D-SBS.mkv.ffindex").AssumeFPS(25.000)
audio = bassAudioSource("D:\Temp\1893_0.aac")
AudioDub(video, audio)


ConvertToYV12(interlaced = true)

Final remark
Xvid4PSP has many more features. This here is not intended to be comprehensive.

Note one annoying "feature": if there is any subtitle file (.srt e.g.) with the same name as the source file in the same directory, Xvid4PSP will hardcode the subtitles into the video!  You can switch this off, but  you have to do this again and again for any file you encode.

Copyright (C) 2015; all rights reserved. All materials in these pages are presented for scientific evaluation of video technologies only. They may not be copied from here and used for entertainment or commercial activities of any kind.
We do not have any relation to and do not take any responsibility for any software and links mentioned on this site. This website does not contain any illegal software for download. If we, at all, take up any 3rd party software here, it's with the explicit permission of the author(s) and regarding all possible licensing and copyright issues, as to our best knowledge. All external download links go to the legal providers of the software concerned, as to our best knowledge.
Any trademarks mentioned here are the property of their owners. To our knowledge no trademark or patent infringement exists in these documents; any such infringement would be purely unintentional.
If you have any questions or objections about materials posted here, please
e-mail us immediately.
You may use the information presented herein at your own risk and responsibility only. We do also not guarantee the correctness of any information on this site or others and do not encourage or recommend any use of it.
One further remark: These pages are covering only some aspects of PC video and are not intended to be a complete overview or an introduction for beginners.