微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

基于 FFMPEG H.265 C++ 的编码器:avcodec_open2 失败

如何解决基于 FFMPEG H.265 C++ 的编码器:avcodec_open2 失败

当我将编解码器 ID 设置为“AV_CODEC_ID_H264”时,我基于 FFMPEG 的 c 代码正确生成了 h.264 编码的视频文件。当我将其更改为“AV_CODEC_ID_HEVC”时,我会从这些特定的代码行中获得此输出

ret = avcodec_open2(c,codec,&opt);
    av_dict_free(&opt);
    if (ret < 0) {
        fprintf(stderr,"Could not open video codec: %s\n",av_err2str(ret));
        exit(1);
    }
[hevc_mf @ 000001F604B62F00] Could not find any MFT for the given media type
[hevc_mf @ 000001F604B62F00] Could not create MFT
Could not open video codec: Function not implemented

我有 FFMPEG 4.1 版本。我假设 H.265 编解码器是此版本的一部分。缺少什么?

解决方法

我做了一些更多的研究,并让它发挥了作用。 HEVC 编码器不是标准 FFMPEG 构建的一部分。我通过调整构建脚本重建了它,包括 x264 和 x265 外部库。我会为自己记录下来以备将来参考。 DLL 必须不包含属于 x265 的函数,出于某种原因,我认为这是标准 FFMPEG 构建的一部分。

x265 [info]: HEVC encoder version 3.5+10-82786fccc
x265 [info]: build info [Windows][MSVC 1929][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main 10 profile,Level-2 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(5 rows)
x265 [warning]: Source height < 720p; disabling lookahead-slices
x265 [info]: Coding QT: max CU size,min CU size : 64 / 8
x265 [info]: Residual QT: max TU size,max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 1 / 12 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-400 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
Output #0,hevc,to 'output.mov':
  Stream #0:0: Video: hevc,yuv420p,352x288,q=2-31,400 kb/s,25 tbn

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。