使用ffmpeg从RTSP流中捕获CPU使用率较低的图像

时间:2019-01-21 07:50:59

标签: ffmpeg cpu-usage rtsp

我正在使用ffmpeg在受限环境(小内存,磁盘和CPU)中从RTSP流捕获图像。我收到了很多损坏的图像,并且从ffmpeg日志中得到了以下错误:

[rtsp @ 0x7f164aca1220] max delay reached. need to consume packet
[rtsp @ 0x7f164aca1220] RTP: missed 21 packets
[h264 @ 0x7f164e7b31a0] error while decoding MB 118 17, bytestream -15
[h264 @ 0x7f164e7b31a0] concealing 6051 DC, 6051 AC, 6051 MV errors in P frame
[rtsp @ 0x7f164aca1220] max delay reached. need to consume packet
[rtsp @ 0x7f164aca1220] RTP: missed 155 packets
[h264 @ 0x7f164e7b31a0] error while decoding MB 61 19, bytestream -9
[h264 @ 0x7f164e7b31a0] concealing 5868 DC, 5868 AC, 5868 MV errors in P frame
[rtsp @ 0x7f164aca1220] max delay reached. need to consume packet
[rtsp @ 0x7f164aca1220] RTP: missed 5 packets
[h264 @ 0x7f164e7b31a0] error while decoding MB 68 45, bytestream -5
[h264 @ 0x7f164e7b31a0] concealing 2741 DC, 2741 AC, 2741 MV errors in P frame
[rtsp @ 0x7f164aca1220] max delay reached. need to consume packet
[rtsp @ 0x7f164aca1220] RTP: missed 4 packets
[h264 @ 0x7f164e7b31a0] error while decoding MB 40 48, bytestream -9
[h264 @ 0x7f164e7b31a0] concealing 2409 DC, 2409 AC, 2409 MV errors in P frame
[rtsp @ 0x7f164aca1220] max delay reached. need to consume packet
[rtsp @ 0x7f164aca1220] RTP: missed 243 packets
Input #0, rtsp, from 'rtsp://******:
version=1.0&action=getRTSPStream&ChannelID=1&ChannelName=Channel1
      Duration: N/A, start: 2.393333, bitrate: N/A
        Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 15 fps, 20 tbr, 90k tbn, 30 tbc
    Output #0, image2, to 'frames/image6.jpg':
      Metadata:
        title           : Media Presentation
        comment         : StreamingSetting?version=1.0&action=getRTSPStream&ChannelID=1&ChannelName=Channel1
        encoder         : Lavf57.56.101
        Stream #0:0: Video: mjpeg, yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 20 fps, 20 tbn, 20 tbc
        Metadata:
          encoder         : Lavc57.64.101 mjpeg
        Side data:
          cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))

我尝试了几种不同的方法来解决这些错误,例如使用TCP协议,如this所说:

"ffmpeg -nostats -loglevel 0 -rtsp_transport tcp -y -i rtsp://****** -vframes 1 frames/image" + str(count)  +".jpg"

但这不起作用。

当ffmpeg拍摄图像时,我检查了CPU使用率,发现CPU使用率高达99%。而且我认为损坏的图像很有可能是由于CPU使用率过高引起的。 我读了几篇文章来解决ffmpeg高CPU问题,同时捕获了视频而不是图像,例如this link

但是在使用ffmpeg捕获RTSP流中的图像时,我们是否有任何命令选项可以减少CPU使用率?

感谢您!

0 个答案:

没有答案