Search code examples
ffmpegvideo-streamingstreamingrtmpflv

RTMP server can't stream video (only audio)


I'm implementing an RTMP server right now, and everything's been working except for video streaming. I can stream audio with no problems (using OBS to stream), and play it back via VLC. The problem is VLC plays the audio, but no video. What I'm doing right now is forwarding every audio and video message I receive from OBS, I grab the original payload (audio/video data) and put in a Type 0 Chunk, since I've seen pretty much every implementation do this. I don't know if I'm missing some sort of processing that should be done on the video data.

If I try to playback with ffmpeg (saving the RTMP stream to an flv file), then I get this output:

[NULL @ 000001eb053ed440] missing picture in access unit with size 5209 [AVBSFContext @ 000001eb053ecbc0] No start code is found. rtmp://192.168.1.2/app/publish: could not find codec parameters Input #0, flv, from 'rtmp://192.168.1.2/app/publish': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Data: none Stream #0:1: Video: h264, none, 1k tbn Output #0, flv, to 'av.flv': Output file #0 does not contain any stream

It says missing picture in access unit with size 5209, No start code is found, and could not find codec parameters. What am I missing here? I know I'm forwarding the payload exactly as I've received it in my server, I even did a hash check on the video payload I'm receiving and the one I'm sending and it's exactly the same. Any help would be greatly appreciated.


Solution

  • Fixed by following @szatmary's suggestion: resending the sequence headers to every playback client before sending any audio/video messages.