XviD.Ru DVD via AviSynth to AVI/XviD

Яндекс.Метрика Рейтинг@Mail.ru правильный HTML5 правильный CSS
В рисунках детей - неиссякаемое добро, любовь и свет!
Russian version

Unbreakable limitations of this process

Software Installation

Software links mentioned here points to some minimal installation packages, placed on the same server, NOT on the original software sites. If you wget or teleport this page - you keep ALL needed stuff.


All you need for output AVI file: One Video Codec and one Audio codec.

Command-line tools

They do not need installation procedure, only unpack and place them into some directory, where system PATH points.

Programms are installed by unpacking

Simply unpack zip archive (with subdirs!) into directory C:\Program Files\PGMNAME\ and create convinient shortcuts

AviSynth 2.5.* and most needed plugins

Subtitles tools

Decrypt tool

Install DVD Decrypter

Avi Tags edit software

Install AviTags

"Copy or Decrypt" step

If you try to read files from DVD, but they can`t be read, run DVD Decrypter and copy files to Hard Disk (for example, to D:\FILM\) through it. Choose only files of film. As usual, it will be the largest pack of files with names beginning with the same number VTS_NN. Typically you get:

this pack of files is result of this step.
Open IFO file

"Graphic Subtitles" step

If this DVD contains subtitles of languages you may enter in text mode, I recommend you to create TEXT subtitles in .srt/.smi format, through step "Text Subtitles". If this DVD has some languages, that CANNOT be entered in text form, keep them in graphics, in DirectVobSub format. Choose subtitles streams

It is important to do this before "video pack" step. Size of subtitles files is needed to be count to measure video bitrate.

Run VobSub Configure.lnk from installed package VobSub:

files filmname.sub, filmname.idx - result of this step.

"Text Subtitles" step

Run Subripper
small text files russian.srt, english.srt - result of this step.

"DVD2AVI" step

Run DVD2AVI, open D:\FILM\VIDEO_TS\vts_01_01.vob file (note! _01.VOB, not _00.IFO and NOT _00.VOB). You see:
DVD2AVI opens next files automatically
Press OK.
large binary files *.AC3,
small text file film.d2v - result of this step.

"Build Script" step

Common notes

Basic Nature of AviSynth is to build some universal method to access video information placed in .vob or any other files. VirtualDub opens .avs file as "common video file", but this cause system to give this .avs file to AviSynth.dll, and VirtualDub receives output stream from this DLL.

If you are not expert, begin with simple script named FILM.AVS and placed in the same directory, as FILM.D2V:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec.dll")

Run VirtualDub

"Interlaced Video processing" substep

IVTC common notes

Choose scene with some motion and edges sharp enough. Browse 15-60 sequential frames with Right Arrow key. If you see some of these frames of film as "Interlaced" - you need so-called "Inverse Telecine" process to correct it. If you are novice in this theme - please, read this documentation first.

The simplest way to make IVTC process is to use Decomb filter for AviSynth.

Typical script FILM.AVS changes are (added lines, NTSC DVD example):

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")


After any change reload Video File in VirtualDub and see result.

Read Decomb documentation to choose right options for Telecide and Decimate functions. The most common settings are:

Deinterlacing table

fps on DVD result fps needed lines in .AVS
NTSC DVD structure made from FILM original
You see 2 progressive frames followed by 3 interlaced frames
OR 3 progressive frames followed by 2 interlaced. Period is 5 frames
30 24 Telecide(post=false,guide=2,blend=false)
29.97 23.97
NTSC DVD structure made from PAL original
You see 2 progressive frames followed by 4 interlaced frames. Period is 6 frames
30 25 Telecide(post=false,guide=3,blend=false)
29.97 24.975
PAL DVD structure made from PAL original
25 25 Telecide(guide=1)
25 (reversed order of fields) 25 Telecide(guide=1,reverse=true)
PAL DVD structure made from FILM original by duplicating 1 frame
25 24 Telecide(guide=1)

Difficult cases. Manual actions

Some complicated and corrupted streams cannot be deinterlaced with Decomb. This part is useful, if above table doesn`t help you in choosing right Decomb settings. You see "interlaced" or "double-contoured" picture. In this case you must check if original picture is corrupted.

Comment all Telecide-Decimate lines in FILM.AVS. Insert line:
SeparateFields() to the end of FILM.AVS.

Reload file in VirtualDub and look carefully at pictures. Now you see _fields_ of any frame separated. If you see some pictures "interlaced" or "double-countured" - it CAN NOT be corrected, these pictures are fully corrupted during build DVD process.

Of course, if NOT ALL pictures are corrupted, you may try to choose nice pictures and rebuild videostream from them. If you decide to do it - SelectEvery() function is the most useful instrument for it. Typical script to throw out combed fields may be represented by three lines:

SelectEvery(10,1,2,3,4, 6,7,8,9 )

