-
-
Save vs0uz4/2307c05a45d855502391581e331625b8 to your computer and use it in GitHub Desktop.
Convert all videos .ts to .mp4 using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/opt/python/bin/python2.7 | |
# Required ffmpeg | |
import os | |
import sys | |
walk_dir = os.getcwd() | |
count = 0 | |
for root, subdirs, files in os.walk(walk_dir): | |
for file in files: | |
if (file.split(".")[-1].lower() == 'ts'): | |
filePath = os.path.join(root, file) | |
mp4FilePath = os.path.join(root, os.path.splitext(file)[0] + ".mp4") | |
if os.path.isfile(mp4FilePath): | |
continue | |
os.system("ffmpeg -i " + "\"" + filePath + "\"" + " \"" + mp4FilePath + "\"") | |
count = count + 1 | |
print "\"" + filePath + "\"" | |
print "Done the total number of file was be converted: ", count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment