raspberry pi 3 Jessie OS has libav package but in case you got error try this:
apt-get install libav-tools
now insert this command:
1. Make instal VNC server 2. Vncserver :1 3. connect to linux port 5901 4.
git clone git://git.videolan.org/x264
cd x264
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl
make
sudo make install
cd /usr/src
git clone https://github.com/FFmpeg/FFmpeg.git
cd ffmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264--enable-nonfree
make sudo make install
5. stream youtube ( find link in my website for instructions)
alias ffmpeg=avconv
To start the stream, run this command: raspivid -o - -t 0 -w 1280 -h 720 -fps 30 -b 6000000 -g 50 | 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://a.rtmp.youtube.com/live2/your youtube id find you session here" in above line in your youtube channel
-o - makes it write the video data to STDOUT so it gets piped into ffmpeg .
-t 0 is how you make it record forever
-vf -hf flips it horizontal and vertical so it looks correct
-fps 30 sets frames per second to 30
-b 6000000 - output bitrate limit. YouTube recommends 400-600kbps, this is 600kbps. Change this to save upload bandwidth at the expense of a lower quality video
-re - tells ffmpeg to slow down the reading of the input to the native frame rate of the input (useful when live streaming)
-ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero and -acodec aac -ab 128k and -strict experimental - adds a fake audio channel filled with zeroes (silence). YouTube rejects streams without an audio channel. You can also change the input device to a microphone if you want (I haven't done this yet)
-g 50 adds a keyframe every 50 frames. Feel free to tweak, its one of those tradeoff variables.
-f h264 and -f flv tells ffmpeg it's receiving h264 input and that you should mux it into flv output (flv is the container format that works with YouTube. Others might work but I haven't tried them)
- by not specifying
-w and -h to raspivid we get the full 1920x1080 resolution (aka 1080p). You can specify these if you want a lower resolution
automatic sending video all the time rapsberry turned on code::
sleep5
while true; sudo shutdown -r +60; do nohup raspivid -o - -t 0 -w 1280 -h 720 -fps 20 -ISO auto -br auto -ex auto | 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://a.rtmp.youtube.com/live2/7xxx-gxxd-xxxs-xxxk; sleep 15;reboot; done
put above code in these two places:
sudo nano /etc/rc.local
sudo nano /etc/init.d/rc.local
|