Skip to content

Instantly share code, notes, and snippets.

@Shamim-38
Created December 3, 2022 12:17
Show Gist options
  • Save Shamim-38/1a2d557d9c06163e8f7a302a77d08ecc to your computer and use it in GitHub Desktop.
Save Shamim-38/1a2d557d9c06163e8f7a302a77d08ecc to your computer and use it in GitHub Desktop.
Resizing_Video.sh
Pretty good solution. One can resize a video as:
ffmpeg -i AigCblw--hk_000067_000077.mp4 -vf "scale='if(gt(ih,iw),256,trunc(oh*a/2)*2):if(gt(ih,iw),trunc(ow/a/2)*2,256)'" output.mp4
For multiple videos, one can perform (please mkdir a videos_resized folder in prepath ../):
for f in *.mp4 ; do ffmpeg -i "$f" -vf "scale='if(gt(ih,iw),256,trunc(oh*a/2)*2):if(gt(ih,iw),trunc(ow/a/2)*2,256)'" "../videos_resized/$f" ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment