[Libav-user] FW: Hardware scaling with libavfilter

Wang, Fei W fei.w.wang at intel.com
Mon Feb 14 05:54:40 EET 2022


On Mon, 2022-02-14 at 03:32 +0000, icy_flurry via Libav-user wrote:
Tried that, the same thing occurred. Would posting more code help?

Let's turn to IRC, I am feiw in ffmpeg/ffmpeg-devel. I'd like to know more about your hw information.

By the way, I may also want to resize the image in addition to changing the colorspace, so do I add another scale_vaapi filter or can I do both with one filter?

One scale_vaapi is enough, example code:

scale_vaapi=w=640:h=360,hwdownload,format=bgra



------- Original Message -------
On Sunday, February 13th, 2022 at 10:19 PM, Wang, Fei W <fei.w.wang-at-intel.com at ffmpeg.org> wrote:
On Mon, 2022-02-14 at 02:23 +0000, icy_flurry via Libav-user wrote:
Hi,

The input format is the VA-API format (ie AV_PIX_FMT_VAAPI), as I'm passing a hardware frame to the filter, though it is NV12 before I pass the frame to the decoder, if that's relevant.

If so, you can compare your case with cmdline:

$ ffmpeg -hwaccel vaapi -init_hw_device vaapi=hw:/dev/dri/renderD128 -hwaccel_output_format vaapi -v verbose -i test.h264 -vf 'scale_vaapi=format=bgra,hwdownload,format=bgra' -f rawvideo -vsync passthrough -vframes 30 -y out_BGRA.yuv

This cmdline decode a h264 file into vaapi frame and use scale_vaapi to convert color space into BGRA. This cmdline works for me here.


Thanks
------- Original Message -------
On Sunday, February 13th, 2022 at 9:10 PM, Wang, Fei W <fei.w.wang-at-intel.com at ffmpeg.org> wrote:
Hi,

What's your input format? Maybe you can use ffmpeg cmdline to confirm it first, like:


ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -v verbose -f rawvideo -pix_fmt nv12 -s:v 1280x720 -i input_NV12.yuv -vf 'hwupload,scale_vaapi=format=bgra,hwdownload,format=bgra' -f rawvideo -vsync passthrough -an -vframes 10 -y output_NV12_to_BGRA.yuv

And more vaapi use case you can reference ffmpeg-vaapi wiki:

https://trac.ffmpeg.org/wiki/Hardware/VAAPI


Thanks
Fei



From: Libav-user <libav-user-bounces at ffmpeg.org> On Behalf Of andr box
Sent: Monday, February 14, 2022 6:05 AM
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
Subject: Re: [Libav-user] Hardware scaling with libavfilter



ne 13. 2. 2022 v 22:55 odesílatel icy_flurry via Libav-user <libav-user at ffmpeg.org<mailto:libav-user at ffmpeg.org>> napsal:
Hi,

I'm trying to scale an image in hardware using VA-API with libavfilter. I also want to change the colorspace of the image to BGRA. However, the output frame I get is just a black image with a white line on top. How do I fix this? Let me know if more information is required.

Code: https://pastecord.com/eqagejavum.cpp

Thanks in advance
_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org<mailto:Libav-user at ffmpeg.org>
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
libav-user-request at ffmpeg.org<mailto:libav-user-request at ffmpeg.org> with subject "unsubscribe".


_______________________________________________

Libav-user mailing list

<mailto:Libav-user at ffmpeg.org>

Libav-user at ffmpeg.org

<https://ffmpeg.org/mailman/listinfo/libav-user>

https://ffmpeg.org/mailman/listinfo/libav-user



To unsubscribe, visit link above, or email

<mailto:libav-user-request at ffmpeg.org>

libav-user-request at ffmpeg.org

 with subject "unsubscribe".


_______________________________________________

Libav-user mailing list

<mailto:Libav-user at ffmpeg.org>

Libav-user at ffmpeg.org


<https://ffmpeg.org/mailman/listinfo/libav-user>

https://ffmpeg.org/mailman/listinfo/libav-user



To unsubscribe, visit link above, or email

<mailto:libav-user-request at ffmpeg.org>

libav-user-request at ffmpeg.org

 with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220214/70467422/attachment.htm>


More information about the Libav-user mailing list