Skip to content

Releases: hamr-hub/jetson-ffmpeg-tutorial

v1.0.0 — Initial release for FFmpeg on Jetson Orin (L4T r36.4)

Choose a tag to compare

@hamr-hub hamr-hub released this 15 Sep 15:25

v1.0.0 — Initial release

Tested with FFmpeg git-2026-09-15-aa63c63 on:

  • Jetson Orin (t234)
  • L4T 36.4.7 (JetPack 6)
  • Ubuntu 22.04.5 LTS
  • CUDA 12.6.68
  • Driver 540.4.0

What's included

  • scripts/build.sh — one-shot apt + configure + make + install
  • scripts/rebuild.sh — incremental rebuild after source edits
  • scripts/ffmpeg-gpu-decode.sh — end-to-end GPU decode wrapper
  • scripts/libv4l2_shim.c — LD_PRELOAD shim for v4l2 interception
  • patches/00-jetson-v4l2-m2m.diff — three source patches to upstream FFmpeg:
    1. extend /dev/v4l2-* device scan
    2. replace probe VIDIOC_TRY_FMT with VIDIOC_S_FMT
    3. use V4L2_MEMORY_DMABUF for buffer allocation
  • docs/build.md — full build walk-through
  • docs/gpu-integration.md — how the shim works
  • docs/comparison.md — why the wrapper, not direct ffmpeg -c:v h264_v4l2m2m
  • docs/troubleshooting.md — common errors and fixes

What works

  • All 10 CUVID decoders + 3 NVENC encoders + 9 v4l2m2m decoders + 5 v4l2m2m encoders are compiled in.
  • hwaccels shows cuda and drm.
  • The LD_PRELOAD shim + patches let ffmpeg open /dev/v4l2-nvdec and reach NvMMLiteBlockCreate : Block : BlockType = 261 (Jetson NVDEC session creation).
  • End-to-end GPU decode via ffmpeg-gpu-decode.sh (gstreamer nvv4l2decoder → ffmpeg): 141 frames at 1366×768 decode in ~3 s on the integrated NVDEC.

Known limitations

  • h264_cuvid does not work on Jetson: L4T ships libnvcuvidv4l2.so, but FFmpeg's cuvid glue expects libnvcuvid.so.1 (incompatible ABIs).
  • h264_nvenc does not work with FFmpeg ≥ 7.x: those releases require driver ≥ 610 for NVENC API; L4T 36.4 ships 540.4.0. Use libx264 or pin FFmpeg to 6.1.
  • Direct ffmpeg -c:v h264_v4l2m2m -i in.mp4 -frames:v 30 out.mp4 does not produce frames despite the patches + shim: the Jetson libv4l2_nvvideocodec plugin accepts REQBUF but QUERYBUF fails. Use ffmpeg-gpu-decode instead.
  • scale_cuda and other CUDA filters fail with CUDA_ERROR_OUT_OF_MEMORY because NvMap allocation requires privileges not granted to non-root users on r36.4.

See docs/comparison.md for the full design rationale.