The NVIDIA ffmpeg package supports hardware-accelerated decode on Jetson platforms

Hello,

I don’t officially support ffmpeg, so I think I was told to look for mmapi or gstreamer. But I found this.
What is the NVIDIA ffmpeg package?

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fmultimedia.html%23wwpID0ERHA

If I can use ffmpeg, where can I get samples?

Thank you

Hi,
You can get source code by executing:

$ echo "deb https://repo.download.nvidia.com/jetson/ffmpeg main main" |  sudo tee -a /etc/apt/sources.list
$ echo "deb-src https://repo.download.nvidia.com/jetson/ffmpeg main main" |  sudo tee -a /etc/apt/sources.list
$ sudo apt update
$ apt source ffmpeg

Please give it a try.

2 Likes

Is official support correct?

Hi,

Yes, this official package,

1 Like

so to be able to write so I can usar ffmpeg?
ffmpeg -i input_file -c:v h264_nvmpi <output.mp4>

Hi,

The current implementation supports video decoding only. We will add video encoding in future release.

thanks

Any timeline for that release? Can’t we use h264_v4l2m2m or h264_omx for HW accelerated encoding? Can we compile ffmpeg with nvmpi/CUDA support?

Then the only alternative is to use gstreamer?

I don’t see any source packages in that repo @DaneLLL

 $ grep ^Package /var/lib/apt/lists/repo.download.nvidia.com_jetson_ffmpeg_dists_main_main_source_Sources | awk '{print $2}' | sort -u

ffmpeg

 $ dpkg -L ffmpeg
