Stream to youtube from Unifi NVR

Here is a short script which uses ffmpeg to stream video from a Unifi NVR straight to Youtube. I experimented with a few different ffmpeg options and found this one produces the best stream with the best audio.

#!/bin/bash
while :
do
  echo `/usr/bin/ffmpeg -rtsp_transport tcp -i rtsp://[your-nvr]:7447/5a45afdg76256bcec92c377_0 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/m1uz-f547-your-youtube-stream-url`
done

The first stream URL is generated by creating a stream for the camera in Unifi video. The second URL is the stream URL from youtube.

Leave a Reply

Your email address will not be published. Required fields are marked *