Hardware Video (MFC) & JPEG Codecs
Google Tensor GS101 includes Samsung’s Exynos MFC v14 hardware video codec engine (/dev/video6 decode, /dev/video7 encode) and Exynos SMFC hardware JPEG engine (/dev/video12). Because stock FFmpeg v4l2m2m fails on Exynos MFC’s strict DMA-BUF, plane-ordering, and EOS ioctl requirements, headless-phone ships purpose-built zero-copy V4L2 M2M CLIs.
Verified Performance (Pixel 6 Pro raven)
Section titled “Verified Performance (Pixel 6 Pro raven)”| Engine | Device Node | Codecs / Formats | Measured Live Speed |
|---|---|---|---|
| MFC Encode | /dev/video7 + /dev/dma_heap/system |
H.264, HEVC, VP8, VP9 | 251 FPS 1080p H.264; 84.8 FPS 4K HEVC at 0.67 W SoC |
| MFC Decode | /dev/video6 + /dev/dma_heap/system |
H.264, HEVC, VP8, VP9, AV1 | 464.7 FPS 1080p H.264; 156.6 FPS 4K HEVC |
| SMFC JPEG | /dev/video12 (USERPTR) |
Baseline JFIF (nv12, rgb24, bgr24, yuyv) |
3.7 ms 720p enc / 4.6 ms dec; 28.5 ms 4K enc |
Hardware Video Encoding (mfc-encode)
Section titled “Hardware Video Encoding (mfc-encode)”Allocates zero-copy V4L2_MEMORY_DMABUF buffers from /dev/dma_heap/system (requires sudo because /dev/dma_heap/system is root-only by default), automatically enables frame rate control, GOP sizing, SPS/PPS prepending on H.264/HEVC IDR frames, and IVF framing for VP8/VP9.
Requires ffmpeg (sudo apt install ffmpeg) to decode/demux the input and mux .mp4/.mkv/.webm output (adds -movflags +faststart on .mp4, forces TCP on rtsp://, and copies audio from local files unless --no-audio is set):
# Transcode a file to hardware HEVC MP4sudo mfc-encode -i input.mp4 --codec hevc --bitrate 8M -o out_hevc.mp4
# Synthetic 4K HEVC test pattern (5s @ 30 fps)sudo mfc-encode \ --test-pattern --width 3840 --height 2160 --fps 30 --duration 5 \ --codec hevc --bitrate 15M -o out_4k.mp4Works with zero ffmpeg dependency — ideal for piping directly from camera-ctl:
# Camera NV12 -> hardware H.264 raw bitstreamsudo camera-ctl stream --camera 0.3 --width 1280 --height 720 --fps 15 --frames 150 \ | sudo mfc-encode --raw-nv12 -i - --width 1280 --height 720 --fps 15 --bitrate 2M --codec h264 -o live.h264
# Pipe output bitstream to stdout (-o -) for downstream RTSP remuxingsudo camera-ctl stream --camera 0.2 --width 1280 --height 720 --fps 15 \ | sudo mfc-encode --raw-nv12 -i - --width 1280 --height 720 --fps 15 --bitrate 2M --gop 30 --codec h264 -o - \ | ffmpeg -f h264 -framerate 15 -i pipe:0 -c:v copy -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:8554/cammfc-encode Flags
Section titled “mfc-encode Flags”| Flag | Default | Description |
|---|---|---|
-i, --input <STR> |
(none) | Input file, stream URL, or - for stdin (omit when using --test-pattern). |
-o, --output <STR> |
(required) | Output container (.mp4/.mkv/.ts/.m2ts/.mov/.webm), raw bitstream (.h264/.hevc/.ivf/.vp8/.vp9), or - for stdout. |
--raw-nv12 |
Off | Read packed NV12 frames directly without ffmpeg (requires --input, --width, --height). |
--test-pattern |
Off | Generate synthetic ffmpeg testsrc2 input (defaults: 1920×1080, 30.0 fps, 5.0 s). |
--codec |
h264 |
h264, hevc, vp8, or vp9. |
--width, --height |
Auto / 1920×1080 |
Even integers >= 32 (must be given together). |
--fps <FLOAT> |
Probed / 30.0 |
Frame rate. |
--duration <FLOAT> |
Full / 5.0 |
Optional duration cap in seconds (ffmpeg / --test-pattern mode). |
--bitrate <STR> |
4000000 |
Target bitrate in bps, or with k/M suffix (e.g. 2.5M, 500k). |
--gop <INT> |
60 |
Keyframe interval (>= 1). |
--no-audio |
Off | Omit audio copy when muxing local container files. |
--device / --dma-heap |
/dev/video7 / /dev/dma_heap/system |
V4L2 encoder node and DMA-BUF heap path. |
--out-buffers / --cap-buffers |
4 / 4 |
V4L2 output and capture queue depths (>= 1). |
-v, --verbose |
Off | Log V4L2 negotiation and redacted ffmpeg commands to stderr. |
Hardware Video Decoding (mfc-decode)
Section titled “Hardware Video Decoding (mfc-decode)”Decodes raw Annex-B/IVF bitstreams or container files (.mp4/.mkv/.ts/.m2ts/.mov/.webm/.avi, demuxed with ffmpeg -c:v copy — zero CPU video decoding) into cropped visible NV12 frames via /dev/video6 and /dev/dma_heap/system.
# Benchmark hardware decode throughput without writing pixelssudo mfc-decode clip.mp4 --null --json
# Decode first 100 frames of a 4K HEVC bitstream to raw NV12sudo mfc-decode clip.hevc --codec hevc --max-frames 100 -o decoded.nv12
# Stream decoded NV12 to stdout while logging JSON stats to stderrsudo mfc-decode clip.mp4 -o - --json > frames.nv12mfc-decode Flags
Section titled “mfc-decode Flags”| Flag / Argument | Default | Description |
|---|---|---|
input (positional) |
(required) | Input bitstream (.h264/.hevc/.vp8/.vp9/.av1/.ivf) or container (.mp4/.mkv/.webm/...). |
-o, --output <STR> |
"" |
Output raw NV12 path, - for stdout, or omit / --null for benchmark-only decode. |
--null |
Off | Hardware decode without writing pixel output. |
--codec |
auto |
auto, h264, hevc, vp8, vp9, or av1. |
--max-frames <INT> |
0 (all) |
Stop after decoding N frames. |
--device / --dma-heap |
/dev/video6 / /dev/dma_heap/system |
V4L2 decoder node and DMA-BUF heap path. |
--json |
Off | Emit decode statistics as JSON (sent to stderr when -o -). |
Hardware JPEG Codec (hw-jpeg)
Section titled “Hardware JPEG Codec (hw-jpeg)”Drives Samsung Exynos SMFC (/dev/video12) via V4L2_MEMORY_USERPTR. Because /dev/video12 is accessible to the video group, hw-jpeg works without sudo for the default user.
# Encode a P6 PPM image to hardware JPEG (auto-detects dimensions & rgb24)hw-jpeg encode frame.ppm -o frame.jpg --quality 90
# Encode raw NV12 pixels from camera-ctl snapshothw-jpeg encode frame.nv12 -o frame.jpg --pix-fmt nv12 --width 1280 --height 720 -q 85
# Decode a baseline JFIF JPEG back to P6 PPM or raw NV12hw-jpeg decode frame.jpg -o decoded.ppmhw-jpeg decode frame.jpg -o decoded.nv12 --pix-fmt nv12
# Run an in-memory hardware encode + decode round-trip benchmarkhw-jpeg benchmark --width 3840 --height 2160 --pix-fmt nv12 --iters 20 --jsonhw-jpeg Subcommands & Flags
Section titled “hw-jpeg Subcommands & Flags”Top-level option: --device <PATH> (default /dev/video12). Supported --pix-fmt: nv12, rgb24, bgr24, yuyv. Dimensions: 16..16384. Baseline SOF0 JFIF only (progressive SOF2 JPEGs are explicitly rejected).
| Subcommand | Arguments & Defaults |
|---|---|
encode |
<input> (positional), -o/--output <PATH> (required), --pix-fmt rgb24, --width 0 (auto for .ppm), --height 0, -q/--quality 90 (1..100) |
decode |
<input> (positional), -o/--output <PATH> (required), --pix-fmt rgb24 (auto rgb24 if output ends in .ppm) |
benchmark |
--width 1280, --height 720, --pix-fmt nv12, -q/--quality 90, --iters 10, --json |