ppmtoeyuv
Convert PPM image to YUV image
TLDR
Read a PPM image from the input file, convert it to a Berkeley YUV image and store it in the specified output file
SYNOPSIS
ppmtoeyuv [-frames N] [-rate R] [ppmfile]
PARAMETERS
-frames N
Specifies the number of frames (N) to convert from the input. If omitted, defaults to 1 frame. The input must be a stream of N PPM images when converting multiple frames.
-rate R
Sets the frame rate (R) in frames per second into the output metadata. This does not affect the actual playback speed but informs the viewing program. Defaults to 25 frames per second.
ppmfile
The path to the input PPM image file. If not specified, ppmtoeyuv reads PPM data from standard input (stdin). When converting multiple frames with -frames, this should be a stream of PPM images.
DESCRIPTION
The ppmtoeyuv command is a utility from the Netpbm package, designed for converting PPM (Portable PixMap) image files into the EyeYUV video format. PPM is a simple, uncompressed image format commonly used within the Netpbm suite for various image manipulations. EyeYUV is a specific YUV color space format, particularly suited for video applications, animations, and specialized hardware like some video players (e.g., XANIM).
The YUV color model separates the luma (brightness) component (Y) from the two chrominance (color) components (U and V). This separation is beneficial for video compression and transmission. ppmtoeyuv specifically outputs 8-bit YUV 4:2:2 data, which means for every two horizontal luma samples, there is one corresponding U and one V chrominance sample. While it can convert a single PPM image, its design and primary use case often involve converting streams of PPM images into a multi-frame EyeYUV animation, providing options to control the number of frames and the embedded frame rate metadata.
CAVEATS
The output of ppmtoeyuv is raw EyeYUV 4:2:2 data, not encapsulated in a common video container format like AVI or MP4. Therefore, it typically needs to be piped into another program or understood by specialized players that natively support the EyeYUV format. The -rate option only embeds metadata; it doesn't control the actual playback rate, which is determined by the player.
OUTPUT FORMAT DETAILS
The EyeYUV output format is 8-bit YUV 4:2:2. This means that for every two horizontal luma (Y) samples, there is one chrominance U sample and one chrominance V sample. The U and V components are subsampled horizontally. This format is commonly used in digital video applications where bandwidth efficiency is important, as the human eye is less sensitive to chrominance detail than to luminance detail.
ANIMATION SUPPORT
While ppmtoeyuv can convert a single PPM image, it is particularly useful for converting animation sequences. By specifying the -frames option, users can concatenate multiple PPM images (provided as a stream, e.g., piped from another command) into a single EyeYUV output file representing an animation.
HISTORY
The ppmtoeyuv command is part of the extensive Netpbm image manipulation toolkit, which has a long history tracing back to the pbmplus package developed in the late 1980s. ppmtoeyuv itself was originally authored and copyrighted in 1990 by Ugo Paci (ugop@csr.unibo.it), indicating its early inclusion into the suite to address specific needs for converting image sequences into a format suitable for animation and video processing tools prevalent at that time, such as XANIM.