[FFmpeg-user] vaapi crop and video size filters

owen s owen94012 at gmail.com
Thu Jan 21 10:06:12 EET 2021


Mak thanks again, you are correct; what I needed to do was to crop the
image before uploading it. I didn't realize that I could change the order
of the commands in the video filter strings.

Thanks again!

On Wed, Jan 20, 2021 at 9:42 PM Mark Thompson <sw at jkqxz.net> wrote:

> On 20/01/2021 03:06, owen s wrote:
> > with software libx264 using crop filter
> > crop=width:heigh:x:y, i could crop around a specific point. using
> > h264_vaapi and -vf crop=width:height
> > doesn't control the crop location.
> >
> > also with libx264 -video_size=widthxheight worked, but with h264_vaapi,
> the
> > video resolution comes out to be the max size of the video framebuffer
> > 65535x65535 in my case.
> >
> > Can I set where the h264_vaapi crop x,y position and how do I control the
> > resolution after using h264_vaapi?
> >
> > log file: http://0x0.st/-ifF.txt
>
> This crops your 2560x1440 input to 2560x1440 so it is unsurprising that
> nothing happens.
>
> More generally, cropping is supported by VAAPI filters but not by the
> encoder (due to internal API constraints which probably derive from actual
> hardware constraints).
>
> Therefore, you should crop either before upload (if you are uploading) or
> before applying a filter (when staying in VAAPI surfaces).  If you aren't
> filtering at all (pure decode->encode), then you need to insert a null
> scale before the encode (which is an extra copy, but can't be avoided when
> the encoder doesn't support that input).
>
> So:
>
> ffmpeg -i ... -vf crop=...,format=nv12,hwupload -c:v h264_vaapi ...
>
> ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i ... -vf
> crop=...,scale_vaapi=... -c:v h264_vaapi ...
>
> - Mark
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list