Using batch processing to traverse the current directory ./ is like this
for /r "./" %%G in (*) do (
)
Resize all files to 720p
for /r "./" %%G in (*) do (
ffmpeg -i "%%G" -vf scale=1280:720 "%%~dpnG_720p.mp4"
)
For example, the test.mp4 in the folder will become test_720p.mp4 with a 720p resolution.
Blur all files in the specified area
for /r "./" %%G in (*) do (
ffmpeg -i "%%G" -filter_complex "[0:v]crop=500:140:30:730,boxblur=20[fg]; [0:v][fg]overlay=30:730[out]" -map "[out]" -map 0:a "%%~dpnG_blurred.mp4"
)
- crop=500:140:30:730 Crop an area. (30,730) is the starting point, (500,140) is the size
- boxblur=20 is the blur parameter
- overlay=30:730 is to overlay the blurred cropped area as the foreground onto the background. Its parameter corresponds to the starting point of the crop
Blur all files in the specified area and then scale the size to 720p
for /r "./" %%G in (*) do (
ffmpeg -i "%%G" -filter_complex "[0:v]crop=500:140:30:730,boxblur=20[fg]; [0:v][fg]overlay=30:730,scale=1280:720[out]" -map "[out]" -map 0:a "%%~dpnG_720p.mp4"
)
Scaling this way will not affect the blur position. Because it is executed sequentially. The blur area has already been processed before scaling.