I wanna crop a picture by using the ffmpeg's functions(like av_picture_crop or vf_crop), not command line utility.
Is there any one knows how to do it?
Do you have the source code for this function?
I wanna crop a picture by using the ffmpeg's functions(like av_picture_crop or vf_crop), not command line utility.
Is there any one knows how to do it?
Do you have the source code for this function?
av_picture_crop()
is deprecated.To use
vf_crop
, use thebuffer
andbuffersink
filters in libavfilter:Don't forget to unref the returned (croppped) frame using
av_frame_free()
. The input frame data is untouched so if you don't need it beyond this function, you need toav_frame_free()
the input frame also.If you intend to crop many frames, try to retain the filter graph between frames and only reset it (or recreate it) when the frame size/format changes. I'm leaving it up to you to figure out how to do that.