PNG

From wiki.selur.net
Jump to navigation Jump to search

PNG writes the video as a sequence of numbered PNG images, one lossless RGB picture per frame, instead of a video stream. That is useful for compositing, restoration and other tools that work on single frames. Hybrid uses ffmpeg's png encoder for it.

Base → Video: PNG, then the PNG tab

PNG tab in Hybrid
PNG tab in Hybrid

What it does

Every frame is converted to RGB and stored as its own PNG file. PNG filters each row of pixels with a simple prediction and compresses the result with Deflate (zlib); the picture is stored without loss, the options only change the file size and the metadata. An image sequence carries neither audio nor a frame rate.

Lossless refers to the RGB picture. The conversion from YUV to RGB (and from 4:2:0 or 4:2:2 to full chroma resolution) happens before and cannot be undone exactly.

The tab carries the note that this output is untested; check the colors of the first results.

Requirements

ffmpeg, which is part of Hybrid on every system. Hybrid only allows PNG with a raw output, i.e. an output file with a raw extension such as .raw; with any other container the job is refused. The images are written next to that output name:

  • normally as <output name>_%03d.png, e.g. test_001.png, test_002.png …
  • with Number as name as %03d.png in the output folder, e.g. 001.png.

The number of digits follows the number of frames (three digits up to 999 frames, four up to 9999 and so on).

Settings

Control ffmpeg option Range / values Hybrid default Meaning
DPI -dpi 0 – 65536 0 Image resolution in dots per inch, stored in the header of each PNG. Metadata for print and layout programs; the pixels do not change. 0 writes no resolution.
DPM -dpm 0 – 65536 0 The same information in dots per meter, the unit PNG stores internally. Used only when DPI is 0; 0 writes no resolution.
Prediction -pred none, sub, up, avg, paeth, mixed none PNG row filter applied before the compression. none is the fastest and gives the biggest files; sub, up, avg and paeth predict from the left, upper or both neighbours; mixed tries them per row and is usually the smallest and the slowest. ffmpeg itself would default to paeth.
Bit depth -pix_fmt, -vf format= 8-bit, 16-bit 8-bit Bits per color channel: 8-bit writes rgb24, 16-bit writes rgb48be. 16 bit keeps the precision of sources with more than 8 bit and roughly doubles the file size.
Number as name – on/off off Names the images by their number only, without the output name in front, see above.

The Configuration row at the bottom saves, loads and deletes named sets of these settings.

Example

Prediction none and Bit depth 8-bit on a 10-bit YUV 4:2:0 source (640x352, 25 fps) with the output test.raw:

vspipe "encodingTempSynthSkript.vpy" - --outputindex 0 -c y4m --progress | ffmpeg -y -noautorotate -nostdin -threads 8 -color_primaries bt470bg -color_trc smpte170m -colorspace bt470bg -color_range tv -f yuv4mpegpipe -i - -an -sn -color_primaries bt470bg -color_trc smpte170m -colorspace bt470bg -color_range tv -fps_mode auto -r 25/1 -vcodec png -pred 0 -vf zscale=matrixin=470bg:matrix=470bg,format=rgb24 -pix_fmt rgb24 -metadata encoding_tool="Hybrid 2026.11.22.1" "test_%03d.png"

With Prediction mixed and Bit depth 16-bit the encoder part becomes:

-vcodec png -pred 5 -vf zscale=matrixin=470bg:matrix=470bg,format=rgb48 -pix_fmt rgb48be

How Hybrid calls it

  • The filter script (Vapoursynth or AviSynth) is piped into ffmpeg; without a script ffmpeg reads the source itself.
  • -pred is always written, -dpi only when DPI is above 0, otherwise -dpm when DPM is above 0; the prediction as the number of the entry in the list (0 – 5).
  • ffmpeg converts to RGB with -vf zscale=…,format=rgb24 (or rgb48), using the color matrix of the video (BT.601/470bg, 170m, BT.709 or BT.2020).
  • The output name is a pattern with a frame counter (%03d), so ffmpeg writes one file per frame, starting at 1.
  • No muxing step follows: audio, subtitles and chapters are not part of the result.
  • The number of ffmpeg threads follows Hybrid's general thread setting.

Sources