I've been using a RPi2 to encode live video from the PiCam module to stream to YouTube. The stream is up and running, but of course there are issues :). First and foremost the video stream on YouTube seems to play back very fast (as seen by a timer in front of the camera which looks like it plays back at roughly 4x speed), and then I get the buffering wheel for a few seconds and repeat, ad infinitum. Here's a great example:
https://youtu.be/Wi3K_1SuqcQ?t=389
As you can see, the video is playing back WAY too fast. Here's the command I'm using for the stream which works like champ except for the speed on the YouTube end:
sudo /opt/vc/bin/raspivid -o - -t 0 -fps 30 -h 720 -w 1280 -rot 270 | /usr/src/ffmpeg/ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec h264 -filter:v "setpts=1.0*PTS" -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/REMOVED
Here's a typical output on the console:
sudo /opt/vc/bin/raspivid -o - -t 0 -fps 10 -h 720 -w 1280 -rot 270 | /usr/src/ffmpeg/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/ffmpeg version N-78791-ge7345ab Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --enable-libmp3lame --enable-libfaac
libavutil 55. 19.100 / 55. 19.100
libavcodec 57. 27.101 / 57. 27.101
libavformat 57. 26.100 / 57. 26.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 37.100 / 6. 37.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, s16le, from '/dev/zero':
Duration: N/A, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Input #1, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: h264 (High), yuv420p, 1280x720, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/':
Metadata:
encoder : Lavf57.26.100
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 1280x720, q=2-31, 25 fps, 25 tbr, 1k tbn, 1200k tbc
Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.27.101 aac
Stream mapping:
Stream #1:0 -> #0:0 (copy)
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
[flv @ 0x2ab3830] 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 @ 0x2a525c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
size= 170976kB time=00:04:13.88 bitrate=5516.9kbits/s speed=0.325x
Saw a partial response on this here, and I've got mine "working" just need help with the SPEED :)>.