ffmpeg hardware acceleration on jetson

l4t multimedia api based development

Hardware-accelerated encoding of H.264 and HEVC
Hardware-accelerated decoding of VP8 VP9 MPEG2 H.264 and HEVC



Hi jocover,
are you planning to add hw-accelerated jpeg encoding support in ffmpeg?

no plans to support jpeg encoders

Hi jocover,
I can see the implementation is meant for jetson nano but wondering if it would work on jetson tx2 ?
For me when I try to build the source on Tx2, it fails :

jetson-ffmpeg/nvmpi_enc.cpp:263:40: error: ‘V4L2_PIX_FMT_YUV444M’ was not declared in this scope

Thank You

Hi JoCover,

We are planning to use ffmpeg library with your patch on Jetson Nano to get a compressed bitstream from raw image frames captured from a camera. As a precursor, we developed a small class based on FFMpeg on windows platform and tested the same on a stored image sequence file to generate the H.265 bitstream. 
However, when I run the same code on jetson nano board, I see that the avcodec_open2 function return error. I am attaching the initialisation code used below. Please help as I am not getting any sample codes to clarify the doubts

bool VideoCodec::initialise()
codec = avcodec_find_encoder(AV_CODEC_ID_H265);
if (!codec) {
return false;

context = avcodec_alloc_context3(codec);
packet = av_packet_alloc();
if (!packet)
	return false;

if(!decoder_flag)	{
	/* put sample parameters */
	context->bit_rate = 2000000;
	/* resolution must be a multiple of two */
	context->width = 512;
	context->height = 512;

	/* frames per second */
	context->time_base = av_make_q(1, 25);
	context->framerate = av_make_q(25, 1);

	/* emit one intra frame every ten frames
	 * check frame pict_type before passing frame
	 * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
	 * then gop_size is ignored and the output of encoder
	 * will always be I frame irrespective to gop_size
	context->gop_size = 8;
	context->max_b_frames = 1;
	context->pix_fmt =  AV_PIX_FMT_GRAY8;

/* open it */
int ret = avcodec_open2(context, codec, NULL);
if (ret < 0) {
	char err[200];
	av_strerror(ret, err, 200);
	std::cout << "Error: " << err << std::endl;
	return false;

frame = av_frame_alloc();
if (!frame) 
	return false;

frame->format = context->pix_fmt;
frame->width = context->width;
frame->height = context->height;

ret = av_frame_get_buffer(frame, 0);
if (ret < 0) 
	return false;

ret = av_frame_make_writable(frame);
if (ret < 0)
	return false;

return true;


Just compiled on TX2 and works as charm.