/.
/usr
/usr/bin
/usr/bin/ffmpeg
/usr/bin/ffprobe
/usr/include
/usr/include/libavcodec
/usr/include/libavcodec/ac3_parser.h
/usr/include/libavcodec/adts_parser.h
/usr/include/libavcodec/avcodec.h
/usr/include/libavcodec/avdct.h
/usr/include/libavcodec/avfft.h
/usr/include/libavcodec/d3d11va.h
/usr/include/libavcodec/dirac.h
/usr/include/libavcodec/dv_profile.h
/usr/include/libavcodec/dxva2.h
/usr/include/libavcodec/jni.h
/usr/include/libavcodec/mediacodec.h
/usr/include/libavcodec/qsv.h
/usr/include/libavcodec/vaapi.h
/usr/include/libavcodec/vdpau.h
/usr/include/libavcodec/version.h
/usr/include/libavcodec/videotoolbox.h
/usr/include/libavcodec/vorbis_parser.h
/usr/include/libavcodec/xvmc.h
/usr/include/libavdevice
/usr/include/libavdevice/avdevice.h
/usr/include/libavdevice/version.h
/usr/include/libavfilter
/usr/include/libavfilter/avfilter.h
/usr/include/libavfilter/buffersink.h
/usr/include/libavfilter/buffersrc.h
/usr/include/libavfilter/version.h
/usr/include/libavformat
/usr/include/libavformat/avformat.h
/usr/include/libavformat/avio.h
/usr/include/libavformat/version.h
/usr/include/libavutil
/usr/include/libavutil/adler32.h
/usr/include/libavutil/aes.h
/usr/include/libavutil/aes_ctr.h
/usr/include/libavutil/attributes.h
/usr/include/libavutil/audio_fifo.h
/usr/include/libavutil/avassert.h
/usr/include/libavutil/avconfig.h
/usr/include/libavutil/avstring.h
/usr/include/libavutil/avutil.h
/usr/include/libavutil/base64.h
/usr/include/libavutil/blowfish.h
/usr/include/libavutil/bprint.h
/usr/include/libavutil/bswap.h
/usr/include/libavutil/buffer.h
/usr/include/libavutil/camellia.h
/usr/include/libavutil/cast5.h
/usr/include/libavutil/channel_layout.h
/usr/include/libavutil/common.h
/usr/include/libavutil/cpu.h
/usr/include/libavutil/crc.h
/usr/include/libavutil/des.h
/usr/include/libavutil/dict.h
/usr/include/libavutil/display.h
/usr/include/libavutil/downmix_info.h
/usr/include/libavutil/encryption_info.h
/usr/include/libavutil/error.h
/usr/include/libavutil/eval.h
/usr/include/libavutil/ffversion.h
/usr/include/libavutil/fifo.h
/usr/include/libavutil/file.h
/usr/include/libavutil/frame.h
/usr/include/libavutil/hash.h
/usr/include/libavutil/hdr_dynamic_metadata.h
/usr/include/libavutil/hmac.h
/usr/include/libavutil/hwcontext.h
/usr/include/libavutil/hwcontext_cuda.h
/usr/include/libavutil/hwcontext_d3d11va.h
/usr/include/libavutil/hwcontext_drm.h
/usr/include/libavutil/hwcontext_dxva2.h
/usr/include/libavutil/hwcontext_mediacodec.h
/usr/include/libavutil/hwcontext_qsv.h
/usr/include/libavutil/hwcontext_vaapi.h
/usr/include/libavutil/hwcontext_vdpau.h
/usr/include/libavutil/hwcontext_videotoolbox.h
/usr/include/libavutil/imgutils.h
/usr/include/libavutil/intfloat.h
/usr/include/libavutil/intreadwrite.h
/usr/include/libavutil/lfg.h
/usr/include/libavutil/log.h
/usr/include/libavutil/lzo.h
/usr/include/libavutil/macros.h
/usr/include/libavutil/mastering_display_metadata.h
/usr/include/libavutil/mathematics.h
/usr/include/libavutil/md5.h
/usr/include/libavutil/mem.h
/usr/include/libavutil/motion_vector.h
/usr/include/libavutil/murmur3.h
/usr/include/libavutil/opt.h
/usr/include/libavutil/parseutils.h
/usr/include/libavutil/pixdesc.h
/usr/include/libavutil/pixelutils.h
/usr/include/libavutil/pixfmt.h
/usr/include/libavutil/random_seed.h
/usr/include/libavutil/rational.h
/usr/include/libavutil/rc4.h
/usr/include/libavutil/replaygain.h
/usr/include/libavutil/ripemd.h
/usr/include/libavutil/samplefmt.h
/usr/include/libavutil/sha.h
/usr/include/libavutil/sha512.h
/usr/include/libavutil/spherical.h
/usr/include/libavutil/stereo3d.h
/usr/include/libavutil/tea.h
/usr/include/libavutil/threadmessage.h
/usr/include/libavutil/time.h
/usr/include/libavutil/timecode.h
/usr/include/libavutil/timestamp.h
/usr/include/libavutil/tree.h
/usr/include/libavutil/twofish.h
/usr/include/libavutil/tx.h
/usr/include/libavutil/version.h
/usr/include/libavutil/xtea.h
/usr/include/libswresample
/usr/include/libswresample/swresample.h
/usr/include/libswresample/version.h
/usr/include/libswscale
/usr/include/libswscale/swscale.h
/usr/include/libswscale/version.h
/usr/lib
/usr/lib/libavcodec.a
/usr/lib/libavcodec.so.58.54.100
/usr/lib/libavdevice.a
/usr/lib/libavdevice.so.58.8.100
/usr/lib/libavfilter.a
/usr/lib/libavfilter.so.7.57.100
/usr/lib/libavformat.a
/usr/lib/libavformat.so.58.29.100
/usr/lib/libavutil.a
/usr/lib/libavutil.so.56.31.100
/usr/lib/libswresample.a
/usr/lib/libswresample.so.3.5.100
/usr/lib/libswscale.a
/usr/lib/libswscale.so.5.5.100
/usr/lib/pkgconfig
/usr/lib/pkgconfig/libavcodec.pc
/usr/lib/pkgconfig/libavdevice.pc
/usr/lib/pkgconfig/libavfilter.pc
/usr/lib/pkgconfig/libavformat.pc
/usr/lib/pkgconfig/libavutil.pc
/usr/lib/pkgconfig/libswresample.pc
/usr/lib/pkgconfig/libswscale.pc
/usr/share
/usr/share/doc
/usr/share/doc/ffmpeg
/usr/share/doc/ffmpeg/changelog.Debian.gz
/usr/share/doc/ffmpeg/copyright
/usr/share/ffmpeg
/usr/share/ffmpeg/examples
/usr/share/ffmpeg/examples/Makefile
/usr/share/ffmpeg/examples/README
/usr/share/ffmpeg/examples/avio_dir_cmd.c
/usr/share/ffmpeg/examples/avio_reading.c
/usr/share/ffmpeg/examples/decode_audio.c
/usr/share/ffmpeg/examples/decode_video.c
/usr/share/ffmpeg/examples/demuxing_decoding.c
/usr/share/ffmpeg/examples/encode_audio.c
/usr/share/ffmpeg/examples/encode_video.c
/usr/share/ffmpeg/examples/extract_mvs.c
/usr/share/ffmpeg/examples/filter_audio.c
/usr/share/ffmpeg/examples/filtering_audio.c
/usr/share/ffmpeg/examples/filtering_video.c
/usr/share/ffmpeg/examples/http_multiclient.c
/usr/share/ffmpeg/examples/hw_decode.c
/usr/share/ffmpeg/examples/metadata.c
/usr/share/ffmpeg/examples/muxing.c
/usr/share/ffmpeg/examples/qsvdec.c
/usr/share/ffmpeg/examples/remuxing.c
/usr/share/ffmpeg/examples/resampling_audio.c
/usr/share/ffmpeg/examples/scaling_video.c
/usr/share/ffmpeg/examples/transcode_aac.c
/usr/share/ffmpeg/examples/transcoding.c
/usr/share/ffmpeg/examples/vaapi_encode.c
/usr/share/ffmpeg/examples/vaapi_transcode.c
/usr/share/ffmpeg/ffprobe.xsd
/usr/share/ffmpeg/libvpx-1080p.ffpreset
/usr/share/ffmpeg/libvpx-1080p50_60.ffpreset
/usr/share/ffmpeg/libvpx-360p.ffpreset
/usr/share/ffmpeg/libvpx-720p.ffpreset
/usr/share/ffmpeg/libvpx-720p50_60.ffpreset
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/ffmpeg-all.1.gz
/usr/share/man/man1/ffmpeg-bitstream-filters.1.gz
/usr/share/man/man1/ffmpeg-codecs.1.gz
/usr/share/man/man1/ffmpeg-devices.1.gz
/usr/share/man/man1/ffmpeg-filters.1.gz
/usr/share/man/man1/ffmpeg-formats.1.gz
/usr/share/man/man1/ffmpeg-protocols.1.gz
/usr/share/man/man1/ffmpeg-resampler.1.gz
/usr/share/man/man1/ffmpeg-scaler.1.gz
/usr/share/man/man1/ffmpeg-utils.1.gz
/usr/share/man/man1/ffmpeg.1.gz
/usr/share/man/man1/ffprobe-all.1.gz
/usr/share/man/man1/ffprobe.1.gz
/usr/share/man/man3
/usr/share/man/man3/libavcodec.3.gz
/usr/share/man/man3/libavdevice.3.gz
/usr/share/man/man3/libavfilter.3.gz
/usr/share/man/man3/libavformat.3.gz
/usr/share/man/man3/libavutil.3.gz
/usr/share/man/man3/libswresample.3.gz
/usr/share/man/man3/libswscale.3.gz
/usr/lib/libavcodec.so
/usr/lib/libavcodec.so.58
/usr/lib/libavdevice.so
/usr/lib/libavdevice.so.58
/usr/lib/libavfilter.so
/usr/lib/libavfilter.so.7
/usr/lib/libavformat.so
/usr/lib/libavformat.so.58
/usr/lib/libavutil.so
/usr/lib/libavutil.so.56
/usr/lib/libswresample.so
/usr/lib/libswresample.so.3
/usr/lib/libswscale.so
/usr/lib/libswscale.so.5
/etc/ffserver.conf

