## QTInput / QTOutput

Plugin for AviSynth 2.5
Version 0.0.5 - January 9, 2006
by Josh Harris
latest version
source code

### About

This filter can read and write quicktime files, using an existing installation of Quicktime. If you have Quicktime 6 installed, the filter only supports video. If you have Quicktime 7, video and audio are supported for input. The filter currently only supports creating movs with video. Audio support is planned for a future version.
It should be able to open almost any file that you can open with the quicktime player: movs, mp4 (h264 with b-frames skips the first frame or two and is extremely slow), raw dv, reference movs, etc.

### Requirements:

Quicktime 6 for video only
Quicktime 7 for audio and video

### Usage - Read

QTInput("FileName.mov", color = 2, quality = 100, audio = false, mode = 0, raw = "yuyv", info = 0, dither = 0)
QTInput("FileName.mov")

#### Parameters:

file - input filename
color - output colorspace (default = 2)
0 = RGB24
1 = RGB32
2 = YUY2
quality - decompression quality (default = 100)
There are really only two values for this setting:
0 = normal
> 0 = High quality
This parameter does not have an effect on all codecs but there is a noticeable drop in quality for some of them (dvc) if it is set to 0. It is recommended that you leave this value at it's default value of > 0.
audio - audio input (default = false)
false = audio disabled.
true = audio enabled.
This is only valid if you have Quicktime 7. Audio is completely disabled for Quicktime 6.
mode - Decode mode (default = 0)
0 = Uses Quicktime SDK function MoviesTask to decode video.
1 = If source file is one of several YUV formats (listed below), this mode returns raw data.
2 = Uses Quicktime SDK function DecompressSequence to decode video.
raw - raw input colorspace (default = "yuyv")
If mode = 1, this sets the input file colorspace method. Choices are:
uyvy (2vuy), yuyv (yuy2), yvyu, vyuy, yuv2 or v210 (10bit uyvy), rgb, argb.
info - Overlays codec info on the video (default = 0)
0 = info feature is turned off.
1 = info feature is turned on.
dither - raw 10bit to 8bit dither mode (default = 0)
0 = off
1 = Uses the 2 least significant bits as a fraction for rounding the 10bit value to the nearest 8bit value.
Currently this really isn't a dither mode, but is in place for a future dither mode option.
This only has an effect when mode=1, raw="v210."

### Usage - Write

QTOutput("FileName.mov", format = "", quality = 80, datarate = 1000, keyframe = 1, raw = "")
QTOutput("FileName.mov")

#### Parameters:

file - output filename
format - quicktime FourCC codec (default = "")
If you leave this value blank, a dialog box will open allowing you to choose which codec to use.
h264 compression is a little buggy. It doesn't work if "keyframe every" is checked. This means you have to use the dialog box for h264 and uncheck it.
Other options for this depend on what codecs you have installed, some examples:
"dvc" = DV25 NTSC
"dvcp" = DV25 PAL
"rle" = Animation
"SVQ3" = Sorenson Video 3
"cvid" = Cinepak
"IV41" = Intel Indeo¨ Video 4.4
"cvid" = Cinepak
quality - compression quality (default = 100)
This value is divided by 20 and truncated to an integer, so a value of 25 is identical to a value of 20.
0 = Least
20 = Low
40 = Medium
60 = High
80 = Best
100 = Lossless (this is listed as lossless in the SDK, but is probably not always lossless, but rather just the highest setting for a given codec.
333 = This is a special mode that will create a file called "Quicktime_CodecList.txt" in the same directory as the avs script. This file will contain a list of the FourCC codes installed on your system.
datarate - datarate in KBytes/sec (default = 1000)
keyframe - keyframe every n frames (default = 1)
raw - raw output colorspace (default = "")
This is a raw output mode. Instead of using a quicktime codec to encode data, this mode copies the data directly from YUY2 to the requested output mode.
You must set format to a valid quicktime FourCC.
Currently only format="2Vuy", raw="uyvy" is supported.
And you must have a codec installed that handles 2Vuy, such as the Blackmagic codec.

### Version changes:

- Version 0.0.5a, 2006-01-09
  Fixed raw YUV input that was broken in 0.0.5.
- Version 0.0.5, 2006-01-09
  Added raw input mode for RGB and ARGB data.
  Fixed (hopefully) audio input for Quicktime 7.
  Fixed several memory errors that caused QTInput to sometimes crash on opening or closing a file.
- Version 0.0.4, 2006-01-07
  Added a dither (rounding) mode to raw 10bit input (v210).
  Added a raw output mode for 2Vuy (uyvy).
  Added a frame count check to QTOutput. This keeps it from writing more frames than the input clip has.
  Removed some unnecessary code.
- Version 0.0.3, 2006-01-05
  Added 10Bit raw decoding of v210 uyvy video.
  Fixed a bug with the way fps info was calculated for some movies.
  Fixed a bug with the way frame count was calculated for h264 mp4 files.
  Fixed part of a bug with the decoding of h264 mp4 files in mode=0. Still not 100% working, first frame is not decoded and it sometimes skips over a frame.
  Added the default compression dialog box and two new compression parameters, datarate and keyframe.
  h264 compression is a little buggy. It doesn't work if "keyframe every" is checked. This means you have to use the dialog box for h264 and uncheck it.
- Version 0.0.2, 2005-12-20
  Added two new decode methods: Quicktime SDK DecompressSequence and a raw mode for some types of YUV data.
  Added info parameter to overlay codec info on top of video.
- Version 0.0.1, 2005-12-19
  Initial release.

### Plans:

- Fix h264 decoding with b-frames
- Fix skewed video problem that occurs with certain frame sizes (420x240 for example)
- Add support for audio import with Quicktime 6
- Add support for audio to quicktime mov output
- Add more raw input and output formats

### License:

This program is freeware, but WITHOUT ANY WARRANTY.