nareix / joy4

Golang audio/video library and streaming server
MIT License
2.66k stars 501 forks source link

Wirecast RTMP streaming troubles #33

Open ghost opened 7 years ago

ghost commented 7 years ago

Hello, I have an issue when streaming from Wirecast to a simple server using joy4/rtmp (server creates a file using avutil.Create, writes a header based on rtmp.Conn streams, reads from RTMP connection and writes packets to file, on closing of the connection writes trailer). When encoding in Wirecast is set to 3 - Very fast, or slower, I have a green screen (sometimes) in output file and sound missing.

ffprobe -i output file gives me:

[h264 @ 0x2ceaa20] missing picture in access unit with size 122 [h264 @ 0x2ceaa20] non-existing PPS 1 referenced [h264 @ 0x2ceaa20] sps_id 32 out of range [h264 @ 0x2ceaa20] reference count 1 overflow

When using a faster encoding level - everything is fine, no errors with ffprobe. I checked network connection (by the way it is fast enough not to cause troubles).

When I get RTMP stream from nginx-rtmp server, read it with rtmp.Conn.ReadPacket, put it to a pipe, the read a pipe with ffmpeg and read the ffmpeg output with ts.Demuxer, then write it to file with ts.Muxer, I have the same issues (sound missing and green screen on encoding 3 - Very fast or slower)

When I first get RTMP stream from nginx-rtmp server with ffmpeg, use no encoding (just "copy"), output it to stdout, set ts.Demuxer to read stdout and then use ts.Muxer to write to a file - everything is fine even with slower encoding.

May the problem be in rtmp.Conn component?