Skip to content

Instantly share code, notes, and snippets.

@compulim
Created June 7, 2021 03:41
Show Gist options
  • Save compulim/d17e58ca4399129ded7690c495266016 to your computer and use it in GitHub Desktop.
Save compulim/d17e58ca4399129ded7690c495266016 to your computer and use it in GitHub Desktop.
RTMP server to show live stream and dump it to disk
#!/bin/sh
# This script will act as a RTMP server and archive your RTMP live stream as-is without transcoding.
# Prerequisites: ffmpeg.
# Configure your RTMP source to stream to rtmp://your-ip-address:5555/.
ffmpeg -listen 1 -i rtmp://0.0.0.0:5555 -c copy -c:v copy -c:a copy your-video.m4v
#!/bin/sh
# This script will act as a RTMP server, receive your RTMP live stream, and show it locally via ffplay.
# Prerequisites: ffmpeg and Node.js.
# Configure your RTMP source to stream to rtmp://your-ip-address:5555/.
while true
do
npx concurrently --kill-others "ffmpeg -listen 1 -i rtmp://0.0.0.0:5555 -c copy -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:1234/live.sdp" "ffplay -fs -rtsp_flags listen rtsp://127.0.0.1:1234/live.sdp?tcp"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment