EDIT: It already works. My new router seems to block rtmp traffic. I edited the firewall config and now it works!
I'm trying to stream to YouTube with ffmpeg with the following command:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video0 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -strict experimental -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/45ee-qka9-0djm-796z
My ffmpeg version 2.8.11 on Linux Mint 18.2 then says:
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1511081240.166016, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[video4linux2,v4l2 @ 0xacba60] The driver changed the time per frame from 1/10 to 2/15
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 5907.755626, bitrate: 110592 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 110592 kb/s, 7.50 fps, 7.50 tbr, 1000k tbn, 1000k tbc
After that it does nothing for about 3 minutes,then it finally returns the following error:
RTMP_Connect0, failed to connect socket. 110 (Connection timed out)
rtmp://a.rtmp.youtube.com/live2: Unknown error occurred
I used these instructions:
Finally, I found an easy solution. Quite unexpectedly, the firewall of my router blocks outgoing RTMP traffic by default. By adding a port trigger rule for the well-known RTMP port (1935-TCP), I managed to work around this issue.
I am aware that this is not the most elegant fix, but my ISP's router does not exactly boast with configuration options, so the method above was the only possible way to address this problem.