在 mpegvideo.c 文件之外调用 ff_print_debug_info2

标签 c ffmpeg

我希望在 mpegvideo.c 文件之外调用 void ff_print_debug_info2(...)。例如,我想在以下代码片段中调用此函数:

static int decode_packet(int *got_frame, int cached)
{
    int ret = 0;
    int decoded = pkt.size;
    *got_frame = 0;
    if (pkt.stream_index == video_stream_idx) {
        /* decode video frame */
        ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
        if (ret < 0) {
            fprintf(stderr, "Error decoding video frame (%s)\n", av_err2str(ret));
            return ret;
        }
        if (*got_frame) {
/*here I want to print debug info*/
//void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)     
        }
    }
    return decoded;
}

我想知道这是否可能,我该如何将参数传递给 void ff_print_debug_info2(...)

ps:我已经知道的参数: 1.AVCodecContext *avctx: video_dec_ctx 2.AVFrame *pict: frame 3.int8_t *qscale_table:frame->qscale_table。 其他人呢?

最佳答案

这个函数已经是called H264解码器为您服务。它不受任何其他解码器的支持,会导致崩溃。您永远不需要手动调用它。如果您在 H264 帧解码后没有看到帧上打印任何调试信息,请尝试使用:

avctx->debug |= FF_DEBUG_VIS_QP |
                FF_DEBUG_VIS_MB_TYPE |
                FF_DEBUG_SKIP |
                FF_DEBUG_QP |
                FF_DEBUG_MB_TYPE;
avctx->debug_mv = FF_DEBUG_VIS_MV_P_FOR |
                  FF_DEBUG_VIS_MV_B_FOR |
                  FF_DEBUG_VIS_MV_B_BACK;

在(感谢更正!)您调用 avcodec_open2() 之后。之后,您应该会在框架 (*_VIS_*) 或终端(其他)上看到相应的调试信息。

MPEG-1/2/4 解码器也支持这些标志,尽管它们是通过不同的函数 (ff_print_debug_info()) 实现的。

关于在 mpegvideo.c 文件之外调用 ff_print_debug_info2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37456961/

相关文章:

video - 使用 ffmpeg 将带有不连续标记的 HLS 转换为 MP4

c - Valgrind 下的程序输出显着不同

opencv - ffmpeg 失败 - 455 方法在此状态下无效

c - 返回什么;在 boolean 返回类型返回的 C 函数中?

C 指针段错误混淆

ruby - 如何在 ruby​​ 项目中包含库?

ffmpeg - 使用 FFmpeg 精确切割 mp4 文件

ffmpeg - 如何使用 ffmpeg 和 c++ 将自制流发布到 rtmp 服务器?

有人可以使用可视化图表解释 C 中 **param 和 *param 之间的区别吗?

c - 枚举类型如何用于分配寄存器