How to Extract Raw YUV with libaom Decoder?
Extracting raw YUV video from an AV1 encoded file using the reference
aomdec tool (built from the libaom source) requires
specifying the input file, defining the output format, and designating
the destination path. By default, aomdec processes the AV1
bitstream and can output raw YUV data either wrapped in a Y4M
(YUV4MPEG2) container or as a completely uncompressed, headerless raw
YUV sequence. This article provides the specific command-line syntax and
arguments needed to successfully execute this extraction.
Core Command Syntax
To extract video using the libaom decoder, you primarily interact
with the aomdec executable. The basic command structure to
output raw YUV data requires a few essential flags.
aomdec input.ivf --raw -o output.yuvEssential Arguments Explained
- **
input.ivf/input.webm**: This is the positional argument for your source AV1 video file. The libaom decoder typically handles IVF, WebM, or raw OBU bitstream formats. - **
-o <filename>or--output=<filename>**: This specifies the path and name of the output file. --raw: This flag is crucial. By default, if the output file extension is not recognized or if not specified otherwise,aomdecmight output Y4M. Forcing the--rawflag ensures that the output is entirely headerless, raw YUV pixel data.- **
-yor--y4m**: Conversely, if you prefer the YUV data to include a lightweight text header defining the resolution, frame rate, and colorspace (which makes it easier for media players like VLC or YUV viewers to read without manual parameter entry), you should use this flag instead of--raw.
Specifying Codec Options
While aomdec automatically detects the profile, bit
depth, and chroma subsampling (such as YUV420p, YUV422p, or YUV444p)
from the AV1 sequence header, you can pass additional arguments to
control the decoding behavior:
--limit=<value>: Stops decoding after a specific number of frames. This is highly useful if you only need a short sample of the raw YUV video for analysis.--skip=<value>: Skips a specified number of frames at the input before starting to decode and output the YUV frames.- **
-t <threads>or--threads=<threads>**: Defines the number of threads to use for decoding, which significantly speeds up the extraction process on multi-core processors.