https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=134141&p=893318#p893318
So I followed this until I hit issues.
When compiling ffmpeg for Raspberry Pi 3 I want to use all four cores of processor.
Where these instructions ( http://www.valmueller.net/stream-video-with-raspberry-pi-to-youtube/ ) say:
sudo make
sudo make install
I replaced it with:
sudo make -j4 install
Testing the install of ffmpeg:
ffmpeg
gives this error:
/usr/local/bin/ffmpeg: cannot execute binary file: Exec format error
I noticed that my full version of jessie must have had ffmpeg in it already so I removed it but it did not help:
I did not note the exact way I removed it but it was something like:
sudo apt-get remove ffmpeg
I removed the ffmpeg directory I had previously cloned ( /usr/src/ffmpeg) and cloned from another source:
https://git.videolan.org/git/ffmpeg.git
Then rebuilt with no options to see what happened:
sudo ./configure
sudo make -j4 install
then ran stream on command line and it worked!
sudo raspivid -o - -t 0 -w 1280 -h 720 -fps 25 -b 4000000 -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/my-utube-code-here
But while steaming I did get some warnings and errors to investigate further:
Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[flv @ 0x16dba70] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[h264 @ 0x168e1f0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
^Cmmal: Aborting program.0 size= 56962kB time=00:04:02.11 bitrate=1927.3kbits/s speed= 1x
[flv @ 0x16dba70] Failed to update header with correct duration.
[flv @ 0x16dba70] Failed to update header with correct filesize.
Youtube showed my live stream with a starting delay and a status of 'healthy' in green.
Raspberry Pi v2 with alternative pi-compatible camera module . Camera sensor is v1 based 5 megapixel with adjustable focus and near fish eye - around 160 degrees angle of view |
Next I can now investigate the errors and consider recompiling my ffmpeg with some of the options if needed.
UPDATE:
After some time playing with video, I resolved jerky capturing and added text display with this new run string
sudo raspivid -o - -t 0 -w 1280 -h 720 -fps 30 -ex sports -b 4000000 -g 50 -a 12 -ae 10,0x00,0x8080ff -a "My Camera %m-%d-%y @ %I:%M %P" | /usr/src/ffmpeg/ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -framerate 30 -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 60 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/my-youtube-id
Hi,
ReplyDeleteThanks for this tutorial. Tried text display option but it didn't work for me. The video is not giving any error , but i am not getting any text. Not even when using raspistill. Do you know if the text overlay feature should be turned on from somewhere ?
Thanks
this part: -a 12 -ae 10,0x00,0x8080ff -a "My Camera %m-%d-%y @ %I:%M %P" give you the ext and the ability to change colors ans layouts. see the docs for camera at https://www.raspberrypi.org/documentation/raspbian/applications/camera.md
DeleteThank you for reply,
DeleteI have managed to do a rpi-update and it is working now. But now I came across another issue : when I am changing the -fps value , it doesn't make any difference to the streaming bitrate ( went from 30FPS to 1FPS and the bitrate doesn't change too much ). My upload speed is not very good and right now I can only steam 640 x 480 30fps or 1fps (same bitrate). Wondering if this is a raspivid or is a ffmpeg issue.
I had that problem too. the raspivid frame rate setting did not seem to change anything. I also set -framerate 30 on ffmpeg See my last connection command line example- it works for me with 30 fps and no jitterying or jumping
ReplyDelete