asticode/go-astiav

hw_decode.c and hardware_decode.go differ slightly

Closed this issue · 4 comments

When running hw_decode.c from the ffmpeg sources and using the hardware type qsv this error is shown:

Decoder h264 does not support device type qsv.

The astiav example seems to be missing the ability to perform the check here: https://github.com/FFmpeg/FFmpeg/blob/n7.1/doc/examples/hw_decode.c#L203

As a result, running the example with qsv throws an error at the TransferHardwareData call because the decoder is silently running on cpu, so the input frame is not a hardware frame and throws an invalid parameter error.

Can you confirm that the example now works properly on the dev branch with my new commit?

That didn't fix the issue but I think I did find the problem.

The zero value of astiav.PixelFormat is astiav.PixelFormatYuv420p and the code here seems to make an assumption that the zero value is astiav.PixelFormatNone

You're right, I've pushed force on dev a new commit, could you confirm it fixes your issue?

FYI I've merged the fix in master 👍