Skip to content

Instantly share code, notes, and snippets.

@AkdM
Last active June 18, 2022 11:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
RTSP Stream with `youtube-dl`

1. Install youtube-dl

https://github.com/ytdl-org/youtube-dl

2. Install ffmpeg

https://ffmpeg.org

3. Run rtsp-simple-server (repo here)

docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8554:8554 -p 1935:1935 -p 8888:8888 aler9/rtsp-simple-server

4. Run ffmpeg with best available quality Youtube video

ffmpeg -re -stream_loop -1 -i $(youtube-dl -g https://www.youtube.com/watch\?v\=vbgwWfwGSR4) -f rtsp rtsp://localhost:8554/stream

5. Access stream from anywhere (NVR; Home Assistant; etc) with the rtsp url:

rtsp://localhost:8554/stream

img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment