首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在src/libswscale/swscale_inder.h处断言描述失败:668

在src/libswscale/swscale_inder.h处断言描述失败:668
EN

Stack Overflow用户
提问于 2018-03-01 21:20:24
回答 1查看 1.8K关注 0票数 0

我遇到了一个非常奇怪的问题。我正在使用FFMPEG gdigrab设备捕获桌面。这就是我要做的

代码语言:javascript
复制
...
        options = NULL;
        av_dict_set(&options, "framerate", "30", NULL);
        av_dict_set(&options, "offset_x", QString::number(geometry.x() + 10).toLatin1().data(), NULL);
        av_dict_set(&options, "offset_y", QString::number(geometry.y() + 10).toLatin1().data(), NULL);
        av_dict_set(&options, "video_size", QString(QString::number(geometry.width() - 20) + "x" + QString::number(geometry.height() - 20)).toLatin1().data(), NULL);
        av_dict_set(&options, "show_region", "1", NULL);

        AVInputFormat* inputFormat = av_find_input_format("gdigrab");
        avformat_open_input(&inputFormatContext, "desktop", inputFormat, &options);
...
        AVPacket* packet = (AVPacket*)av_malloc(sizeof(AVPacket));
        av_init_packet(packet);

        AVFrame* frame = av_frame_alloc();
        AVFrame* outFrame = av_frame_alloc();

        int nbytes = av_image_get_buffer_size(outCodecContext->pix_fmt,
                                          outCodecContext->width,
                                          outCodecContext->height,
                                          32);

        uint8_t* outBuffer = (uint8_t*)av_malloc(nbytes);

        avpicture_fill((AVPicture*)outFrame, outBuffer,
                   AV_PIX_FMT_YUV420P,
                   outCodecContext->width, outCodecContext->height);

        SwsContext* swsContext = sws_getContext(inputCodecContext->width,
                                            inputCodecContext->height,
                                            inputCodecContext->pix_fmt,
                                            outCodecContext->width,
                                            outCodecContext->height,
                                            outCodecContext->pix_fmt,
                                            SWS_BICUBIC, NULL, NULL, NULL);
...

据我所知,应用程序在sws_getContext(...之后崩溃

它崩溃,并显示windows错误消息。

代码语言:javascript
复制
this application has requested the runtime to terminate it in an unusual way

所以我甚至不能调试哪里出了问题。

控制台中也有一条消息

代码语言:javascript
复制
Assertion desc failed at src/libswscale/swscale_internal.h:668

奇怪的是,我甚至没有任何swscale_internal.h文件

如果我需要提供其他信息以获得帮助,请告诉我。

EN

回答 1

Stack Overflow用户

发布于 2018-03-05 15:11:31

FFmpeg最新版本中,断言提示outCodecContext->pix_fmt未正确设置。而且也不推荐使用avpicture_fill,请改用av_image_fill_arrays。如果您使用的是旧版本的FFmpeg,则可以忽略弃用。但我建议使用最新的FFmpeg。希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49050600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档