go2rtc
go2rtc copied to clipboard
How to make RTMP PUSH to go2rtc work?
go2rtc.yaml:
streams:
mystreamname:
rtmp:
listen: ":1935"
I start go2rtc and see:
INF [rtmp] listen addr=:1935
Then I start streaming with ffmpeg from the same machine:
ffmpeg -re -i ./video.avi -c:v libx264 -c:a aac -f flv rtmp:/localhost/mystreamname
Nothing appears in go2rtc log. Processed frames don't appear in ffmpeg log.
Note: If I change the URL in the ffmpeg command line to YouTube live URL with my key, ffmpeg shows processed frames and the video appears on YouTube streaming panel.
If I cancel ffmpeg stream with CTRL+C, the following appears in go2rtc log:
ERR github.com/AlexxIT/go2rtc/internal/rtmp/rtmp.go:61 > error=EOF
What am I doing wrong?
You're doing the right thing. But I was not able to use ffmpeg for this. Maybe a bug in ffmpeg. Maybe some wrong implementation in go2rtc. I've tested this with other applications.
My main goal is to send a 24/7 video stream from my IP camera running OpenIPC behind a NAT, which is not under my control, to my server and then to multiple viewers.
When I start sending RTMP stream from OpenIPC to go2rtc, it says from time to time:
23:39:18.092 ERR github.com/AlexxIT/go2rtc/internal/rtmp/rtmp.go:61 > error="rtmp: read command 020007636f6e6e656374003ff000000000000003000361707002000000047479706502000a6e6f6e70726976617465000e737570706f727473476f417761790101000673776655726c02001272746d703a2f2f3139322e3136382e302e320005746355726c02001272746d703a2f2f3139322e3136382e302e32000009"
When in the web interface, in mystreamname row, Commands column, I press Stream, a video player opens with the message "mse: streams: unknown error".
Does it mean, that streaming RTMP from OpenIPC does not work, too?
@AlexxIT, does it mean, that you were able to reproduce this bug? If yes, then what are the chances, that the bug will be fixed in the nearest future? Do you need my help with testing? Thank you.
P. S. Oops, closed the issue by accident.
I don't have any OpenIPC device. But I'll check your error when have time.
I can sent a RTMP stream from my camera to your IP!
I don't have any OpenIPC device. But I'll check your error when have time.
We will send the devices to you shortly.
Thank you for your work!
I'm having this issue as well.
I'm using Go2RTC bundled within the Frigate container (ghcr.io/blakeblackshear/frigate:0.15.0)
go2rtc version=1.9.2 platform=linux/amd64 revision=b2399f3
Relevant bits from go2rtc config:
rtmp:
listen: :1935
streams:
usb-cam: # intentionally blank
Attempting to stream to this from FFMPEG:
ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -f flv rtmp://<IP_ADDRESS_GO2RTC>/usb_cam
ffmpeg freezes, and then after a CTRL+C gives some warnings:
charles@charles-precisiont3610:~$ ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 -vcodec libx264 -preset ultrafast -tune zerolatency -f flv rtmp://<IP_ADDRESS_GO2RTC>/usb_cam
ffmpeg version 7.0.2-3ubuntu1 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 14 (Ubuntu 14.2.0-2ubuntu1)
configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 606653.952599, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 1000k tbn
[rtmp @ 0x5b12f0aef140] Cannot read RTMP handshake response
[out#0/flv @ 0x5b12f0ae3c40] Error opening output rtmp://<IP_ADDRESS_GO2RTC>/usb_cam: Immediate exit requested
Error opening output file rtmp://<IP_ADDRESS_GO2RTC>/usb_cam.
[video4linux2,v4l2 @ 0x5b12f0ae2240] Some buffers are still owned by the caller on close.
ioctl(VIDIOC_QBUF): Bad file descriptor
Go2RTC logs show nothing until killing the FFMPEG process, at which time this is logged:
3/5/2025, 9:16:45 AM error undefined error=EOF caller=github.com/AlexxIT/go2rtc/internal/rtmp/rtmp.go:62
https://github.com/AlexxIT/go2rtc/releases/tag/v1.9.9