I am experiencing a problem when sending video streams from an Android device to an RTMP server. Specifically, when using the hardware encoder (c2.rk.avc.encoder), the resulting TS video files stored on the RTMP server cannot be played and throw the following error:
[h264 @ 0x7f26c5743780] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0x7f26c5743780] decode_slice_header error
[h264 @ 0x7f26c5743780] no frame!
[mpegts @ 0x7f26c7e70800] decoding for stream 0 failed
[mpegts @ 0x7f26c7e70800] Could not find codec parameters for stream 0 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from '1683107889036.ts':
Duration: 00:00:08.16, start: 14.300000, bitrate: 802 kb/s
Program 1
Stream #0:0[0x100]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 131 kb/s
However, when I use the software encoder (c2.android.avc.encoder), there are no decoding errors, and the resulting video files can be played without issue.
Upon analyzing the resulting video files with an H264 packet analyzer, it appears that the video encoded with the hardware encoder does not contain SPS and PPS units, while the video encoded with the software encoder does.
Analysis:
I am using MediaCodec on Android to send the stream and must use the hardware encoder SO. Can anyone help me with this issue?