Git Product home page Git Product logo

fauxstream's Introduction

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

  • ffmpeg >= 4.0 (install from ports with doas pkg_add ffmpeg)
  • OpenBSD/ksh
  • enable kern.audio.record:
    # sysctl kern.audio.record=1
    

Known Limitations

  • Higher recording resolutions, non-default video codecs, or simultaneously running applications may affect performance while recording to the point of dropping frames and leading to desynchronization.
  • The recording with ffmpeg's x11grab doesn't register when an application goes fullscreen, and it continues to record it as being run in a window.
  • Likely significantly worse performance on single-core CPUs/ single-process systems.
  • Correctly syncing audio and video streams currently requires manually finding the best audio offset (-a parameter).
  • Including a webcam video feed may introduce its own lag/desync and has not been tested by me.

Setting up the Monitoring Stream

Refer to FAQ 13.

Usage

fauxstream [-vmon <factor>] [-m [-vmic <factor>]] [-r <size>]
	[-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)
-f:	set video framerate
-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.

Related Links:

fauxstream's People

Contributors

morgant avatar rfht avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.