August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
This component decodes a stream of video, coded using the Dirac codec, into frames of YUV video data.
This component is a thin wrapper around the Dirac Python bindings.
A simple video player:
Pipeline(ReadFileAdapter("diracvideofile.drc", ...other args...),
DiracDecoder(),
RateLimit(framerate),
VideoOverlay()
).activate()
Reads a raw dirac data stream, as strings, from the "inbox" inbox.
Sends out frames of decoded video to the "outbox" outbox.
The frames may not be emitted at a constant rate. You may therefore need to buffer and rate limit them if displaying them.
The decoder will terminate if it receives a shutdownMicroprocess message on its "control" inbox. The message is passed on out of the "signal" outbox.
It will ignore producerFinished messages.
The decoder is able to work out from the data stream when it has reached the end of the stream. It then sends a producerFinished message out of the "signal" outbox and terminates.
For more information see the Dirac Python bindings documentation.
This component encodes frames of YUV video data with the Dirac codec.
This component is a thin wrapper around the Dirac Python bindings.
Raw video file encoder:
imagesize = (352, 288) # "CIF" size video
Pipeline(ReadFileAdapter("raw352x288video.yuv", ...other args...),
RawYUVFramer(imagesize),
DiracEncoder(preset="CIF"),
WriteFileAdapter("diracvideo.drc")
).activate()
RawYUVFramer is needed to frame raw YUV data into individual video frames.
Reads video frames from the "inbox" inbox.
Sends out encoded video data (as strings) in chunks to the "outbox" outbox.
The encoder can be configured with simple presets and/or more detailed encoder and sequence parameters. Encoder and sequence parameters override those set with a preset.
For more information see the Dirac Python bindings documentation.
The encoder will terminate if it receives a shutdownMicroprocess or producerFinished message on its "control" inbox. The message is passed on out of the "signal" outbox. If the message is producerFinished, then it will also send any data still waiting to be sent out of the "outbox" outbox, otherwise any pending data is lost.
The component does not yet support output of instrumentation or locally decoded frames (the "verbose" option).
Uncompresed video frames are output by the decoder, as dictionaries. Each contains the following entries:
{
"yuv" : (y_data, u_data, v_data) # a tuple of strings
"size" : (width, height) # in pixels
"frame_rate" : fps # frames per second
"interlaced" : 0 or not 0 # non-zero if the frame is two interlaced fields
"topfieldfirst" : 0 or not 0 # non-zero the first field comes first in the data
"pixformat" : "YUV420_planar" # format of raw video data
"chroma_size" : (width, height) # in pixels, for the u and v data
}
The encoder expects data in the same format, but only requires "yuv", "size", and "pixformat".
DiracDecoder() -> new Dirac decoder component
Creates a component that decodes Dirac video.
Warning!
You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Main loop
DiracEncoder([preset][,verbose][,encParams][,seqParams][,allParams]) -> new Dirac encoder component
Creates a component to encode video using the Dirac codec. Configuration based on optional preset, optionally overriden by individual encoder and sequence parameters. All three 'params' arguments are munged together, so do what you like :)
Keyword arguments:
Warning!
You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Main loop
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT