ppmtoy4m(1)
π ppmtoy4m(1) β the MJPEG tools manual, but make it a group chat π
okay bestie, sit down, hydrate, because we're about to talk about ppmtoy4m β she lives in the MJPEG tools manual and she is THAT girl. she takes your lil PPM pics and turns them into a YUV4MPEG2 stream. it's giving glow-up. it's giving pipeline icon. π¦
β¨ NAME β¨
ppmtoy4m β Convert PPM images to YUV4MPEG2 stream π
πΈ SYNOPSIS πΈ
ppmtoy4m [options] [ filename ]
π DESCRIPTION π
so like, ppmtoy4m converts one or more raw PPM images into a YUV4MPEG2 stream, all ready for further processing by other video tools. no cap. π₯
output goes to stdout so you can pipe it straight into other MJPEG tools β yes queen, the pipeline is the moment. the size of the output frame(s) is determined from the (first) input image. π
input is a 'raw' format PPM image, read from stdin or from the optional filename. and here's the tea: the input may contain multiple PPM images concatenated together, and ppmtoy4m will read and process them sequentially. all images must have identical size and format β no exceptions bestie, she does not do chaos. input images can be interpreted as whole progressive frames, interleaved fields, or (in pairs) as sequential fields. and the input images must have 8 bits per channel (i.e. maxval must be 255). that's the law. π
input images should be in the usual R'G'B' colorspace. they get converted to the Y'CbCr colorspace (ITU-R BT.601) β and chroma subsampled, if that's what you want β before output. slay. π
now this is the cute part: ppmtoy4m and y4mtoppm are inverses of each other. you can pipe the output of one into the other, and vice-versa. adorable. matching besties. π«Ά but ngl β the subsampling and colorspace operations are lossy in both directions, so don't come crying to me when the pixels aren't pixel-perfect. and when converting to PPM, information on interlacing and sample aspect ratio is lost (but can be reconstructed by supplying command-line arguments to ppmtoy4m). iykyk. π
π OPTIONS π
ppmtoy4m accepts the following options, and yes, we're doing all of them:
-o numβ Frame offset: skip output of the first num frames. (default:0)-n numβ Output a total of num output frames. Use0to specify all frames. (default:0)-F n:dβ Set framerate encoded in output stream, as an exact integer ratio. (default:30000:1001) Common rates are:24000:1001β NTSC 3:2 pulldown converted film24:1β native film25:1β PAL/SECAM30000:1001β NTSC video50:1β PAL field rate60000:1001β NTSC field rate
-A n:dβ Set pixel aspect ratio encoded in output stream, as an exact integer ratio. (default:1:1) Common ratios are:1:1β square pixels (computer graphics)10:11β CCIR-601 NTSC59:54β CCIR-601 PAL
-Bβ Interpret data as being BGR rather than RGB. (not me forgetting the channel order π)-I xβ Set interlacing mode, used to interpret the PPM image(s), and also encoded in output stream. (default:'p')pβ progressive, non-interlacedtβ top/upper-field-first interlacedbβ bottom/lower-field-first interlaced
-Lβ For interlaced streams, treat each PPM image as two interleaved fields. (Otherwise, two PPM images will be read for each frame; one per field.)-rβ Repeat last input frame until output is complete. If-n 0is also specified, last input frame will be repeated forever. π infinite loop energy, literally.-S modeβ Set chroma subsampling mode. (default:444)444β 4:4:4 (no subsampling)420jpegβ 4:2:0 JPEG/MPEG-1, interstitial cositing420mpeg2β 4:2:0 MPEG-2, horizontal cositing
bestie listen. the subsampled modes use a lousy subsampling filter. better results will be achieved by passing the default4:4:4output to a scaler which supports subsampling, such asy4mscaler(1). don't say i didn't warn you. π
-v [0,1,2]β Set verbosity level.0= warnings and errors only.1= add informative messages, too.2= add chatty debugging message, too.
π EXAMPLES π
to convert a file containing a single PPM file into a stream of 15 (identical) frames β yes, 15 whole frames of the same pic, she's committed:
ppmtoy4m -n 15 -r some-image.ppm
to convert a series of Targa format images (in the current directory) to a YUV4MPEG2 stream displayed by yuvplay β the pipeline is genuinely so satisfying:
ls *.tga | xargs -n1 tgatoppm | ppmtoy4m | yuvplay
ate. no crumbs. π₯
π§ AUTHOR π§
this man page was written by Matt Marjanovic. π
if you have questions, remarks, problems or you just want to contact the developers, the main mailing list for the MJPEG-tools is:
mjpeg-users@lists.sourceforge.net
for more info, see our website at:
http://mjpeg.sourceforge.net/
β SEE ALSO β
ppm(5), y4mtoppm(1), mjpegtools(1), mpeg2enc(1), y4mscaler(1), yuv2lav(1), yuvplay(1)
go read them. do it for her. πβ¨
and that's the whole page, bestie!! brought to you by the MJPEG Tools Team, dated 28 April 2004 β vintage, iconic, still slaying to this day. mwah. πππ¦
π¦ where this page comes from
- arch rolling: mjpegtools 2.2.1-4 Β· GPL-2.0-or-later
- debian bookworm: mjpegtools 1:2.1.0+debian-7
- debian trixie: mjpegtools 1:2.1.0+debian-8.1+b1
- fedora 43: mjpegtools 2.2.1-11.fc43 Β· GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- fedora 44: mjpegtools 2.2.1-12.fc44 Β· GPL-2.0-or-later AND GPL-2.0-only AND GPL-1.0-or-later
- nixos 26.05: mjpegtools 2.2.1
- nixpkgs unstable: mjpegtools 2.2.1
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- opensuse-leap 16.0: mjpegtools 2.2.1-160000.2.2 Β· GPL-2.0-only
- ubuntu jammy: mjpegtools 1:2.1.0+debian-6build1
- ubuntu noble: mjpegtools 1:2.1.0+debian-8.1build1
- ubuntu questing: mjpegtools 1:2.1.0+debian-8.1build1
- ubuntu resolute: mjpegtools 1:2.2.1-3
- ubuntu stonking: mjpegtools 1:2.2.1-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms