How to Write Video to NUT Format Using FFmpeg

This article provides a practical guide on how to use FFmpeg to write and package video files into the high-performance NUT container format. You will learn the basic FFmpeg command syntax for muxing existing streams, re-encoding video into NUT, and utilizing this format for lossless video archiving.

Understanding the NUT Container

The NUT container (.nut) is a high-performance, open-source multimedia container developed by FFmpeg and MPlayer programmers. It is designed to be simple, low-overhead, highly resilient to file corruption, and capable of holding virtually any video, audio, and subtitle codec. Because it writes index information dynamically, it is an excellent choice for streaming, recording, and archiving where system crashes or interruptions might otherwise ruin a file.

Basic Command: Copying Streams to NUT

If you already have a video file (such as an MP4 or MKV) and want to place its existing video and audio streams into a NUT container without re-encoding, you can use the stream copy mode. This process is extremely fast and preserves the original quality.

ffmpeg -i input.mp4 -c copy output.nut

Encoding Video to NUT

If you need to compress or change the codec of your video while writing to the NUT format, you must specify the desired video and audio encoders.

High-Quality H.264 and AAC Encoding

To encode a video to standard H.264 video and AAC audio inside the NUT container, use the following command:

ffmpeg -i input.mov -c:v libx264 -crf 20 -c:a aac -b:a 192k output.nut

Lossless Archiving with FFV1 and FLAC

The NUT container is widely used in digital preservation and archiving because it pairs perfectly with lossless codecs like FFV1 (video) and FLAC (audio). This combination guarantees zero quality loss and maximum error resilience.

ffmpeg -i input.mp4 -c:v ffv1 -level 3 -c:a flac output.nut