A streaming video-file sink: it consumes a VideoFrame stream and writes rolling,
finalized video files on disk — one segment every N seconds — in the container
and codec you choose. It is a Pipelogic worker component,
but it ships its own full ffmpeg build, so it encodes every codec it
advertises rather than only the LGPL subset a stock ffmpeg provides.
- Input: a
VideoFramestream (an image + timestamp per frame). - Output: rolling video files, a new segment every
file_size_seconds, keeping the most recentmax_files(a bounded on-disk window). - Reads the frame's declared pixel layout (
BGR,RGB,GRAY,BGRA,RGBA) and lets swscale convert it to the encoder's format — it does not assume BGR24. - Re-opens a segment when the source resolution or pixel layout changes.
- Finalizes (writes the container trailer) the last open segment at shutdown, so no clip is left unreadable.
The component's Dockerfile-build rebuilds ffmpeg 7.1.2 from source with a
GPL configuration, so all of these encode:
| codec | encoder | license |
|---|---|---|
| h264 | libx264 | GPL |
| hevc | libx265 | GPL |
| av1 | libsvtav1 | BSD |
| vp8 | libvpx | BSD |
| vp9 | libvpx | BSD |
| mpeg4 | ffmpeg built-in | LGPL |
| mjpeg | ffmpeg built-in | LGPL |
Containers: mp4, mkv, mov, webm, avi, ts, flv.
Rate control is one knob at a time: set crf for constant quality on the
encoders that expose it (x264/x265/vpx/av1), otherwise the fixed video_bit_rate
applies. preset, pixel_format, gop_size, max_b_frames, resize
(width/height), and faststart (mp4/mov moov-atom relocation) are passed
through where the encoder supports them.
Dockerfile-build is the interesting part and is useful independently of
Pipelogic: it apt-installs the codec -dev libraries and compiles ffmpeg 7.1.2
into /usr/local with
--enable-gpl --enable-version3 \
--enable-libx264 --enable-libx265 --enable-libaom --enable-libsvtav1 \
--enable-libvpx --enable-libmp3lame --enable-libopus --enable-openssl
Lift that recipe into any Debian-based image to get a full-codec ffmpeg.
The C++ source (src/main.cpp) links the Pipelogic worker SDK (the stream
runtime, pipelogic/cv, the generated-file commit path), which lives in the
Pipelogic worker builder image and is not part of this repository — so the
worker binary is not buildable standalone here. The component is built and
deployed through the Pipelogic CLI:
ppl component publish # builds (applies Dockerfile-build) + creates a prerelease
ppl component promote --into default
tests/ holds the live test (ppl lease run --test=tests/live-test.yml), which
exercises all seven codecs across the container formats, and an out-of-band
verify_files.py that ffprobes the saved segments.
GPL-3.0-or-later. Enabling libx264/libx265 makes the bundled ffmpeg GPL; this
component is licensed to match. See LICENSE.