-
-
Save sxlderek/b6269257c4fdeea5d42ebae587544845 to your computer and use it in GitHub Desktop.
Convert all videos .ts to .mp4 using ffmpeg
This file contains hidden or 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/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