yuvtoppm
Convert YUV image data to PPM image
TLDR
Read Akebas YUV bytes from the specified input file, convert them to a PPM image and store them in the specified output file
SYNOPSIS
yuvtoppm [-interlace] [-nofixfloat] [-verbose] [-strict] [-ignorewarnings] [-rawwidth=W] [-rawheight=H] [-rawchromasub=F] [-nframes=N] [-startframe=N] [-output=FILE] [infile]
PARAMETERS
infile
Path to the input YUV file. Reads from standard input if omitted.
-rawwidth=W
Specifies the width (in pixels) for raw YUV input lacking header information.
-rawheight=H
Specifies the height (in pixels) for raw YUV input lacking header information.
-rawchromasub=F
Sets the chroma subsampling format (e.g., "420", "422", "444") for raw YUV input.
-output=FILE
Writes all output PPM data to the specified file instead of standard output.
-nframes=N
Processes a maximum of N frames from the input stream.
-startframe=N
Begins processing from the Nth frame (0-indexed).
-verbose
Displays detailed messages about the conversion process to standard error.
-strict
Causes the command to exit with an error if input stream warnings are encountered.
-ignorewarnings
Continues processing despite input stream warnings, overriding -strict.
-interlace
Enables handling for interlaced YUV input streams, converting fields to frames.
-nofixfloat
Disables internal floating-point adjustments for chroma conversion.
DESCRIPTION
yuvtoppm is a powerful utility designed to convert raw YUV video data into a sequence of PPM (Portable Pixmap) images. It reads YUV input, either from a file or standard input, and outputs the corresponding PPM frames to standard output or a specified file.
The command intelligently handles the YUV4MPEG2 stream format, which includes embedded header information about video dimensions, frame rate, and chroma subsampling. For raw YUV streams without such headers, users must explicitly specify parameters like width, height, and chroma format using command-line options. This tool is fundamental for workflows involving low-level video processing, allowing users to extract individual frames, manipulate them using image processing tools (like those from the Netpbm suite), or prepare them for re-encoding into other formats. It bridges the gap between raw video data and standard image manipulation pipelines.
CAVEATS
yuvtoppm is designed for raw YUV data; it cannot process compressed video formats (e.g., MPEG, H.264).
The output is a concatenated stream of PPM images. For individual frame extraction, additional tools like ppmsplit are often required downstream.
Color conversion from YUV to RGB (PPM) may involve minor precision losses.
INPUT STREAM TYPE
yuvtoppm automatically detects if the input is a YUV4MPEG2 stream (which contains header metadata). If the input is raw YUV data without this header, it is crucial to provide the frame dimensions using the -rawwidth and -rawheight options, and optionally -rawchromasub, to ensure correct interpretation of the video data.
PIPELINING
As yuvtoppm reads from standard input and writes to standard output by default, it is highly suitable for use in Unix pipelines. This allows it to be combined with other command-line tools for complex video processing workflows, such as cat video.y4m | yuvtoppm | ppmsplit output_frame_%04d.ppm to extract individual frames.
HISTORY
The yuvtoppm utility typically belongs to the yuvtools collection, a suite of programs developed for handling raw YUV video streams. Its origins are closely tied to the early days of open-source multimedia processing on Unix-like systems, often complementing the functionality of the Netpbm image manipulation toolkit. It emerged to address the need for flexible command-line tools capable of converting raw video data into widely supported image formats for further analysis and processing.