我正在尝试使用opencv和SDP文件在python中播放一些RTP流。我得到一个灰色的窗口,顶部有一些扭曲的图像(请参阅附件的图像),几秒钟后程序将崩溃,灰色的窗口将关闭。
我还尝试通过Wireshark捕获流的数据包,并使用媒体信息提取视频信息。
注意:提取的视频播放流畅。
使用GSpot的媒体信息
SDP文件包含:
v=0
m=video 5000 RTP/AVP 103
c=IN IP4 239.194.115.71
a=rtpmap:103 H264/90000
这些是终端中显示的错误代码:
[h264 @ 0000029d3c8d85c0] non-existing PPS 2 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] no frame!
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] no frame!
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] no frame!
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] no frame!
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c8d85c0] non-existing PPS 0 referenced
[h264 @ 0000029d3c8d85c0] decode_slice_header error
[h264 @ 0000029d3c8d85c0] no frame!
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c8d85c0] top block unavailable for requested intra mode
[h264 @ 0000029d3c8d85c0] error while decoding MB 2 0, bytestream 353
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] error while decoding MB 58 2, bytestream -11
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c8d85c0] error while decoding MB 13 3, bytestream -9
[h264 @ 0000029d3393e540] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e9c0] non-existing PPS 0 referenced
[h264 @ 0000029d3393e9c0] decode_slice_header error
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c952300] non-existing PPS 0 referenced
[h264 @ 0000029d3c952300] decode_slice_header error
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3cf7c940] non-existing PPS 0 referenced
[h264 @ 0000029d3cf7c940] decode_slice_header error
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e540] non-existing PPS 0 referenced
[h264 @ 0000029d3393e540] decode_slice_header error
[h264 @ 0000029d3393e9c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e9c0] non-existing PPS 0 referenced
[h264 @ 0000029d3393e9c0] decode_slice_header error
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c952300] non-existing PPS 0 referenced
[h264 @ 0000029d3c952300] decode_slice_header error
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3cf7c940] non-existing PPS 0 referenced
[h264 @ 0000029d3cf7c940] decode_slice_header error
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e540] non-existing PPS 0 referenced
[h264 @ 0000029d3393e540] decode_slice_header error
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e9c0] non-existing PPS 0 referenced
[h264 @ 0000029d3393e9c0] decode_slice_header error
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c952300] non-existing PPS 0 referenced
[h264 @ 0000029d3c952300] decode_slice_header error
[h264 @ 0000029d3c952300] no frame!
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3cf7c940] non-existing PPS 0 referenced
[h264 @ 0000029d3cf7c940] decode_slice_header error
[h264 @ 0000029d3cf7c940] no frame!
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e540] non-existing PPS 0 referenced
[h264 @ 0000029d3393e540] decode_slice_header error
[h264 @ 0000029d3393e540] no frame!
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3393e9c0] non-existing PPS 0 referenced
[h264 @ 0000029d3393e9c0] decode_slice_header error
[h264 @ 0000029d3393e9c0] no frame!
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] SPS unavailable in decode_picture_timing
[h264 @ 0000029d3c952300] non-existing PPS 0 referenced
[h264 @ 0000029d3c952300] decode_slice_header error
[h264 @ 0000029d3c952300] no frame!
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3cf7c940] top block unavailable for requested intra mode
[h264 @ 0000029d3cf7c940] error while decoding MB 2 0, bytestream 353
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e9c0] error while decoding MB 58 2, bytestream -11
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e9c0] error while decoding MB 13 3, bytestream -9
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] cabac decode of qscale diff failed at 59 2
[h264 @ 0000029d3c952300] error while decoding MB 59 2, bytestream 217
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] cabac decode of qscale diff failed at 70 1
[h264 @ 0000029d3cf7c940] error while decoding MB 70 1, bytestream 337
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] error while decoding MB 71 2, bytestream -17
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] error while decoding MB 33 2, bytestream -11
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] top block unavailable for requested intra mode
[h264 @ 0000029d3c952300] error while decoding MB 2 0, bytestream 371
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 11, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e540] cabac decode of qscale diff failed at 118 1
[h264 @ 0000029d3393e540] error while decoding MB 118 1, bytestream 379
[h264 @ 0000029d3393e9c0] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3c952300] cabac decode of qscale diff failed at 70 1
[h264 @ 0000029d3c952300] error while decoding MB 70 1, bytestream 377
[h264 @ 0000029d3cf7c940] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3cf7c940] Invalid NAL unit 12, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e540] Invalid NAL unit 10, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] Invalid NAL unit 0, skipping.
[h264 @ 0000029d3393e9c0] top block unavailable for requested intra mode -1
[h264 @ 0000029d3393e9c0] error while decoding MB 4 0, bytestream 291
[h264 @ 0000029d3c952300] Invalid NAL unit 12, skipping.
[h264 @ 00
Process finished with exit code -1
Python代码:
vcap = cv2.VideoCapture('test.sdp')
while (1):
ret, frame = vcap.read()
cv2.imshow('VIDEO', frame)
cv2.waitKey(1)
wireshark转储:
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLmltZ3VyLmNvbS9oTXlSczNOLnBuZyJ9” alt =“ ws”>
我是否在SDP文件中使用了错误的编解码器代码或时钟速率,才能正确显示流?
我使用MPEG TS多路分配器正确显示视频
请确保视频流以SPS,PPS开始。您可以在wireshark中进行检查。(如果可以,请共享wireshk转储)
首先启动python脚本,然后从实时摄像机开始流式传输。
这将确保您不会丢失来自网络摄像机的任何初始帧。
rtp的采样频率没有问题。