电脑里有100多个视频,然后它的开始和结束太长了,于是想把它剪一下。。。
#!/usr/bin/env python # RmvbEditor http://gd.7edown.com:808/green/rmedtgui.rar # MediaInfo CLI x86 http://mediaarea.net/download/binary/mediainfo/0.7.72/MediaInfo_CLI_0.7.72_Windows_i386.zip # MediaInfo CLI X64 http://mediaarea.net/download/binary/mediainfo/0.7.72/MediaInfo_CLI_0.7.72_Windows_x64.zip import subprocess import datetime import os source_dir = ‘D:\English\SaladEN‘ dist_dir = ‘D:\English\SaladENnew‘ os.chdir(‘D:\Soft\Mobile Soft\RMVB Cut‘) for filename in os.listdir(source_dir): total_time = subprocess.Popen("MediaInfo.exe --Output=Video;%%Duration%% %s\%s" % (source_dir,filename), shell=True, stdout=subprocess.PIPE) total_time = total_time.stdout.read().strip() end_time = datetime.datetime.strptime(‘%s:%s‘ % (int(total_time[0:-3])/60, int(total_time[0:-3])%60), "%M:%S") + datetime.timedelta(seconds=-34) end_time = "%s.%s" % (datetime.datetime.strftime(end_time, ‘%M:%S‘), total_time[-4:-1]) subprocess.Popen("rmeditor.exe -i %s\%s -o %s\%s -s 0:30.000 -e %s -q ‘‘" % (source_dir,filename,dist_dir,filename,end_time), shell=True) print "ALL OK"
时间: 2024-10-12 01:02:09