Optimizing FFV1
for Apple Silicon

... and others

 

 

Jérôme Martinez

No Time to Wait 10, October 2026

FFV1 on the GPU

Vulkan encoder and decoder in FFmpeg since 8.0 (August 2025)

Vulkan: well supported on Windows and Linux

Apple Silicon: no native Vulkan, so CPU only for now

 

CNA: Let's try to see what can be done

Vulkan on macOS

MediaArea now delivers FFmpeg builds with Vulkan support for macOS

Also development snaphots for the latest developments

 

Still needed: the Vulkan "driver" (KosmicKrisp), installed on the machine

→ macOS 26 required

Acceptable: let's focus on the future, and keep working with Vulkan

FFV1 on Apple M4

EncodingDecoding
GPUCPUGPUCPU
2K 10-bit2.79x2.39x1.27x1.93x
4K 10-bit0.75x0.67x0.33x0.52x
4K 16-bit0.29x0.26x0.26x0.21x
6K overscan 10-bit0.24x0.21x0.09x0.16x
6K overscan 16-bit0.09x0.08x0.08x0.06x
8K 10-bit0.22x0.20x0.08x0.15x
8K 16-bit0.08x0.07x0.07x0.05x

Speed in x real time. Encoding: GPU 11-17% faster. Decoding: GPU 20-36% faster in 16-bit, 34-43% slower in 10-bit

What about native Metal?

Initial plan: a native Metal proof of concept

 

With KosmicKrisp, the Vulkan driver for Metal...

... and the theoretical potential performance of the GPU...

 

A port to the Metal API is not worth the effort, for now

The CPU is idle

Now we have Apple Silicon GPU support...

... and while the GPU decodes, the CPU waits

Let's use both at the same time!

 

Easy way: 2 FFmpeg processes on 2 different files

  • Good if you have several files to handle
  • Not for a single file, nor for real-time decoding

A hybrid decoder

Prototype: CPU and GPU decoders working at the same time on the same stream

FFV1 CPU decoder GPU decoder Rebuild DPX MD5 check CPU CPU

Use case: RAWcooked. FFV1 decoding, rebuild of the original DPX files, MD5 hash to make sure that the decoding was fine

First try: not so good

Let's do some profiling...

FFV1 CPU decoder GPU decoder Rebuild DPX MD5 check CPU CPU, a lot

With the GPU decoder, the CPU is still used for the MD5 hash

It takes a lot of CPU time, not available for the CPU decoder

MD5 with SIMD

Let's optimize the MD5 hash with SIMD instructions

 

Better!

 

Lesson: profile the whole pipeline, not only the codec

RAWcooked results

Hybrid decoder: decoding + rebuild of the DPX files + MD5 hash
6464x4852 16-bit per component overscan scan, Apple M4

CPU only GPU only Hybrid 0.05x real time 0.08x real time 0.11x real time CPU + GPU 90% of CPU + GPU

Hybrid: 2x faster than CPU only, 1.5x faster than GPU only

~90% of the theoretical CPU + GPU speed

What does it mean?

6K 16-bit overscan is huge: not real time on such a machine

 

But a classic 4K 10-bit scan: decoding 3/4 of real time

On a laptop-class chip

 

4K 10-bit real time expected on M4 Pro / M4 Max
(to be confirmed)

Not only for Apple Silicon

Currently implemented in the RAWcooked decoder only

 

As we were there for Apple Silicon... we made it generic

  • macOS
  • Linux and Windows too
    (with a RAWcooked GPU license key)

 

In the next version of RAWcooked

Hybrid: more machines

RAWcooked decoding + DPX + MD5, same 6464x4852 16-bit overscan scan, x real time

CPU only GPU only Hybrid CPU + GPU (theoretical) 0.05x0.08x0.11x 0.05x0.14x0.18x 0.13x0.25x0.36x 0.16x0.62x0.51x Apple M4 i7-7800XRTX 3050 Core Ultra 9 285HXRTX PRO 4000 i7-13700KRTX 5070 Ti (OC) 90% of max 95% of max 95% of max slower than GPU only

Apple M4 "only" 90%: MD5 hash is partially responsible, M4 SIMD has 4 lanes vs 8 on x64

RTX 5070 Ti: it does not work yet. A GPU so powerful that it saturates the CPU? More tests needed

Next steps

Hybrid decoding directly in FFmpeg?

Not with the current workflow. We need to see how other tools could use this possibility

VLC or QCTools decoder module?

Hybrid encoding in RAWcooked?

Support of more than 1 GPU?

Could be the next steps...

 

Who is interested?

Lessons learned

  • One GPU code base (Vulkan) rather than one per platform
  • Native Metal port: not worth the effort, for now
  • Profile the whole pipeline (MD5!)
  • Use all the silicon: CPU + GPU
  • Upstream improvements benefit everyone

Thank you CNA for sponsoring this!

Stay in touch

MediaArea: https://mediaarea.net, @MediaArea_net

RAWcooked: https://MediaArea.net/RAWcooked

Jérôme Martinez: jerome@mediaarea.net

Slides: https://MediaArea.net/Events

License (except images): CC BY