This guide explains how to generate your own streams to use with obs-headless.
This guide uses RTMP streams, but rtsp-simple-server supports other formats; check out their repo for more info.
Producing test streams locally:
-
Run the streaming server:
make rtsp -
Stream somthing to the server. You can choose between:
a. Streaming live test sources to
rtsp-simple-server(high CPU usage)# First source on port 1936 ffmpeg -stream_loop -1 -re \ -f lavfi -i "testsrc=size=1920x1080" \ -f lavfi -i "sine=frequency=1000" -pix_fmt yuv420p \ -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M -g 60 \ -c:a aac -b:a 128k \ -f flv rtmp://localhost/sourceA # Second source on port 1937, this one without colors so we can easily # distinguish between two sources when switching. ffmpeg -stream_loop -1 -re \ -f lavfi -i "testsrc=size=1920x1080" \ -f lavfi -i "sine=frequency=1000" -pix_fmt yuv420p -vf hue=s=0 \ -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M -g 60 \ -c:a aac -b:a 128k \ -f flv rtmp://localhost/sourceBb. Transcoding and streaming a local file (medium CPU usage):
ffmpeg -stream_loop -1 -re \ -i myfile.mp4 \ -c:v libx264 -b:v 2M -maxrate 2M -bufsize 1M -g 60 \ -c:a aac -b:a 128k \ -f flv rtmp://localhost:8554/sourceAc. Generating and streaming local files (low CPU usage):
make generate make testsrc -
Edit your .json show file (
default.jsonby default) to usertmp://localhost/sourceAandrtmp://localhost/sourceB. -
Set your stream output to
rtsp-simple-serverby setting a local url inconfig.txt:server rtmp://localhost/live/ key key ... -
Start obs-headless (
make server) and the client (make client) -
Stream the output of
rtsp-simple-server:make play