【问题标题】:Error while decoding camera stream video frame using FFMpeg iOS使用 FFMpeg iOS 解码相机流视频帧时出错
【发布时间】:2016-02-29 16:45:49
【问题描述】:

我有一个应用程序,在其中我正在解码来自 ip camera 的视频帧,但是 avcodec.h 中的方法 avcodec_decode_video2(m_pCodecCtx, m_pFrame, &consumed_bytes, &avpkt); 生成 bad_access,我不知道出了什么问题。

这个应用程序在旧库 FFMpeg 上运行良好,但根据苹果政策,为了发布支持 arm64 的应用程序,所以我更新了我的库以支持 arm64,之后出现了这个问题。

这是截图

当 bad_access 应用生成以下日志时:

[h264 @ 0x1071400] sps_id 12 out of range
[h264 @ 0x1071400] pps_id 417 out of range
[h264 @ 0x1071400] sps_id 3 out of range
[h264 @ 0x1071400] sps_id 32 out of range
[h264 @ 0x1071400] sps_id 6 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 32 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 3 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 32 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 32 out of range
[h264 @ 0x1071400] sps_id 3 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] pps_id 418 out of range
[h264 @ 0x1071400] Partitioned H.264 support is incomplete
[h264 @ 0x1071400] sps_id 6 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 1 out of range
[h264 @ 0x1071400] non-existing PPS 3 referenced
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] slice type 10 too large at 0 0
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] non-existing PPS 2 referenced
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] slice type 29 too large at 0 0
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] sps_id 2 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] sps_id 0 out of range
[h264 @ 0x1071400] slice type 32 too large at 0 0
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] slice type 32 too large at 0 0
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] slice type 32 too large at 0 0
[h264 @ 0x1071400] decode_slice_header error
[h264 @ 0x1071400] slice type 32 too large at 0 0

完整的错误日志: https://drive.google.com/file/d/0B-Nh7ci6wLX0OVlxaXV4aGpJems/view?usp=sharing

崩溃日志: http://crashes.to/s/6765d63b540

注意:如果您还有其他需要,请发表评论。

【问题讨论】:

  • 该屏幕截图似乎与崩溃日志不匹配。崩溃日志看起来像是取消引用 NULL 的问题。了解参数值也很有用。
  • 你想看什么参数。告诉我你需要什么。
  • 传递给那个方法的参数
  • 让我更新崩溃日志和参数。请稍候
  • @trojanfoe 更新了我的问题。

标签: c++ ios ffmpeg h.264 ip-camera


【解决方案1】:

我解决了我的问题,问题在于折旧的方法avcodec_alloc_frame()

我在构造函数中使用了以下代码

    m_pCodecCtx = avcodec_alloc_context3(m_pCodec);
    if(m_pCodecCtx == NULL)
    {
        NSLog(@"if(pCodecCtx == NULL)\n");
        return ;
    }  
   [g_Lock lock];
    //¥Úø™codec°£»Áπ˚¥Úø™≥…𶵃ª∞£¨∑÷≈‰AVFrame£     
    if(avcodec_open2(m_pCodecCtx, m_pCodec, NULL) >= 0)     
    {     
        m_pFrame = avcodec_alloc_frame();   /* Allocate video frame   */

    }
    [g_Lock unlock];

然后我最终更新了我的头文件,之后我收到了关于方法avcodec_alloc_frame() 折旧的警告,所以我将它更新为av_frame_alloc(),它完美运行!

【讨论】:

    猜你喜欢
    • 2013-02-06
    • 1970-01-01
    • 2014-06-14
    • 2018-02-12
    • 1970-01-01
    • 2021-03-16
    • 2012-02-24
    • 2018-06-10
    • 2012-07-04
    相关资源
    最近更新 更多