AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.57k stars 370 forks source link

How to make RTMP PUSH to go2rtc work? #1318

Open usa- opened 1 month ago

usa- commented 1 month ago

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?

AlexxIT commented 1 month ago

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.

usa- commented 1 month ago

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?

usa- commented 1 month ago

@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.

AlexxIT commented 1 month ago

I don't have any OpenIPC device. But I'll check your error when have time.

usa- commented 1 month ago

I can sent a RTMP stream from my camera to your IP!