Welcome to bytebang » The blog about all and nothing » Stream your web/surveillance cam to YouTube

Stream your web/surveillance cam to YouTube

Nov 26 2020

The Problem

If you have a cool webcam which should be streamed to youtube then you have a lot of options how to reach this goal. This article shows how to stream a webcam (or any other cam which offers a RTSP Stream) directly to youtube.

The Solution

First: Enable streaming in youtube. This will take up to 24 hours ! After this period you will be able to send a network stream to youtube which boradcasts it for you. Youtube offers a lot of help to get you started.

However - i did not find any summary how to do it with synology. So here is mine:

Stream via synology

Install the following package: Surveillance Center. This application is meant to monitor a bunch of cameras - and therefore it offers integration to a lot of vendors.


Then add your IP Camera to the setup.  Usually this takes not longer than 10 minutes till you see a live image within the software.


Afterwards install the package "Live Broadcast" ...


... and enter your youtube settings:


After saving and enabling the live stream you should be able to see your stream via youtube:


Grab the broadcast URL and send it over to your friends - and you are done !

Stream via ffmpeg

Another option is to utilize ffmpeg to stream to your youtube account.

gue@gue-thinkpad:~ffmpeg -f lavfi -i anullsrc -rtsp_transport tcp -i rtsp://live:Streaming@ -tune zerolatency -vcodec libx264 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, lavfi, from 'anullsrc':
 Duration: N/A, start: 0.000000, bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s
[rtsp @ 0x559f333055a0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #1, rtsp, from 'rtsp://live:Streaming@':
    title           : Media Presentation
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 4 fps, 4 tbr, 90k tbn, 8 tbc
Stream mapping:
  Stream #1:0 -> #0:0 (copy)
 Stream #0:0 -> #0:1 (pcm_u8 (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/2hfx-8q6u-8jdq-368v':
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 4 fps, 4 tbr, 1k tbn, 90k tbc
   Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
      encoder         : Lavc57.107.100 aac
[rtsp @ 0x559f333055a0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[flv @ 0x559f33904020] Failed to update header with correct duration.4090.1kbits/s speed=0.977x    
[flv @ 0x559f33904020] Failed to update header with correct filesize.
frame=   72 fps=3.9 q=-1.0 Lsize=   30885kB time=00:00:17.83 bitrate=14187.6kbits/s speed=0.971x    
video:30866kB audio:5kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.047328%
[aac @ 0x559f333288c0] Qavg: 65536.000

This approach works very well from each linux pc with ffmpeg installed.

Happy streaming !

Get Social

(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen