Datastead Encoder

Prev

Next

 






































































































Datastead Encoder

Description

The Datastead Encoder is a new set of codecs allowing to:

- compress video in various formats including MPEG4, MJPEG, H264, HEVC, eventually by using the GPU encoder if available (NVidia, AMD and Intel Quicksync supported),

- compress audio in various formats including AAC, Mpeg2

- record to file in various container formats (.avi, .mp4, .mkv, etc...),

- stream in various formats like UDP, RTMP, RTP, etc...

The Datastead Encoder requires the Datastead Multipurpose Encoder version 2 or newer to be installed, however it does not launch FFmpegLGPL.exe, nor requires to run any external process.

One or more Datastead Encoder instances can be associated with a given TVideoGrabber component (e.g. an encoder instance performing the recording and another instance performing the streaming of the same TVideoGrabber instance)

A Datastead Encoder instance can record what is being displayed/rendered to a file, or send a live stream to the network.

When adding an Encoder instance, it returns an unique ID that is then used to configure this instance.

INSTALLATION

To install it:

- option 1:

run the .exe installer located in the "Install" folder of the Multipurpose Encoder package. Then TVideoGrabber will locate the binaries automatically.

- option 2:

copy the x86 and x64 folders containing the encoder binaries:

- either directly under the folder where is located the application's ".exe", e.g.:

Example of layout:

c:/appfolder/application.exe
c:/appfolder/x86
c:/appfolder/x64

- either to another folder, that you specify with VideoGrabber.ExtraDLLPath

Example:
VideoGrabber.ExtraDLLPath = "c:/AnotherFolder"

and the corresponding layout:

c:/appfolder/application.exe
c:/AnotherFolder/x86
c:/AnotherFolder/x64

ACTIVATION AND CONFIGURATION

Note: the instance and parameters must be configured before starting the video.


Creating and configuring an instance

- to create an instance that will write to a file, invoke Encoders_CreateInstanceForRecording

- to create an instance that will stream to the network, invoke Encoders_CreateInstanceForStreaming


Both functions return an unique ID that is attribued when creating the instance.

To configure then encoder, this ID must be passed to Encoder_SetStr and Encoder_SetInt.

While the video is running:

- the instance can be paused with Encoder_Pause and resumed with Encoder_Resume

if recording:

- the current file being written can be closed and a new file opened by invoking Encoder_NewOutputFile

- the current file being written can be closed by invoking Encoder_CloseOutputFile

- the total amount of bytes written can be read with Encoder_GetInt (Enc_Bytes_Written_kb_readonly, ...)

Once the video is stopped (VideoGrabber.Stop()):

- an encoder instance can be eventually removed by invoking Encoders_RemoveInstance, otherwise it will be active again when restarting the video.

- to remove all the encoders instances associated with a TVideoGrabber component invoke Encoders_RemoveAllInstances

Restarting the video after stopped

If an instance is not removed it will be active again when restarting the video.

So if it is configured for recording, this will overwrite the current recording file, unless a new file is specified with Encoder_NewOutputFile before invoking StartPreview()

RECORDING

The recording is described in Recording through the Datastead Encoder

STREAMING

The streaming is described in Streaming through the Datastead Encoder

CONFIGURATION OF THE ENCODER

The configuration is achieved through the Encoder_SetInt and Encoder_SetStr functions.

Example of various values that can be passed:

- to select the codec:

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "mjpeg");

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Audio_Codec, "aac");

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "mpeg4");

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "mpeg2");

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "jpeg");

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "h264);

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Video_Codec, "hevc");

- to configure the GPU encoder (usually for the "h264", "hevc" or "mjpeg" codecs:

Encoder_SetInt (ENCODER_RECORDING_ID, , (int) Enc_GPU_Intel_QSV);

(possible values include Enc_GPU_None, Enc_GPU_Auto, Enc_GPU_Intel_QSV, Enc_GPU_NVidia_NVENC, Enc_GPU_AMD_AMF)

- to set the bit rate:

Encoder_SetInt (ENCODER_RECORDING_ID, Enc_Video_Bitrate_kb, 2000);

- to configure the bitrate control:

Encoder_SetInt (ENCODER_RECORDING_ID, Enc_Video_rc_BufferSize_kb, 1000);

Encoder_SetInt (ENCODER_RECORDING_ID, Enc_Video_MinBitrate_kb, 2000);

Encoder_SetInt (ENCODER_RECORDING_ID, Enc_Video_MaxBitrate_kb, 2000);

- to pass the FFMpeg parameters:

Encoder_SetStr (ENCODER_RECORDING_ID, Enc_Extra_Parameters, "movflags empty_moov" + linefeed + "strict experimental" + linefeed + "frag_duration 4000");



See Also
Pause/resume during recording Recording methods and properties Encoder_GetInt Encoder_Pause Encoder_Resume Encoder_SetInt Encoder_SetStr Encoders_CreateInstanceForRecording Encoders_CreateInstanceForStreaming Encoders_RemoveAllInstances Encoders_RemoveInstance