- Server: https://github.com/nareix/joy4/tree/master/examples/http_flv_and_rtmp_server
- Publish: https://github.com/nareix/joy4/tree/master/examples/rtmp_publish
I started the server first, then ran rtmp_publish to publish flv data to the server. Unfortunately, it didn't work.
After that, I tried to publish with ffmpeg:
$ ffmpeg -re -i projectindex.flv -c copy -f flv rtmp://localhost:1936/app/publish
It worked and I could play the stream with VLC.
Then I checked the log on the server. For ffmpeg, the log contains Accept and Parsing URL. But for rtmp_publish.go, the log only contains Accept.
I tested with a flv file (
sample-3.flv) downloaded from https://getsamplefiles.com/sample-video-files/flv, and both ffmpeg andrtmp_publish/main.gowork. Can you please test with this file?If it works, then it's most likely that the flv file you tested at first contains stream that is not supported by the package.
I haved checked the information of
sample-3.flvwithffprobe:You can check yours and compare the output with the one above (but I don't know what is or is not supported by the package).
Notes for others who want to run the example:
First, the source code of the package does not contain a
go.modfile. Create one at the root of the repository:http_flv_and_rtmp_serverlistens on port1935by default. So if we don't change the server, we have to changertmp_publish/main.go:And the ffmpeg command should be:
And the stream can be played with
ffplay:Make sure
sample-3.flvis in the current working directory when runningffmpegorgo run rtmp_publish/main.go