Using H.264, H.265, and AAC Codecs
We recommend that you start by reviewing the sending of frames over the network using the NDI® SDK. The Advanced SDK is designed to operate almost identically, although you can send compressed data streams directly.
Currently the Advanced SDK supports H.264 or H.265 compression at a very wide variety of bitrates, resolutions, and framerates; and it would be common for you to use hardware-assisted compression to generate the compressed video stream on Advanced SDK devices, then send this onto the network using the NDI Advanced SDK. AAC audio is supported for audio transmission.
To send a compressed video frame, you should use the Advanced SDK structure NDIlib_compressed_packet_t
to pack your data. You should allocate memory for your packet so that the following data will be in a single block:
uint32_t, 4 bytes
version
This represents the current version number of the structure. This should be set to NDIlib_compressed_packet_t::version_0
, which has a value of 44 currently (representing the structure size).
uint32_t, 4 bytes
fourCC
This is the FourCC for the current compression format. Currently H.264 is supported, although other formats might be available in the future.
H.264 should be specified using
NDIlib_FourCC_type_H264
.
H.265 should be specified using
NDIlib_FourCC_type_HEVC
.
AAC audio should be submitted using
NDIlib_FourCC_type_AAC
.
int64_t, 8 bytes
pts
The stream presentation time stamp. See notes in the next section.
int64_t, 8 bytes
dts
The stream display time stamp. See notes in the next section.
int64_t, 8 bytes
reserved
This is currently a reserved field and will not be propagated by the SDK.
uint32_t, 4 bytes
flags
The flags that apply to this frame. Currently there are two supported values for this setting:
NDIlib_compressed_packet_t::flags_none
. Nothing.
NDIlib_compressed_packet_t::flags_keyframe
. This is a frame that can be decoded without dependence on other stream data. This normally means that this is considered an I-Frame. For H.264 and H.265, key-frames must have extra data. This should always be set for AAC audio.
uint32_t, 4 bytes
data_size
The size of the compressed video frame.
uint32_t, 4 bytes
extra_data_size
The size of the ancillary extra data for the current codec settings. This is required for key-frames in most compressed video formats.
data_size bytes
[data]
This is the compressed video frame data in byte format.
extra_data_size bytes
[extra_data]
This is the compressed ancillary data if extra_data_size
is not zero.
Last updated
Was this helpful?