LinuxCommandLibrary

yuvsplittoppm

Convert YUV video frames to PPM images

TLDR

Read Akebas YUV bytes from three files starting with basename, merge them into a single PPM image and store it in the specified output file

$ yuvsplittoppm [basename] [width] [height] > [path/to/output_file.ppm]
copy

SYNOPSIS

yuvsplittoppm [-w width] [-h height] [-k K] [-c C] [-t] [-g] [-s skip] [-f first] [-l last] [-p prefix] [inputfile]

PARAMETERS

-w width
    Specifies the width of the output image in pixels. This is a mandatory parameter.

-h height
    Specifies the height of the output image in pixels. This is a mandatory parameter.

-k K
    Indicates YUV 4:1:1 format. K typically defines the chroma subsampling (e.g., 4:1:1 or 4:2:2). This option is commonly used for BT.878 capture cards.

-c C
    Indicates YUV 4:2:0 format. C typically defines the chroma subsampling.

-t
    Transposes the input image (swaps width and height) during conversion.

-g
    Generates grayscale (PBM) output instead of color (PPM).

-s skip
    Skips the first skip frames from the input YUV stream before processing.

-f first
    Starts processing from the first frame number specified.

-l last
    Stops processing after the last frame number specified.

-p prefix
    Specifies a prefix for the output filenames. The filenames will be prefixNNNNNN.ppm.

inputfile
    The path to the input YUV stream file. If omitted, yuvsplittoppm reads from standard input.

DESCRIPTION

yuvsplittoppm is a utility from the Netpbm project designed to convert raw YUV 4:1:1 (BT.878) or YUV 4:2:0 interleaved video streams into a sequence of PPM (Portable Pixmap) image files.

It's commonly used to process raw video data captured from sources like video capture cards, allowing each frame of the YUV stream to be extracted and saved as an individual image. This command is crucial for debugging video capture issues or for further processing video frames with other image manipulation tools.

It handles various YUV sub-sampling formats and allows specifying the output dimensions, frame ranges, and naming conventions for the output PPM files. The tool outputs a separate PPM file for each frame, making it suitable for analyzing individual frames of a video stream.

CAVEATS

  • yuvsplittoppm expects raw YUV data, not video container formats like AVI, MP4, or MKV. You'll need to extract the raw YUV stream first if your video is in such a container.
  • It primarily supports YUV 4:1:1 (BT.878) and 4:2:0 formats. Other YUV variants might not be correctly interpreted.
  • The width and height parameters are crucial and must accurately match the resolution of the YUV stream; otherwise, the output images will be distorted.

OUTPUT FILENAMES

yuvsplittoppm generates output files with names like prefixNNNNNN.ppm, where NNNNNN is a zero-padded frame number. If no prefix is specified with -p, the default prefix used is 'frame', resulting in filenames like frame000000.ppm.

STANDARD INPUT/OUTPUT

The command can read YUV data from standard input if no inputfile is provided, making it suitable for piping from other commands (e.g., dd or cat). Note that it always writes the output PPM files to the filesystem, not to standard output.

HISTORY

yuvsplittoppm is part of the Netpbm project, a long-standing toolkit for graphics file format conversion. Netpbm originated from Jef Poskanzer's Pbmplus package, released in 1988. It later evolved into Netpbm, maintained by Bryan Henderson. The yuvsplittoppm command was developed to address the need for processing raw YUV video streams, particularly those originating from early video capture hardware like BT.878 cards, common in the late 1990s and early 2000s for TV tuners and video digitizers. Its development reflects the open-source community's efforts to provide tools for low-level media processing.

SEE ALSO

yuvtoppm(1), ppmtoyuv(1), rawtoppm(1), netpbm(1), ffmpeg(1)

Copied to clipboard