|
| 1 | +import os |
| 2 | +import random |
| 3 | + |
| 4 | +fileName = 'Frozen.mp4' |
| 5 | +logoName = 'logo.png' |
| 6 | + |
| 7 | +# 截取视频 |
| 8 | +#os.popen('ffmpeg -i '+fileName+' -ss 00:31:15 -to 00:34:45 -c copy LetItGo.mp4') |
| 9 | + |
| 10 | +#截取图片 |
| 11 | + |
| 12 | +# for i in range(10): |
| 13 | +# hour = str(random.randint(0, 1)) |
| 14 | +# min = str(random.randint(0, 59)) |
| 15 | +# sec = str(random.randint(0, 59)) |
| 16 | +# os.popen('ffmpeg -ss ' + hour + ':' + min + ':' + sec + ' -i ' + fileName + ' -vframes:v 1 -q:v 2 ' + str(i) +'.jpg') |
| 17 | + |
| 18 | +# 添加水印 |
| 19 | +#os.popen('ffmpeg -i '+fileName + ' -i ' + logoName + ' -filter_complex "overlay=main_w-overlay_w:10" logo.mp4') |
| 20 | + |
| 21 | +# 添加文字水印 |
| 22 | +os.popen('ffmpeg -i '+fileName+' -vf "drawtext=fontfile=Arial Unicode.ttf:text=\'文字水印\':x=w-100:y=100:fontsize=24:fontcolor=red@0.5:shadowy=2" wordWatemark.mp4') |
| 23 | + |
| 24 | +# 提取音频 |
| 25 | +os.popen('ffmpeg -i LetItGo.mp4 -vn -c:a copy LetItGo.aac') |
0 commit comments