There are more than 100 videos in the computer, and then it starts and ends too long, so I want to cut it ...
#!/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.zipimport subprocessimport datetimeimport ossource_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 (to)Tal_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 "
RMVB Batch Cropping