Reputation: 375
I can't use DXVA2 hardware acceleration for decoding of HEVC video with ffmpeg. DXVA2 for H.264 works fine.
I compiled an official example hw_decode.c from ffmpeg sources:
https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/hw_decode.c
When I call av_send_packet() it performs a callback assigned in AVCodecContext->get_format and returns only AV_PIX_FMT_YUV420P for HEVC video instead of AV_PIX_FMT_DXVA2_VLD for all H.264 videos. So HW decoding doesn't work.
Software decoding of HEVC works without problems.
MPC-HC plays fine HEVC video with DXVA2 (CPU loading is low and Task Manager shows work of Video decoder in GPU details). My video card is Geforce 1060.
Upvotes: 0
Views: 1920
Reputation: 173
I have fix this by adding function :
enum AVPixelFormat get_hw_format(AVCodecContext *ctx,
const enum AVPixelFormat *pix_fmts)
{
return AV_PIX_FMT_DXVA2_VLD;
}
Assigned adress of above function pCodecContext->get_format = get_hw_format;
Upvotes: 0