Skip to content

Instantly share code, notes, and snippets.

@eriksape eriksape/ forked from maxogden/
Created Feb 8, 2018

What would you like to do?
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera

note: it might work with libav-tools instead of ffmpeg (ffmpeg isnt on apt-get in raspbian) but I haven't tested it

example video created using above method:


This comment has been minimized.

Copy link
Owner Author

eriksape commented Feb 8, 2018

cd /usr/src
git clone git://
cd ffmpeg
./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame
make -j$(nproc) && make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.