It would be very nice if you could add a source package as well since ffmpeg is LGPL.

Hi,
Please try

nvidia@nvidia-desktop:~/ffmpeg$ apt source ffmpeg
Reading package lists... Done
Need to get 9105 kB of source archives.
Get:1 https://repo.download.nvidia.com/jetson/ffmpeg main/main ffmpeg 7:4.2.2-nvidia (dsc) [592 B]
Get:2 https://repo.download.nvidia.com/jetson/ffmpeg main/main ffmpeg 7:4.2.2-nvidia (tar) [9104 kB]
Fetched 9105 kB in 12s (744 kB/s)
dpkg-source: info: extracting ffmpeg in ffmpeg-4.2.2
dpkg-source: info: unpacking ffmpeg_4.2.2-nvidia.tar.xz
nvidia@nvidia-desktop:~/ffmpeg$ grep NvBufferCreateEx ./ -r
./ffmpeg-4.2.2/libavcodec/nvv4l2_dec.c:    ret_val = NvBufferCreateEx(&ctx->dst_dma_fd, &input_params);
./ffmpeg-4.2.2/libavcodec/nvv4l2_dec.c:                NvBufferCreateEx(&ctx->dmabuff_fd[index], &cap_params);

You should be able to see the code implemented through NvBuffer APIs.

1 Like

Thanks, @DaneLLL !

I thought dpkg -L would show it but apparently not.

You forgot to change the output format,alway AV_PIX_FMT_YUV420P
on nvv4l2_dec.c line 1331
frame->format = AV_PIX_FMT_YUV420P;

Hello,

How can I fix it?

Thank you

Hello,

Why withdraw it?

thank you

I too am looking to use ffmpeg for encoding.

I have a txt file containing thousands of images to make a time-lapse video. I was suggested to use gstreamer, but its not possible because of my file names not being in 00000 000001 000002 format, but rather date format.

ffmpeg -f concat -i /media/nvidia/SCOUT/timelapse/concat.txt -y -r 30 -vcodec libx264 /media/nvidia/SCOUT/timelapse/cam3.mp4

Anyone know if there is a way to encode in ffmpeg yet using hardware?

@ icepicknz
Not the answer to your question, but you could use Bulk Rename Utility (https://www.bulkrenameutility.co.uk/Download.php) to number your images

Maybe it helps

1 Like

Ffmpeg hardware encoding is not yet available. I would recommend doing what the above poster suggests and renaming your files. You can either use the closed source utility he suggests or write a script to do it.

Hi, is now supported video encoding?

Hi,

No, hardware video encoding is not supported on latest r32.4.3.

1 Like

Hello,

Now, is hardware video encoding supported?

Thank you.