diff --git a/macos_installer.sh b/macos_installer.sh index ce9cf77..ea42f66 100644 --- a/macos_installer.sh +++ b/macos_installer.sh @@ -78,6 +78,9 @@ echo "${GREEN}Configuring MediaMTX...${NC}" mkdir -p ~/ots/mediamtx/recordings ln -s /opt/homebrew/etc/mediamtx/mediamtx.yml ~/ots/mediamtx/mediamtx.yml +# Youtube Streaming support +pip3.12 install yt-dlp + cd ~/ots/mediamtx curl -sL https://github.com/brian7704/OpenTAKServer-Installer/raw/master/mediamtx.yml -o /opt/homebrew/etc/mediamtx/mediamtx.yml sed -i '' "s~SERVER_CERT_FILE~${HOME}/ots/ca/certs/opentakserver/opentakserver.pem~g" /opt/homebrew/etc/mediamtx/mediamtx.yml diff --git a/mediamtx.yml b/mediamtx.yml index 1d17de5..4a2fab9 100644 --- a/mediamtx.yml +++ b/mediamtx.yml @@ -621,6 +621,14 @@ paths: # my_camera: # source: rtsp://my_camera + ~^youtube_(.+)$: + source: publisher + runOnDemand: > + sh -c 'ffmpeg -re -i "$(yt-dlp -g https://youtu.be/$(echo $RTSP_PATH | sed "s/youtube_//"))" -c:v copy -f rtsp rtsp://127.0.0.1:8554/$RTSP_PATH' + runOnDemandCloseAfter: 10s + # routes starting with a "youtube_" prefix will + # pull the stream from YouTube and publish it to the RTSP server. + # Settings under path "all_others" are applied to all paths that # do not match another entry. all_others: diff --git a/mediamtx_windows.yml b/mediamtx_windows.yml index 62f6e4a..7375724 100644 --- a/mediamtx_windows.yml +++ b/mediamtx_windows.yml @@ -621,6 +621,8 @@ paths: # my_camera: # source: rtsp://my_camera + # TODO - Add handling of Youtube Streams + # Settings under path "all_others" are applied to all paths that # do not match another entry. all_others: diff --git a/rocky_installer.sh b/rocky_installer.sh index 6deb811..d12b0e4 100644 --- a/rocky_installer.sh +++ b/rocky_installer.sh @@ -249,6 +249,9 @@ mkdir -p ~/ots/mediamtx/recordings cd ~/ots/mediamtx +# Install yt-dlp for YouTube streaming support +pip3 install yt-dlp + ARCH=$(uname -m) KERNEL_BITS=$(getconf LONG_BIT) if [ "$ARCH" == "x86_64" ]; then diff --git a/ubuntu_installer.sh b/ubuntu_installer.sh index 0bc5bfe..b4fd8ae 100644 --- a/ubuntu_installer.sh +++ b/ubuntu_installer.sh @@ -145,6 +145,9 @@ mkdir -p ~/ots/mediamtx/recordings cd ~/ots/mediamtx +# Install youtube streaming support +pip3 install yt-dlp + ARCH=$(uname -m) KERNEL_BITS=$(getconf LONG_BIT) if [ "$ARCH" == "x86_64" ]; then