Regarding color and gamma: I understand Jon got gamma working consistently in Quicktime. Beyond that I don’t think we’ve put much work into it. Please let us know if you run into any issues, or if you have any feature requests.
We’re working on improving our documentation now. This seems like a good place to figure out what we need for VideoEncoder.
The VideoEncoder class should be documented here, but it is currently incomplete and a bit out of date.
Class: Draft.VideoEncoder
Constructors
There are two functions for creating a VideoEncoder:
[b]Draft.VideoEncoder/b
Return a new VideoEncoder that will save a video to the specified filename. Default values are used for the frame rate, frame size, etc.
Arguments:
[list]filename – the filename where the video should be saved.[/list:u]
Draft.VideoEncoder( filename, fps, width, height, kbitRate, codec )
Return a new VideoEncoder that will save a video to the specified filename.
Arguments:
[list]filename – the filename where the video should be saved.
fps – the video frame rate, in frames per second. This can be:
[list]* An integer such as 24,
[]a float such as 29.97, or
[]a fraction. To specify a fraction, you can use the Rational class:from fractions import Fraction
fps = Fraction(30000, 1001)
width – the video frame width. This must be an integer. To convert a floating-point number to an integer, you can use the int() function, for example: int(800.0). If you encode an image with a different size, it will be automatically resized to match this width.
height – the video frame height. This must be an integer. If you encode an image with a different size, it will be automatically resized to match this height.
kbitRate – the target bit rate for the encoded video. Measured in kilobits per second.
codec – the video encoder to use. This is must be a string. Valid options are: ‘MPEG4’, ‘MJPEG’, ‘DNXHD’, ‘H264’, ‘PRORES’, ‘RAWVIDEO’[/:m][/list:u][/:m][/list:u]
I think the one weird parameter here is the kbitRate. I think it should be optional, and Draft should choose a sensible default based on the fps, width, height, and codec. I think it will require some trial and error, and I don’t have any suggestions for now. However I would suggest that you base your tests on an equation such as:bitsPerPixel = 0.2 # try changing this
kbitRate = int(fps * width * height * bitsPerPixel / 1000.0) # leave this fixed
and change only the bitsPerPixel.
Methods
[b]EncodeNextFrame[/b]
[i]Description[/i]: Encodes a given draft image as the next frame in the video.
[i]Arguments[/i]:
[list]Image -- The image to encode into the next frame of the video
[i]Usage[/i]:
defaultEncoder = Draft.VideoEncoder( "//path/to/video/save.mov" )
defaultEncoder.EncodeNextFrame( Draft.Image.CreateImage( 800, 600 ) )
[b]FinalizeEncoding[/b]
[i]Description[/i]: Finalizes the encoding process, completing the video.
[i]Arguments[/i]: (none)
[i]Usage[/i]:
encoder = Draft.VideoEncoder( "//path/to/video.mov", 29, 800, 600, 5120, "MJPEG" )
#encode some frames here...
encoder.FinalizeEncoding()
[/list:u]
Is there anything in particular you’re wondering about, or anything we should explain better?