How to Transcode Video to Lossless FFV1 with FFmpeg
This guide provides a straightforward tutorial on how to transcode video files into the high-end, mathematically lossless FFV1 format using FFmpeg. You will learn the exact command-line syntax, key parameters required for digital preservation, and how to optimize the encoding process for speed and multi-threaded performance.
The Basic FFV1 Conversion Command
To convert any video to FFV1 with its original audio stream left untouched, use the following basic FFmpeg command:
ffmpeg -i input.mp4 -c:v ffv1 -c:a copy output.mkv-i input.mp4: Specifies the source video file.-c:v ffv1: Sets the video codec to FFV1.-c:a copy: Copies the audio stream without re-encoding to preserve its original quality.output.mkv: The output file. The Matroska (.mkv) container is highly recommended for FFV1.
Recommended Command for Archival Preservation (FFV1 Version 3)
For professional archiving and digital preservation, you should use FFV1 Version 3. This version supports multi-threading, slice-level CRC checksums for error detection, and better compression.
Use this optimized command for high-performance, archival-grade transcoding:
ffmpeg -i input.mp4 -c:v ffv1 -level 3 -coder 1 -context 1 -g 1 -slices 24 -slicecrc 1 -c:a flac output.mkvExplanation of Advanced Parameters
-level 3: Forces the use of FFV1 Version 3, which enables multi-threading and self-description metadata.-coder 1: Enables Range Coder, which offers superior compression compared to Golomb-Rice coding.-context 1: Uses adaptive context models for better compression efficiency.-g 1: Sets the GOP (Group of Pictures) size to 1. This ensures every frame is an intra-frame (keyframes only), making the file easier to edit, decode, and preserve.-slices 24: Splits each frame into multiple slices for multi-threaded processing. Use a number that aligns with your CPU threads (e.g., 4, 8, 12, 16, or 24) to drastically speed up encoding and decoding.-slicecrc 1: Writes a CRC checksum for every slice. This allows media players and archival software to detect file corruption down to the specific frame level.-c:a flac: Transcodes the audio to FLAC (Free Lossless Audio Codec) to ensure the entire output file is 100% lossless.
Preserving Pixel Format and Color Space
FFmpeg will automatically attempt to choose the correct pixel format.
However, if you want to explicitly preserve the exact color depth and
chroma subsampling of your source file (such as 10-bit YUV 4:2:2), add
the -pix_fmt flag:
ffmpeg -i input.mp4 -c:v ffv1 -level 3 -pix_fmt yuv422p10le -c:a copy output.mkvCommon lossless pixel formats for FFV1 include: *
yuv420p: Standard 8-bit 4:2:0 (common for
web video). * yuv422p10le: 10-bit 4:2:2
(common for professional broadcast and digitization). *
rgb24: 8-bit RGB (best for screen
recordings or graphics).