QTSource

From Avisynth wiki
Jump to: navigation, search
Abstract
Author tateu
Version v0.1.4
Download QTSource_20110528_bin.zip

QTSource_20110528_src.zip

Category Source filters
License This program is freeware, but WITHOUT ANY WARRANTY.
Discussion Doom9 Thread

Contents

[edit] Description

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.

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.

[edit] Requirements

  • QuickTime 6 for video only
  • QuickTime 7 for audio and video


[edit] Syntax and Parameters

[edit] QTInput

QTInput (string "file", int "color", int "quality", int "audio", int "mode", string "raw", int "info", int "dither", string "vfw", float "gamma", float "vfrFPS")


string  file =
Input filename; path can be omitted if the script is in the same folder as the image file.


int  color = 2
Output colorspace:
  • 0 = RGB24
  • 1 = RGB32
  • 2 = YUY2


int  quality = 100
Decompression quality; 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.


int  audio = 0
Audio input:
  • 0 = audio disabled.
  • 1 = audio enabled - all channels/tracks down mixed either to 1 stereo or 1 mono channel.
  • 2 = audio enabled - all channels/tracks output as separate AviSynth channels (be careful with this one...a lot of programs cannot play back multi channel audio).
This is only valid if you have QuickTime 7. Audio is completely disabled for QuickTime 6.


int  mode = 0
Decode mode:
  • 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. Should probably not be used for mpeg4 (h263, h264, etc.), try mode=0 or mode=3 instead
  • 3 = Uses QuickTime SDK function ICMDecompress to decode video.
  • 4 = Uses Video For Windows (VFW) codec.


string  raw = "yuyv"
Raw input colorspace. 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.


int  info = 0
Overlays codec info on the video.
  • 0 = info feature is turned off.
  • 1 = info feature is turned on.


int  dither = 0
Raw 10bit to 8bit dither mode:
  • 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 and only has an effect when mode=1, raw="v210".


string  vfw = ""
If mode = 4, force QTInput to use this VFW codec (FOURRCC code). This can be left blank and QTInput will attempt to find the correct codec based on the FOURCC embedded in the movie.


float  gamma = -1
EXPERIMENTAL: it is recommended not to use this...(default = -1, off).
If mode = 0, 2 or 3 adjust the decoded gamma to this value. Values less than or equal to zero do not apply any gamma correction. Does not seem to work with all codecs


float  vfrFPS = 0
EXPERIMENTAL: it is recommended not to use this...(default = 0, off)
If the video is variable frame rate, this tries to force it to use the desired fps by duplicating frames. The math for this is wrong:
  • My test movie is 29.97 (captured in VFR mode).
  • It opens in Quicktime player with a duration of 24:22.76 and fps of 14.14.
  • It opens in QTInput with vfrFPS = 0 (turned off) with a duration of 24:22.73 and fps of 20.538, 30041 frames but the VFR frames are not duplicated and the movie plays incorrectly.
  • It opens in QTInput with vfrFPS = 29.97 with a duration of 24:22.73 and fps of 33.368, 48808 frames the VFR frames are duplicated but they are not 100%.
  • By experimentation, I was able to find that setting vfrFPS = 33.675, QTInput opens it with a duration of 24:22.74 and fps of 29.97, 43839 frames the VFR frames are duplicated and seem mostly correct.


[edit] QTOutput

QTInput (string "file", string "format", int "quality", int "datarate", int "keyframe", string "raw", string "settings", int "audio")


string  file =
Output filename; path can be omitted if you want the file to be written in the same folder as the avs script.


string  format = ""
QuickTime FourCC codec. 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


int  quality = 100
Compression quality, 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.


int  datarate = 1000
datarate in KBytes/sec.


int  keyframe = 1
keyframe every n frames.


string  raw = ""
Raw output colorspace. 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.


string  settings = ""
This is a filename to save/read output codec settings to/from.


int  audio = 0
  • 0 = disable audio
  • 1 = enable audio


[edit] Examples

Opening a file:

QTInput("input.mov")

Saving a file:

QTOutput("output.mov")


[edit] Changelog

  • Version 0.1.4 2011-05-28
    • QTOutput
      • Fixed a bug in QTInput mode=0 that did not correctly read the cropping parameters from GetMovieBox
  • Version 0.1.3 2011-03-31
    • QTOutput
      • Fixed a bug in QTInput mode=0 that did not correctly read the rotation matrix in QuickTime Movies, such as those created with an iPhone in landscape mode
  • Version 0.1.2 2011-02-28
    • QTOutput
      • Fixed a bug (in QTSource or QuickTime API?) that would sometime cause an error when writing a movie to a mapped network drive. If the call to CreateMovieFile() in CreateMovie fails, trying it a second time should succeed. added vi.SetFPS(int(0.5 1000.0 * (float)vi.fps_numerator / vi.fps_denominator), 1000) before m_QTMovie->Initialize because BlankClip(fps=29.97) would return fps_numerator = 15712911 and cause some weirdness with the framerate
      • Fixed a bug that caused incorrect timescales to be written to a movie file. Added SetMovieTimeScale(m_Movie, m_MovieTimeScale) to CreateMovie
  • Version 0.1.1 2011-02-19
    • QTOutput
      • Added "audio" parameter to disable or enable audio output
      • Fixed a bug that caused a file to always be encoded to h264 when setting the "format" parameter to anything other than "none"
  • Version 0.1.0 Test2 2010-09-16 (Experimental)
    • QTInput
      • audio parameter has changed. audio=0 (disabled). audio=1 (down mix enabled). audio=2 (multi track/channel enabled)...
  • Version 0.1.0 Test1, 2010-09-15 (Experimental)
    • QTInput
      • Allow import of multitrack audio as separate tracks...
  • Version 0.0.9, 2009-02-03 (Experimental)
    • QTInput
      •  ???
  • Version 0.0.8, 2008-12-06 (Experimental)
    • QTInput
      • Removed TerminateQTML becuase it caused a crash when reopening certain movies (Apple ProRes codec)
      • Added experimental gamma setting
      • Added experimental vfrFPS setting
  • Version 0.0.7, 2007-01-?? (Unreleased)
    • QTInput
      • Added new mode that uses an installed video for windows codec to decode the video instead of quicktime
  • Version 0.0.6, 2006-09-19
    • QTInput
      • Changed audio so it is output as 16bit
      • Added ICMDecompress decoding method (mode = 3), should probably only be used for mpeg4 (h263, h264, etc.)
    • QTInput
      • Added video output settings file
  • Version 0.0.5a, 2006-01-09
    • QTInput
      • Fixed raw YUV input that was broken in 0.0.5.
  • Version 0.0.5, 2006-01-09
    • QTInput
      • 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
    • QTInput
      • Added a dither (rounding) mode to raw 10bit input (v210).
      • Removed some unnecessary code.
    • QTInput
      • 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.
  • Version 0.0.3, 2006-01-05
    • QTInput
      • 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.
    • QTOutput
      • 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
    • QTInput
      • 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.


[edit] External Links




Back to External Filters

Personal tools