#!/usr/bin/env python # coding=utf-8 import os import sys def getLength(input_video): cmd = 'ffprobe -i %s -show_entries format=duration -v quiet -of csv="p=0"' % input_video output =os.popen(cmd,'r') output = output.read() output = float(output)/60 return output print getLength(sys.argv[1])
|