tvaLib
preprocessmpeg.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # tvaLib Copyright (c) 2012-2016 Paul G. St-Aubin
3 # Ecole Polytechnique de Montreal, McGill University
4 # Python 2.7; (dt) Spyder Windows 10 64-bit; ipython Ubuntu 15.04 64-bit
5 version = 'R2.3.0 u. 2017-03-22'
6 
7 
8 import glob, os, subprocess, platform
9 
10 if(platform.system() == 'Windows'): path_to_mencoder = r'C:\User\Portable Apps (Windows)\mplayer'
11 else: path_to_mencoder = ''
12 path = '*.mpg'
13 force_fourcc = 'MP4V'
14 
15 if(force_fourcc): fourcc_cmd = ' -ffourcc '+force_fourcc
16 else: fourcc_cmd = ''
17 
18 framrate = '11097/500'
19 
20 for filename in glob.glob(path):
21  subprocess.call('"'+os.path.join(path_to_mencoder,'mencoder')+'" '+filename+' -ovc copy -nosound'+fourcc_cmd+' -o '+os.path.splitext(filename)[0]+'.avi -fps '+framrate+' -ofps '+framrate, shell=True)
22