Encoding
FFmpeg NETINT command options for encoding can be seen using the following command:
ffmpeg -help encoder=<ni_enc_name>
<ni_enc_name> options are:
h264_ni_quadra_ench265_ni_quadra_encav1_ni_quadra_encjpeg_ni_quadra_enc
These names are for NETINT AVC, HEVC, AV1 or JPEG encoder respectively.
Example:
ffmpeg -hide_banner -help encoder=h265_ni_quadra_enc
Output:
Encoder h265_ni_quadra_enc [H.265 NETINT Quadra encoder v---6rzDV]:
General capabilities: delay
Threading capabilities: none
Supported hardware devices: ni_quadra ni_quadra ni_quadra ni_quadra ni_quadra
Supported pixel formats: yuv420p yuvj420p yuv420p10le nv12 p010le ni_quadra
h265_ni_quadra_enc AVOptions:
-xcoder <string> E..V...... Select which XCoder card to use. (default "bestmodelload")
bestmodelload E..V...... Pick the least model load XCoder/encoder available.
bestload E..V...... Pick the least real load XCoder/encoder available.
-enc <int> E..V...... [DEPRECATED] Use ni_enc_idx instead. Select which encoder to use by index. First is 0, second is 1, and so on. (from -1 to INT_MAX) (default -1)
-ni_enc_idx <int> E..V...... Select which encoder to use by index. First is 0, second is 1, and so on. (from -1 to INT_MAX) (default -1)
-ni_enc_name <string> E..V...... Select which encoder to use by NVMe block device name, e.g. /dev/nvme0n1.
-encname <string> E..V...... [DEPRECATED] Use ni_enc_name instead. Select which encoder to use by NVMe block device name, e.g. /dev/nvme0n1.
-iosize <int> E..V...... Specify a custom NVMe IO transfer size (multiples of 4096 only). (from -1 to INT_MAX) (default -1)
-xcoder-params <string> E..V...... Set the XCoder configuration using a :-separated list of key=value parameters.
-xcoder-gop <string> E..V...... Set the XCoder custom gop using a :-separated list of key=value parameters.
-keep_alive_timeout <int> E..V...... Specify a custom session keep alive timeout in seconds. (from 1 to 100) (default 3)
-gen_global_headers <int> E..V...... Generate SPS and PPS headers during codec initialization. (from -1 to 1) (default off)
auto -1 E..V......
off 0 E..V......
on 1 E..V......
-udu_sei <boolean> E..V....... Pass through user data unregistered SEI if available (default true)
-timecode_passthru <boolean> E..V....... Enable passthrough of time code in picture timing / time code SEI if present. (default false)
Arguments
| Argument | Description |
|---|---|
| xcoder | specifies which type of load is used to determine the XCoder card to use, model load or real load. Default: bestmodelload, instructs the system to use the encoder with the least model load |
| enc/ni_enc_idx | assigns the encoding instance to a specific encoder by its index. The default value is -1. If the3.1.1 input is a hardware frame, the encoding instance will be placed on the same device as the hardware frame. If the input is a software frame the encoding instance will be placed on the least loaded encoder. |
| encname/ni_enc_name | assigns the encoding instance to a specific decoder by its NVMe block device name, e.g. /dev/nvme0n1. When specified, this takes precedence over enc. It has no default value and validity check is present. |
| iosize | specifies a custom NVMe I/O transfer size |
| xcoder-params | specifies the encoding configuration using a separated list of key=value parameters. See section 8.4 for more details. |
| xcoder-gop | specifies a custom GOP for encoding using a separated list of key=value parameters. See section 8.4 for details. |
| keep_alive_timeout | specifies a session keep alive timeout value. This is a periodical request/response between libxcoder and XCoder firmware that when timed out, the encoding instance on the encoder will be terminated by the XCoder firmware. Valid range is from 1-100, inclusive. This option is overridden if the keepAliveTimeout option is specified in the xcoder-params. |
| gen_global_headers | specifies whether to generate headers to extradata in advance of first frame arriving at encoder. For H.264/HEVC, the extradata includes the VPS/SPS/PPS headers, while for AV1, it includes the sequence header and related structures at the container level. This is useful for containers such as mkv, hls, asf, and flv which typically require this extradata to ensure that players and decoders are with the video parameters before actual video frames are processed. |
| timecode_passthru | specifies whether the timecode that comes from quadra decoder or SW decoder should be inserted into the picture timing SEI (for H264) or time code SEI (for H265) in the output stream. Note the following limitations for this feature: - Only the first timecode is inserted if multiple timecodes are present from the SW decoders - When using quadra decoder + quadra encoder, timecode_passthru needs to be enabled for both decoder and encoder to properly pass through the timecode - When encoding H.264, The enableTimecode encoder option should be enabled as well for the timecode to be properly registered in picture timing SEI |
Example
Encoding command example using default least model load encoder placement:
ffmpeg -y -hide_banner -nostdin -f rawvideo -pix_fmt yuv420p -s:v 352x288 -r 25 -i ../libxcoder/test/akiyo_352x288p25.yuv -c:v h264_ni_quadra_enc output_7.h264
Transcoding example using default least model load decoder and encoder placement:
ffmpeg -y -hide_banner -nostdin -vsync 0 -c:v h264_ni_quadra_dec -i ../libxcoder/test/1280x720p_Basketball.264 -c:v h265_ni_quadra_enc output_9.h265