Skip to content
/ pivid Public

Experimental video code for Linux / Raspberry Pi

License

Notifications You must be signed in to change notification settings

egnor/pivid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pivid

Experimental video code for Linux / Raspberry Pi

Building

  1. Use a Raspberry Pi with a fully updated bullseye install and 2G+ RAM.
  2. Edit /boot/config.txt as follows, and reboot:
#dtoverlay=vc4-fkms-v3d  # Comment/remove old dtoverlay=vc4* lines
# Use full KMS and H.265 (HEVC) decoding, 512M CMA for frames
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=rpivid-v4l2
  1. Run ./dev_setup.py. (Works On My Machine™, YMMV)
  2. Run ninja -C build to run the actual build (this is the only part to repeat after edits).
  3. Run binaries from build (like build/pivid_test_playback).
  4. If things get weird, rm -rf build and start over with dev_setup.py.

Notable programs:

  • pivid_test_playback - play a video file via KMS/DRM (stop X first)
  • pivid_inspect_avformat - print a summary of streams in a video file
  • pivid_inspect_kms - print capabilities & properties of KMS/DRM devices
  • pivid_inspect_v4l2 - print capabilities & properties of V4L2 devices

Use --help to see usage (and/or read the source).

Notes and links

Raspberry Pi specifics

Graphics output: DRM and KMS

Notes on DRM and KMS:

  • These interfaces are almost completely undocumented. Learn by examples.
  • But, many examples use "legacy" interfaces, prefer "atomic" update interfaces.

Video decoding: V4L2

Zero-copy buffer sharing

Notes on memory management:

  • GPUs have all kinds of memory architectures. (The RPi is simple, everything is in CPU RAM without dedicated GPU RAM.)
  • DRM/KMS requires you to define a "framebuffer", giving it one or more "buffer objects" (aka "GEM handles") (opaque int32).
  • "DRM-PRIME" is a fancy name for ioctl's (DRM_IOCTL_PRIME_FD_TO_HANDLE and vice versa) to convert GEM handles to/from "dma-buf" descriptors.
  • On the Pi, memory is simple, so buffers allocated anywhere (V4L2, DRM, etc) can be used anywhere else (shared via "dma-buf").
  • Of course you need to get the data format right.

About

Experimental video code for Linux / Raspberry Pi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages