0

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:

  • Are you able to live stream to YouTube with any other tool? – llogan Nov 19 '17 at 17:53
  • Yes, OBS is working great. But I want to use ffmpeg because my final target is to stream via a Raspberry Pi Zero W, since ffmpeg seems to not need so much resources compared with OBS. – Benedikt Neumayr Nov 21 '17 at 15:47
  • Could you also share how you manage the firewall config? – mlee_jordan Mar 01 '22 at 13:40
  • 1
    @mlee_jordan Thank you for your interest in this topic! I updated the answer below to include more details regarding the workaround. I cannot provide a more in-depth guide, as the configuration options differ from firewall to firewall. If in doubt, please refer to the manual of your specific model to implement the solution explained below. – Benedikt Neumayr Mar 02 '22 at 15:28

1 Answers1

2

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.