FAQ - Step by Step Guide (Frameserving with AVISynth)

1. Info

This FAQ was written by Thorsten Tarrach.
Any feedback to the address above. Please do not copy this site, link to here!

2. FAQ

+ Introduction
+ Step1: Recording
+ Step2: Checking the MPEG2 file for errors
+ Step3: Using DVD2AVI
+ Step4: MPEG Audio to WAV
+ Step5: The AVS file (Update: using Avisynth 2.5)
+ Step6: Creating the AVI (Update)
+ The resulting AVI


+ Back to FAQ - Index


Introduction

When I bought my DVB card I was satisfied with the recordings, but found no way to convert them into any useable format. After 1 year of working with the recordings I found out many tricks to produce very good WMV files. My first tries were not even sync! So I write this to show you one way you may to convert MPEG2 to WMV, but also in general since this way you can can use MPEG2 as input for any software tool (most ones do not support MPEG2).

Please also take a look at the Tools Page to ensure you have all the software necessary.

Node: This is no real MPEG2 to AVI encoding. For further details take a look at the button of this side.

Top


Step1: Recording

I assume you want to record DVB with a Technotrand/Hauppauge/Siemens DVB-s or Nexus card. If you use any other sources please proceed to the next step. You should give the software delivered with your card a try. It is not that worse. In the options menu ensure you select MPG not PVA for recording. If you have problems (MPEG errors in the data stream) you may also try WatchTVPro. If you have MPEG Error in general (even on screen when watching live)  try MultiDec 9, not 8.x.

To ensure you get perfect recording even when you do other things on the PC open the taskmanager (WinXP/2k only) right click on the task of the DVB software and choose "switch to process". Right click on the process and set the priority to high, not real time.

Top


Step2: Checking MPEG2 file for errors

Nothing is more annoying than having encoded a full movie just to realize it is full of errors. So you should always scan the file for error, except it is a DVD rip perhaps. Use PVAStrumento for that. Use "scan" to run a simple scan and "make ps" to write a fixed file to disk. Please note that PVAStrumento cannot fix everything if data are missing. Read the help file to understand the error messages.

Top


Step3: Using DVD2AVI

OK. Now start DVD2AVI and open the MPEG2 file. If can't find it select all files since the extension *.mpg isn't shown by default. If the video is splitted over more files add them all. But don't add to much because it is difficult to navigate if the recording is too long.

Now cut out what you need. Use the two arrows to make small jumps (approximately one second) and the brackets to set the start and end.

Settings in the Menu: Leave the default settings. On Audio choose "Demux" and "MPEG Audio". I have no experience with AC3 (Dolby Digital).

Then save the project. Wait until the MPEG Audio is demuxed.

I thing this Step is easy, so no picture is necessary.

Node: I don't recommend to create an AVI at this point since we will have to apply some more filters.

Top


Step4: MPEG Audio to WAV

Now you should have a *.d2v and an *.mpa file in that directory. But most video tools only accept wave files. So we'll convert the mpa file.

There are several MP3 to WAV converters around, but be careful: Not every can encode mpa files properly. That means the resulting video may me not sync (audio and video won't play synchronously).

So I've chosen BeSweet. It is command Line tool. This is the best possibility to use this tool:

Create a new text file and copy the following line into it:
"D:\Programme\BeSweet\BeSweet.exe" -core -input %1 -output %1.wav -2ch

Then change the path

Save the file: Choose "All Files" as Filetype and name it besweet.bat.

Then open Explorer, navigate to that directory, drag the mpa file and drop it on the besweet.bat.

Node: A GUI version for easier use is now available. Take a look at my Tools site!

Top


Step5: The AVS file

Next install AviSynth. Read this tutorial to get a better unstanding of scripting with AVISynth.

You write such a script in the editor and save it with an avs extension, for example myvideo.avs (see above). Don't forget to choose "All Files" as Filetype.

Here is a commented sample (lines beginning with a # are comments)

This example is usefull if you want to use the WMV encoder later (please refer to my WMV Encoding Guide)

#This is the filename of the video source (please adjust the filename)
video=mpeg2source("J:\1\No Angels - Feelgood Lies.d2v",2,5,True)
#This is the audio source in WAVE format (please adjust the filename)
audio=wavsource("J:\1\No Angels - Feelgood Lies.wav")
#muxing audio and video together
audiodub(video,audio)
#see below
delayaudio(-0.146)
#deinterlace the video
telecide(guide=2,threshold=15,dthreshold=14,show=false,chroma=true,blend=false,firstlast=true)
#resize the video
LanczosResize(768,576)

There are two important things to mention:
deleyaudio: The wave and the video are not sync. The audio starts 146 ms earlier in this example. The value is given in the filename of the mpa file. Please note the delayaudio needs the value in seconds while it is given in milliseconds.

Most video sources are interlaced. Read more about interlace here. Most deinterlacers are bad (see previous link). "telecide" gives the best results in my opinion. You should play around with the parameters a little bit. They are explained here.

You also have to resize the video. This is necessary for some video sources, especially DVB sources. You may use other resolutions too, but keep the aspect ration of 4:3 (or 16:9) for PAL Videos. 720 x 576 is not a proper resolution (this is the original PAL resolution, but PAL pixels are not square pixels: so stick to the aspect ration (4:3)). "LanczosResize" gives good results but is not intended to create low bitrate videos.
Node: You may also resize the video before deinterlacing if you do this you must not change the height. So the only possible resolution then is 768x576.

Top


Step6: Creating the AVI

Creating an AVI using the AVS Script is very easy. Open ffvfw.

- Browse for the avs script you created in Step 5 file. Press Open.
- Enter a path for the resulting avi.
- Press "Create"

Preview the AVI, since all error messages are given this way (shown when playing the AVI). Also take a look at the quality and if it is synch before you encode the video.

Top


The resulting AVI file

Ok, want did you get now? Let's remember what we wanted to do: We want to input MPEG2 into any encoder. Every encoder accept AVI files. But do you have an idea, how long it takes to convert the MPEG2 video to AVI? Very long. Apart from that you would experience a loss in quality in that intermediate step. If you would use a lossless codec the output would be 1/2 GB per minute.

That's why we use ffvfw and AVS. ffvfw creates an AVI file which contains a reference to the AVS file. And the AVS file refers to the original MPEG file. The AVS file is nessecary to apply certain filters (deinterlace, resize, mux video and audio) in real time.

You may view the AVI file in any media player. If your computer is fast enough even in real time.
But be careful: If you delete or move the MPEG or the AVS file, the AVI won't work any more.

So, what can you do with this? Load the AVI file into any encoder and create whatever file you need: For example: MPEG1, MPEG2 (deinterlaced now), WMV (formally ASF), a real AVI, a VCD.

Please read here about how to use the Windows Media Encoder if you like.

Top


© by Thorsten Tarrach