Python修改视频速度,视频加速播放并保存

下载库:

pip install -i https://mirrors.aliyun.com/pypi/simple moviepy

运行:

from moviepy.editor import *
# intp_name = r'G:\\DL\\unet-keras\\unet-keras-master\\video_test\\stone_ture.mp4'
# outp_name= r'G:\\DL\\unet-keras\\unet-keras-master\\video_test\\stone_ture15.mp4'
intp_name = 'G:/DL/unet-keras/unet-keras-master//video_test//stone_ture.mp4'
outp_name = 'G:/DL/unet-keras/unet-keras-master//video_test//stone_ture15.mp4'
play_speed = 15.0 #速率
au = VideoFileClip(intp_name)
new_au = au.fl_time(lambda t:  play_speed*t, apply_to=['mask', 'audio'])
new_au = new_au.set_duration(au.duration/play_speed)
new_au.write_videofile(outp_name)

你可能感兴趣的:(Python小记,python,音视频,keras)