[libav-devel] [PATCH 9/9] avconv_dxva2: Allow output of hardware frames

Mark Thompson sw at jkqxz.net
Sun Apr 23 21:21:10 CEST 2017


---
Kindof hacky, but a simple way to make hardware transcode with dxva2 work in avconv without needing the hw_device_ctx support to convert it to the hw-generic tooling.

Slightly unfortunate that the pixfmt is called "dxva_vld", though.

Example:

./avconv.exe -y -init_hw_device dxva2 -hwaccel dxva2 -hwaccel_output_format dxva2_vld -i in.mp4 -an -vf 'hwmap=derive_device=qsv,format=qsv' -c:v h264_qsv -b 5M -maxrate 5M out.mp4


 avtools/avconv_dxva2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/avtools/avconv_dxva2.c b/avtools/avconv_dxva2.c
index 7578c3f63..710b1a818 100644
--- a/avtools/avconv_dxva2.c
+++ b/avtools/avconv_dxva2.c
@@ -137,6 +137,9 @@ static int dxva2_retrieve_data(AVCodecContext *s, AVFrame *frame)
     DXVA2Context       *ctx = ist->hwaccel_ctx;
     int                ret;
 
+    if (frame->format == ist->hwaccel_output_format)
+        return 0;
+
     ret = av_hwframe_transfer_data(ctx->tmp_frame, frame, 0);
     if (ret < 0)
         return ret;
-- 
2.11.0



More information about the libav-devel mailing list