Jigsaw X264 Guide
The legacy of x264 is also a testament to the power of open-source collaboration. While the H.264 standard was encased in patent pools and licensing fees, the x264 project, led by developers like Loren Merritt, Jason Garrett-Glaser, and others, provided a free, high-performance alternative. It became the engine behind platforms like YouTube and Netflix during their formative years and the standard for scene releases and piracy groups. It democratized high-definition video, allowing users with modest hardware to watch crisp 1080p content.
Overhead is due to slice reordering and header patching.
Decoded streams play in VLC, ffplay, and hardware decoders (after reverse permutation). Without the key, players show scrambled “jigsaw” artifacts.
The permutation key is transported via SEI (Supplemental Enhancement Information) messages encrypted with a pre-shared key (e.g., using AES-128-GCM). This allows the decoder to reverse the permutation before entropy decoding. jigsaw x264
If an attacker obtains one unencrypted frame (e.g., via side channel), they cannot deduce future permutations because the PRNG state advances with each frame (key is re-seeded per GOP using a counter).
A jigsaw cipher decomposes a media frame into tiles (e.g., 64×64 blocks). A permutation key ( K ) defines a mapping: [ \textposition \textnew = \pi_K(\textposition \textold) ] Decryption requires the inverse permutation. Unlike AES-CBC, jigsaw does not expand data but relies on structural scrambling.
| Mode | Encode time (fps) | Bitrate (kbps) | Decode time (fps) | |------|------------------|----------------|-------------------| | x264 baseline | 124.3 | 4520 | 285.7 | | Jigsaw x264 | 114.5 (-7.9%) | 4532 (+0.27%) | 267.2 (-6.5%) | The legacy of x264 is also a testament
ffmpeg -jigsaw-key deadbeef12345678 -i encrypted.264 output.mp4
We modified x264 version r3101 (commit 6b9d5a9) with the following changes:
Motion vectors are not scrambled. An attacker seeing only encrypted streams might infer object trajectories. Mitigation: apply jigsaw at picture level instead of slice level (higher overhead). via side channel)
| Method | Bitrate Overhead | Decoder Compat | Security Level | |--------|----------------|----------------|----------------| | AES-CBC full | +15% | No (needs custom dec) | High | | Jigsaw x264 | +0.3% | Yes (permute only) | Medium (structural) |
– Slice sizes differ, revealing permutation mapping. Mitigation: pad slices to uniform size (increases overhead to ~5%).