View Single Post
Old 4th April 2004, 03:23   #3  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
This should get you started:
Code:
function InfoToFile(clip c, string filename)
{
    endl = Chr(10)
    colorspaceStr = "Colorspace: "
    \               + (c.IsYUY2()
    \                  ? "YUY2"
    \                  : (c.IsYV12()
    \                     ? "YV12"
    \                     : (c.isRGB32()
    \                        ? "RGB32"
    \                        : (c.IsRGB24()
    \                           ? "RGB24"
    \                           : "Unknown"))))
    \               + endl
    frameSizeStr = "Frame size: "
    \              + String(c.Width()) + "x" + String(c.Height())
    \              + endl
    fpsStr = "FPS: " + String(c.FrameRate()) + endl
    fieldBasedStr = (c.IsFieldBased()
    \                ? "field-based (separated)"
    \                : "frame-based")
    \               + endl
    audioStr = "Audio: "
    \          + ((c.AudioRate() == 0)
    \             ? "none"
    \             : (String(c.AudioRate()) + " Hz, "
    \                + String(c.AudioBits()) + "-bit, "
    \                + String(c.AudioChannels()) + " channels"))
    \          + endl

    return c.WriteFileStart(filename, "colorspaceStr",
    \                       "frameSizeStr", "fpsStr",
    \                       "fieldBasedStr", "audioStr")
}
(There's a bug in AudioBits(); right now it returns bytes per channel, not bits. The script above does not correct for it, since I assume it will be fixed real soon. )

Is it useful to have this information in a text file?

Last edited by stickboy; 4th April 2004 at 05:41.
stickboy is offline   Reply With Quote