How to Configure FFmpeg rawvideo Muxer
This guide explains how to configure the -f (format)
parameter in FFmpeg to output uncompressed video using the
rawvideo muxer. You will learn the core syntax
requirements, the mandatory parameters such as pixel format and
resolution needed to handle raw streams, and practical command-line
examples for both writing and reading raw video data.
Basic Syntax for the rawvideo Muxer
To force FFmpeg to use the raw video muxer, pass
-f rawvideo before the output destination. By default, raw
video files do not contain file headers or metadata containers, meaning
all video frames are written sequentially as raw byte arrays.
The basic output syntax is:
ffmpeg -i input.mp4 -c:v rawvideo -f rawvideo output.rawSpecifying Pixel Formats
When muxing to rawvideo, you should explicitly define
the pixel format using the -pix_fmt option. If omitted,
FFmpeg selects a default based on the input source, which may lead to
unexpected color space conversions or byte alignments.
For planar YUV 4:2:0:
ffmpeg -i input.mp4 -c:v rawvideo -pix_fmt yuv420p -f rawvideo output.yuvFor packed 24-bit RGB:
ffmpeg -i input.mp4 -c:v rawvideo -pix_fmt rgb24 -f rawvideo output.rgbStreaming to Standard Output (Piping)
The rawvideo muxer is frequently used to pipe
uncompressed frames to other applications, analysis tools, or standard
output (stdout). Replace the output filename with
- to stream to stdout:
ffmpeg -i input.mp4 -c:v rawvideo -pix_fmt bgr24 -f rawvideo -Reading Back the Generated Raw Video
Because the rawvideo muxer generates headerless files,
standard media players cannot automatically detect stream parameters. To
decode or convert the raw file later using the rawvideo
demuxer, you must explicitly supply the dimensions, frame rate, and
pixel format before the input flag -i:
ffmpeg -f rawvideo -pixel_format yuv420p -video_size 1920x1080 -framerate 30 -i output.yuv final_output.mp4