How to stream from laptop camera running Ubuntu to Chrysalis Cloud


These instructions are specifically for installing FFmpeg on Ubuntu 18.04. Skip the installation section and continue to You’re ready to stream to Chrysalis Cloud if you already have FFmpeg installed.

Install FFmpeg 3.x on Ubuntu 18.04

sudo apt update
sudo apt install ffmpeg
ffmpeg -version

Install FFmpeg 4.x on Ubuntu 18.04

The easiest way is to use snappy packaging system.

sudo snap install ffmpeg
ffmpeg -version

Install FFmpeg from source

First install dependencies

sudo apt-get -y install build-essential autoconf automake cmake libtool git

mkdir ffmpegtemp
cd ffmpegtemp

mkdir aom
cd aom
git clone
cmake aom/ -DBUILD_SHARED_LIBS=1
sudo checkinstall -y --deldoc=yes --pkgversion=1.0.0
cd ..

git clone
cd mysopha
cd build
cmake ..
cd build
sudo apt-get remove libmysopha0 libmysopha-dev
sudo dpkg -i *.deb

sudo apt-get -y install build-essential autoconf automake cmake libtool git \      
checkinstall nasm yasm libass-dev libfreetype6-dev libsdl2-dev p11-kit \           
libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \                 
libxcb-xfixes0-dev pkg-config texinfo wget zlib1g-dev libchromaprint-dev \         
frei0r-plugins-dev gnutls-dev ladspa-sdk libcaca-dev libcdio-paranoia-dev \        
libcodec2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgme-dev \      
libgsm1-dev libjack-dev libmodplug-dev libmp3lame-dev libopencore-amrnb-dev \      
libopencore-amrwb-dev libopenjp2-7-dev libopenmpt-dev libopus-dev \                
libpulse-dev librsvg2-dev librubberband-dev librtmp-dev libshine-dev \             
libsmbclient-dev libsnappy-dev libsoxr-dev libspeex-dev libssh-dev \               
libtesseract-dev libtheora-dev libtwolame-dev libv4l-dev libvo-amrwbenc-dev \      
libvorbis-dev libvpx-dev libwavpack-dev libwebp-dev libx264-dev libx265-dev \      
libxvidcore-dev libxml2-dev libzmq3-dev libzvbi-dev liblilv-dev \    
libopenal-dev opencl-dev libjack-dev

Download and extract the FFmpeg source code:

tar -xf ffmpeg-4.2.1.tar.bz2
rm ffmpeg-4.2.1.tar.bz2
cd ffmpeg-4.2.1

Configure the build (including non-free dependencies)

./configure --enable-gpl --enable-version3 --disable-static --enable-shared --enable-small \
--enable-avisynth --enable-chromaprint --enable-frei0r --enable-gmp --enable-gnutls \
--enable-ladspa --enable-libaom --enable-libass --enable-libcaca --enable-libcdio \
--enable-libcodec2 --enable-libfontconfig --enable-libfreetype --enable-libfribidi \
--enable-libgme --enable-libgsm --enable-libjack --enable-libmodplug --enable-libmp3lame \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrwb \
--enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg \
--enable-librubberband --enable-librtmp --enable-libshine --enable-libsmbclient --enable-libsnappy \
--enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora \
--enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx \
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 \
--enable-libzmq --enable-libzvbi --enable-lv2 --enable-libmysofa --enable-openal --enable-opencl \
--enable-opengl --enable-libdrm



Purge any existing package installation

sudo apt-get -y purge ffmpeg "libav*" " libpostproc*"
sudo apt-get -y autoremove

You’re ready to stream to Chrysalis Cloud

If you haven’t done so yet create a free developer account on Chrysalis Cloud. After receiving and confirming your Chrysalis Cloud developer account, continue with “Validate FFmpeg Installation”

Validate FFmpeg Installation

First check if FFMpeg installed already and H264 supported:

ffmpeg -encoders | grep 264

If you can see x264lib in the list you can start streaming to Chrysalis Cloud.

Stream to Chrysalis Cloud

fmpeg -i /dev/video0 -framerate 10 -vf scale=640:-2 \
-vcodec libx264 -maxrate 800k -bufsize 1M \
-tune zerolatency -preset veryfast -g 60 \
-f flv rtmp://

Replace rtmp:// streaming server URL with your own:

chrysalis cloud


This is the recommended low latency, low bitrate streaming example. It should achieve subsecond latency while not consuming all of your internet bandwidth.

  • i /dev/video0 – The input stream from your camera
  • framerate 10 – 10 frames per second
  • vf scale=640:-2 – Video filter to rescale output to 640 while preserving aspect ratio
  • maxrate 800k – The max bitrate ffmpeg will use to compress the video. The higher the bitrate, the more bandwidth you need.
  • bufsize 1M – The buffer ffmpeg will work with. It uses the buffer if it can’t get the video out quick enough.
  • tune zerolatency – Provides certain encoding speed to compression ratio in H.264
  • preset veryfast – Good for fast encoding and low-latency streaming
  • g 50 – Set the distance between the start and end of the Group of pictures structure
  • flv – The container format for RTMP
  • rtmp:// – The absolute URL to the RTMP server