Skip to content

Instantly share code, notes, and snippets.

@AkdM
Last active June 18, 2022 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkdM/1f33caf5d75eaaac8056353c5dac389a to your computer and use it in GitHub Desktop.
Save AkdM/1f33caf5d75eaaac8056353c5dac389a to your computer and use it in GitHub Desktop.
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