Example from some DVD, build from FILM original by inserting every 5th field, built by blending of two it`s "neighbours". As a rule, Decomb catches these frames properly, but field order is changing from two frames to another two frames. This may cause picture "bobbing" up and down on steady scenes. This simple script does no additional work and gives you more "clear result".

Finally, you must see uniform motion in choosen frames range, and NO "interlace artifacts" must be seen in the whole film.

"Correct Aspect Ratio" substep

Basic information: As usual, DVD contains true information about aspect ratio of it`s pixels. But sometimes this information is wrong. I am always checking Aspect Ratio. I always convert picture to "square pixels" state. Method is (using VirtualDub): For example. If measured size of Sun view is 220 x 221 pixels - you don`t need to correct AR. If we have W x H = 160 x 180 pixels size, we must decrease height of picture by multiplier 160/180, or increase width multiplying it with 180/160. If original picture is of the _very_ good quality, I recommend you to increase it. In all other cases decrease size.

Changes are (added line):

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec.dll")
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")



Note, that brown numbers 8,60,704,360 are the values you have kept from "DVD2AVI" step. Picture is cropped properly.

Blue numbers 704,320 are the FINAL dimensions of picture. If you set copy of brown 704,360 values here - no resize is performed, only crop.

"Choose final picture size" substep

Really, it is not very important, what particular size of picture you build. Of course, the sharpest details are seen better, if you keep more pixels per the same picture part. So, I prefer to keep picture size in pixels as large, as it possible. But you must remember. Greater picture size needs more bitrate. And greater picture size causes more processor load when playback.

How to choose right values? The most common situation is to place ripped film onto small number of CD. So, size of result videostream is about 570M-600M for one CD, bearing 1-1.5 hours. This means useful bitrate is 600k-1000k bit/sec. For example, we count 800k bitrate.

NB: There is NO reason to increase bitrate up to 1300kbps and more, if you deal with DVD originals.

Something else about bitrate and quality

Take one second of 800k bitrate. We have picture of (704 x 320 ~ 212000 pixels). one second contains 24 pictures, approximately 5 mega pixels. Divide 800k over 5M. We get 0.16 bits per pixel.

There is some empiric rule. 0.2 bits per pixel is enough for most films codec with any MPEG4 codec. So - if we want to keep picture size, we increase average bitrate up to 1100br. If we want to fit size to one CD, we must drop picture size to fit 0.2 bpp. Note, that most grayscale (black-and-white) films may fit 0.14-0.16 bpp without losing quality.

I recommend assume 0.14-0.16 bpp values for color and 0.11-0.12 for black-and-white films if you are using XviD codec. It`s true enough for it. Sample of side effect if not 32*n size of picture

Note, that most Mpeg4 codec divide full picture in 32*32 blocks. Some of them has "side effects", if you choose width or height of full picture not 32*n. For example, look at picture to the right. There are pieces of three sequential frames. They are taken from "Kikujiro no natsu" titles. Pink object moves from left edge to right over uniform blue background. Codec DivX 5.11 Pro. Any quality settings. 720*304 picture size. If we set 640*352 or 704*320 picture size - no such artifacts are seen.

So choose 32*n width and height. for our example decrease width from 704 to 696 to match this. You may ignore small (less than 2%) Aspect Ratio errors. I recommend change both crop and final size to minimize errors and loses. Last resulting line for our example is:


"VideoPack" step

Note. Why I am not using VirtualDubMod for this step? It has Error Handler. It interpretes timeouts of AviSynth picture processing as Read errors: Error handling makes result files corrupted

This is the MOST long step. Run:

avs2avi film.avs video.avi -p 0 -P 2 -s codec.ini

When you see codec configuration dialog - choose 1st step and second step codec settings and press Ok. You may continue "SubRip" step now. video.avi - result of this step.

"SoundPack" step

For each needed soundtrack (T01...AC3, T02...AC3,...): russian.wav, japan.wav - results of this step.

"VirtualDubMod" step

To build final avi Run VirtualDubMod. After short time (minutes) file is written.
filmname.avi - result of this step.

"AVI tags" step

AVI file contains some text fields, whisch are shown (or not) by players and other programms. You make good job, if you write there true information. The best way to gain this information is to search film in IMDB.COM database.
Run ABCAVI, open filmname.avi in it and edit at least: Of course, there are more tags, and you may fill other.

"SubKonv" step

If you have 2 different languages text subtitles, the best way to keep them both playable on different systems is to keep one file in .srt format, and convert another to .smi format. Both formats are useful in all modern players, or by ffdshow, or by DirectVobSub. Both may be switched off. filmname.srt, filmname.smi - result of this step.

To create better playable CD

Disk with video data must contain DATA, not programms. More original DVD data kept - better result.

I think, that user chooses programms to view video himself. You MUST NOT choose this for him. Do not waste 2-10M of disk space with your favorite DivX Player. So - I don`t talk here about "DivX Launchers" and other such stuff.

Don`t be lazy!

Directories/files structure (two soundtracks, two subtitles)

File list

© May-2004 Sergej Qkowlew AKA Radahnar. FIDO 2:5020/122

P.S. What am I interested in? Why not?

I`m not interested in methods of work such as "Press One Button - and all is done!". I prefer to set manually parametres instead of any "innatural intelligence".

I receive corrections and additions in forms:

I even don`t listen to words as "Your soft is too old!" or "I have cool programm!", or "I know the only right way to do it!". There were many docs I`ve read already. Do not repeat.

Now I use XviD (Koepi build) to code videostream. I`ve tested DivX 5.02, 5.11 Pro codec, but found NO reasons to use it in DVDRIP process. I couldn`t get better results in quality or size with it. Some my Rips are coded with DivX 4.12 due to type of material.

I listen to you about new versions, if you represent:

© 2004 Sergej Qkowlew. Разрешается использование текста, используемых в нём графических файлов, яваскриптов, файлов с табличными данными и элементов оформления полностью или частично в любых целях, КРОМЕ как для дезинформации кого-либо относительно материалов, произведений искусства, проектов, лиц, организаций, событий. Ссылку на источник давать разрешается.