Created
February 1, 2022 04:55
-
-
Save taojy123/c410a5db3d564614439ad41b86ebc1b1 to your computer and use it in GitHub Desktop.
使用 ffmpeg 裁剪视频
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
fnames = os.listdir('s1') | |
fnames.sort() | |
for fname in fnames: | |
if 'mp4' not in fname: | |
continue | |
if 'mini' in fname: | |
continue | |
print(fname) | |
fname2 = fname.replace('.mp4', '_mini.mp4') | |
# cmd = f"./ffmpeg -i s1/{fname} -vf crop='in_w:in_h*0.643:0:in_h*0.15' -acodec copy -t 120 s1/{fname2}" | |
cmd = f"./ffmpeg -i s1/{fname} -vf crop='in_w:in_h*0.643:0:in_h*0.15' s1/{fname2}" | |
print(cmd) | |
os.system(cmd) | |
print('========================== finish ===================================') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment