rfht / fauxstream

ffmpeg wrapper to facilitate screencasting/recording on OpenBSD
21 stars 5 forks source link

fauxstream

fauxstream is a wrapper script for ffmpeg to simultaneously record a desktop video stream and one (or more?) audio streams on OpenBSD. The goal is to circumvent limitations with other streaming/recording solutions on OpenBSD, including simpler invocations of ffmpeg(1). It allows screencasting including monitoring and microphone audio streams. The license is ISC (see head of fauxstream).

Rationale

To my knowledge, there is no dedicated screen casting solution available on OpenBSD as of the time of this writing. The port of ffmpeg can fulfill these functions, but seems to be hampered by apparent lack of or suboptimal multithreading support, resulting in dropped frames when recording.

It turns out that the reason for this is apparently lack of (or too little) parallelism on the side of ffmpeg.

This script circumvents this by running multiple parallel recording streams communicating via pipes.

Note that this is likely only useful on multiprocess systems/kernels.

Requirements

Known Limitations

Setting up the Monitoring Stream

Refer to FAQ 13.

Usage

fauxstream [-vmon <factor>] [-m [-vmic <factor>]]
    [-r <size> [-o <offset>] | -fullscreen | -n <name>]
    [-f <framerate>] [-a <seconds>] <target>

-m: enable microphone stream (in addition to monitoring stream)
-vmon:  factor to adjust volume of the monitoring stream
-vmic:  factor to adjust volume of the microphone stream
-r: set video size (resolution; default: 1280x720)
-o: set video offset (from top left; default: +0,0)
-fullscreen: set video size & offset to root window geometry (supersedes -r and -o)
-n: set video size to geometry of named window (supersedess -r, -o, and -fullscreen)
-f: set video framerate (default: 30)
-a: set audio offset (in seconds; can be negative)

The target can be a file or a remote streaming address (`rtmp://`).

Examples:

Stream to Twitch:

sh fauxstream -m -vmic 5.0 -vmon 0.25 -r 1920x1080 -f 30 -a -0.2 \
    "rtmp://<SERVER>.twitch.tv/app/<STREAM_KEY>

Record to file:

sh fauxstream [...] /path/to/file.flv

FAQ:

Q: What does the name stand for?

A: It used to stand for ffmpeg + aucat x11 stream, but since aucat was dropped, the name isn't an abbreviation for anything in particular anymore.

Q: How do I stop the recording??

A: Press Ctrl-C to stop the recording.

Q: I'm trying to record a specific window, but why does moving it or covering it not keep recording it?

A: Unfortunately, it's just recording the screen geometry of where the window was when you started recording. Any overlapping windows will be included in the recorded area and moving the window will result in it moving outside of the recorded area.

Related Links: