Difference between revisions of "User:Mjb/AviSynth"

From Offset
Jump to navigationJump to search
(Inverse telecine)
(Using AviSynth with MPEG-2 files)
Line 24: Line 24:
 
# Load the VOB in the DGIndex app. You can tweak some options at this point, but probably shouldn't.
 
# Load the VOB in the DGIndex app. You can tweak some options at this point, but probably shouldn't.
 
# Save Project [F4]. This will generate a .d2v file, which is a frame-by-frame index DGDecode can use. It also demuxes the audio stream(s) into separate files you can use later.
 
# Save Project [F4]. This will generate a .d2v file, which is a frame-by-frame index DGDecode can use. It also demuxes the audio stream(s) into separate files you can use later.
# In your AviSynth script, load the DGDecode.dll plugin, and now you can use MPEG2Source() with the .d2v file:
+
# In your AviSynth script, load the DGDecode.dll plugin (unless you copied DGDecode.dll to the AviSynth plugins directory), and now you can use MPEG2Source() with the .d2v file:
  
 
<pre>LoadPlugin("e:\apps\DGMPGDec\DGDecode.dll")
 
<pre>LoadPlugin("e:\apps\DGMPGDec\DGDecode.dll")
MPEG2Source("input.d2v")
+
MPEG2Source("input.d2v",cpu2="xxxxxx")
 
...
 
...
 
</pre>
 
</pre>

Revision as of 17:34, 14 July 2018

AviSynth is a script-based "frame server" (processed raw video streamer) with impressive filtering abilities. It is normally used as a preprocessor for a general-purpose encoder/muxer like VirtualDub or FFmpeg.

Basic usage

To use AviSynth, first install the AviSynth package. This gives you the ability to process videos with an AviSynth script (.avs file) which you must author yourself. The script takes care of loading the input video and doing whatever filtering you specify. The output will be raw video which you must further encode in other software.

You edit your AviSynth script in a text editor. To test it, load the script into VirtualDub or other AviSynth-aware editor (instead of having those apps load the video directly). Another way of testing is to use the Windows GUI app AvsPmod, which is a nice little editor plus a preview pane, but no ability to save the processed video.

Using AviSynth with FFmpeg

If FFmpeg was built with --enable-avisynth (as the Zeranoe builds are), an AviSynth script can be the input file for the video (only the video, not audio):

   ffmpeg -i myscript.avs -i input.ac3 ...

If you get "Unknown error occurred", it is probably because FFmpeg is 64-bit and AviSynth is 32-bit, or vice-versa; they must match.

Since you are reading raw video, you probably need to be sure to set the output aspect ratio. For example, 720x480 (3:2) input will stay 3:2 unless you specify -aspect 4/3 or whatever.

Using AviSynth with MPEG-2 files

An AviSynth script can only open AVI files natively. Other types require special plugins. For MPEG-2 and MPEG-1 files (including .vob, .ts, .mpg), it's a multi-step process:

  1. Install the DGMPGDec package, which gives you the DGIndex app and the DGDecode AviSynth plugin.
  2. Load the VOB in the DGIndex app. You can tweak some options at this point, but probably shouldn't.
  3. Save Project [F4]. This will generate a .d2v file, which is a frame-by-frame index DGDecode can use. It also demuxes the audio stream(s) into separate files you can use later.
  4. In your AviSynth script, load the DGDecode.dll plugin (unless you copied DGDecode.dll to the AviSynth plugins directory), and now you can use MPEG2Source() with the .d2v file:
LoadPlugin("e:\apps\DGMPGDec\DGDecode.dll")
MPEG2Source("input.d2v",cpu2="xxxxxx")
...

Inverse telecine

One way of doing IVTC via AviSynth is to use the TIVTC plugin.

  1. Get the TIVTC package.
  2. Extract tivtc.dll to "%ProgramFiles(x86)%\AviSynth\plugins".
  3. Get the vInverse plugin.
  4. Extract vinverse.dll to "%ProgramFiles(x86)%\AviSynth\plugins".
  5. In your AViSynth Script, you can now refer to the field-matcher TFM(), the duplicate frame-remover TDecimate(), and the :
LoadPlugin("e:\apps\DGMPGDec\DGDecode.dll")
MPEG2Source("input.d2v",cpu2="xxxxxx")
TFM(d2v="I:\video workspace\relax.d2v")
TDecimate()
vInverse()