Reputation: 2062
I have a video that I want to first crop, then scale and output the result as images. I've looked around in the docs but couldn't find a definite answer as to in what order ffmpeg applies its filters. Currently, I'm running
ffmpeg -i vid -filter:v "crop={0}:{1}:{2}:{3}".format(str(width), str(height), str(x_min), str(y_min)) -c:a copy -crf 23 crop_vid
Followed by
ffmpeg -i crop_vid -vf 'scale={0}*iw:{0}*ih'.format(str(resize_factor)) -c:a copy -crf 23 os.path.join(img_path, '%04d.bmp')
I'm running these as subprocesses from a python script, hence the partial python notation. Could I somehow run this as one script ensuring the order of first crop, then scale instead of running ffmpeg twice?
Upvotes: 0
Views: 1031
Reputation: 93171
Sure, you need to specify the filters in the required order, separated by a comma.
So -filter:v "crop=W:H:X:Y,scale=W:H"
Upvotes: 2