简体   繁体   中英

FFMPEG H.265 C++ based encoder: avcodec_open2 fails

My FFMPEG based c-code the correctly produces h.264 encoded video files when I set the codec ID to "AV_CODEC_ID_H264". When I change it to "AV_CODEC_ID_HEVC" I get this output from these particular lines of code.

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

I have the FFMPEG version 4.1 build. I was under the assumption that H.265 codec where part of this release. What am missing?

I did some more research and I got it to work. HEVC encoders are NOT part of the standard FFMPEG build. I rebuilt it including wit both x264 and x265 external libraries by adjusting the build scripts. I will document this for myself for future reference. The DLLs must not have included the functions that belong to x265, which is what I assumed to be part of a standard FFMPEG build for some reason.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM