Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Output Video File

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.

What it does

  • Input: a VideoFrame stream (an image + timestamp per frame).
  • Output: rolling video files, a new segment every file_size_seconds, keeping the most recent max_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.

Codecs

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.

The ffmpeg build (reusable on its own)

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.

Building the component

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.

License

GPL-3.0-or-later. Enabling libx264/libx265 makes the bundled ffmpeg GPL; this component is licensed to match. See LICENSE.

About

Streaming video-file sink for Pipelogic — rolling segments, full-codec ffmpeg (h264/hevc/av1/vp8/vp9/mpeg4/mjpeg)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages