ppmtompeg
Convert PPM images into MPEG video
TLDR
Produce an MPEG-1 stream using the parameter file to specify inputs and outputs
Encode the GOP with the specified number only
Specify the first and last frame to encode
Combine multiple MPEG frames into a single MPEG-1 stream
SYNOPSIS
ppmtompeg [options] [image_file_prefix | -] [start_frame] [end_frame]
If image_file_prefix is provided, ppmtompeg expects numbered PPM files (e.g., frame0001.ppm, frame0002.ppm). Using - indicates reading PPM frames from standard input.
PARAMETERS
-f <rate>
Sets the output video frame rate in frames per second (e.g., 25).
-s <width>x<height>
Specifies the output video resolution (e.g., 352x240 for SIF NTSC).
-b <bitrate>
Defines the target video bitrate in kilobits per second (kbit/s).
-g <gop_size>
Sets the Group of Pictures (GOP) size. A GOP defines the interval between I-frames.
-q <qscale>
Adjusts the average quantization scale for video quality (1-31, where 1 is best quality, 31 is lowest).
-o <filename>
Specifies the output MPEG file name. If omitted, output goes to standard output.
-no_b_frames
Disables the use of B-frames (bi-directionally predicted frames), resulting in larger files but potentially faster encoding/decoding.
-h
Displays a help message with available options.
DESCRIPTION
The ppmtompeg command is a utility designed to encode a sequence of Portable Pixmap (PPM) image files into an MPEG-1 video stream.
It's often used in conjunction with other Netpbm tools, which can convert various image formats into PPM, allowing for flexible input sources. This command reads individual PPM frames, either from numbered files or from standard input (via piping), and combines them into a compressed MPEG video, ideal for creating simple animations, time-lapses, or early web video content.
While ppmtompeg provides control over key encoding parameters like frame rate, bitrate, and Group of Pictures (GOP) size, it produces MPEG-1, an older video standard. For modern high-definition video encoding or more advanced features, contemporary tools like FFmpeg are generally preferred. Nonetheless, ppmtompeg remains a classic and functional tool for specific use cases within the Unix/Linux environment, particularly when integrated with script-based image processing workflows.
CAVEATS
ppmtompeg is primarily an MPEG-1 encoder, meaning it produces video in an older format not suitable for modern high-definition resolutions or advanced compression needs.
It expects input in the PPM (Portable Pixmap) format, which often requires pre-processing with other image conversion utilities.
While functional, it has been largely superseded by more comprehensive and feature-rich multimedia tools like FFmpeg for general video encoding tasks.
TYPICAL USAGE PATTERN
ppmtompeg is frequently used in a pipeline where image sequences are generated or converted to PPM format and then piped directly to the encoder. For example:
convert frames*.png ppm:- | ppmtompeg -f 25 -s 352x240 > output.mpg
or from pre-numbered files:
ppmtompeg -f 25 -s 352x240 myframe 0001 0100 > output.mpg
MPEG-1 STANDARD
MPEG-1 was developed by the Moving Picture Experts Group (MPEG) and standardized in 1993. It's primarily used for video quality roughly equivalent to a VHS tape, common for Video CD (VCD) and early online video. ppmtompeg implements this standard, including I-frames (intra-coded), P-frames (predictive), and B-frames (bi-directional predictive).
HISTORY
ppmtompeg emerged as part of early efforts to provide command-line MPEG encoding capabilities on Unix-like systems. It was often distributed as a component of various multimedia utility suites, or as a standalone tool specifically for MPEG-1 encoding from image sequences.
Its tight integration with the Netpbm toolkit made it a staple for scripted image-to-video workflows in the pre-FFmpeg era, leveraging Netpbm's extensive image format conversion abilities to feed PPM data into the encoder.
While its direct development might have slowed, its functionality is preserved in various distributions.