Overview¶
A quick look at the elements of a transcoding workflow.
Inputs and Outputs¶
Before using a TTranscoder object you have to configure its inputs and outputs. The TTranscoder inputs and outputs are collections of media sockets (TMediaSocket), and each media socket may have one or more media pins.
Media sockets are roughly equivalent to containers like MP4 and OGG (i.e. file formats), and media pins (TMediaPin) represent individual data streams within the containers like video, audio and subtitle streams.
Presets¶
You can configure a TMediaSocket manually with TVideoStreamInfo, TAudioStreamInfo and TMediaPin objects. You can also configure a TMediaSocket automatically from a predefined preset. AVBlocks offers presets for most modern audio and video formats.
Tip: TMediaSocket configuration from presets is especially useful when configuring outputs. A common way of configuring outputs is to start with a TMediaSocket generated from the preset that is closest to your custom output format and then tweak and fine-tune the TMediaSocket according to your needs.
Transcoding¶
Once you have inputs and output configured, the actual transcoding is a simple three-step process:
Open the
TTranscoderto connect the input and output sockets and pins.Run the
TTranscoderto encode the inputs into the outputs.Close the
TTranscoderto flush its buffers and to free the allocated resources.