RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

E/H264Packet: waiting for a valid sps and pps

Open j0hnw0rk3r opened this issue 2 years ago • 2 comments

Hi @pedroSG94, First I'm greatful of this library it helped me wind up my streaming problems.

I have an android app that integrates a USB camera (Otoscope) using a UVC usb library but without RTMP support. The usb camera library (written in java) supports video encoder and exports chunk of videos which is ByteArray, and with offset, length, timestamp.

I want to stream this chunk of video data into my RTMP server (nginx). Using the RTMPClient class, I called sendVideo I sent the video data as:

val info = MediaCodec.BufferInfo()
info.offset = offset
info.size = length
info.presentationTimeUs = timestamp
rtmpClient.sendVideo(ByteBuffer.wrap(data), info)

But I'm getting

I/RtmpSender: Skipping iteration, frame null
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps
E/H264Packet: waiting for a valid sps and pps

j0hnw0rk3r avatar Mar 22 '22 12:03 j0hnw0rk3r

Hello,

You missed flag value in MediaCodec.BufferInfo class. Also, you need set sps and pps to RtmpClient class to init stream. You have an issue here that is like your case: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/issues/1033 RtspClient and RtmpClient usage is the same so you can apply all for this case.

pedroSG94 avatar Mar 22 '22 14:03 pedroSG94

Thank you! I will try this and get back to you with results

j0hnw0rk3r avatar Mar 22 '22 14:03 j0hnw0rk3r