[FFmpeg-user] Green line with vaapi scaling

Mark Thompson sw at jkqxz.net
Sun Jun 17 23:18:44 EEST 2018


On 13/06/18 19:22, André Hänsel wrote:
> When I scale with scale_vaapi, it results in a green line at the bottom of
> the image, see attachment.
> 
> Command line:
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
> -hwaccel_output_format vaapi -i bbb.mp4 -vf
> "scale_vaapi=w=240:h=135:format=yuv420p,hwdownload,format=yuv420p" -frames 1
> out.png
> 
> It probably matters that I'm scaling to a height that is not divisible by 2
> or 16. The input video here is Big Buck Bunny 1080p.

Yeah, I don't think scaling a chroma-subsampled format to an odd dimension is going to act consistently.  This probably isn't an ffmpeg issue - it will depend on the VAAPI driver and hardware (I can reproduce the green line you have with the latest Intel i965 driver on gen9 hardware, it goes away if I scale to height 134 or 136 instead).

> Extra question: Why do I need the second "format=yuv420p" after the
> hwdownload filter? If I omit it, FFmpeg just gets stuck.

The filter negotiation for the output doesn't have information to realise that the output format needs to be the hardware format of the input frame to hwdownload, because at the point that formats are negotiated that isn't known and so hwdownload declares that it might output any software format.  As a result, the avfilter setup picks something appropriate to the following component (in this case the PNG encoder), and that isn't necessarily something which hwdownload can actually use so it throws an error in that case.

- Mark


More information about the ffmpeg-user mailing list