Last active
November 24, 2015 12:58
-
-
Save draganmarjanovic/62f41a2a592d784554af to your computer and use it in GitHub Desktop.
Convert any supported video file type to MP4.
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/bin/python | |
import os | |
from os import listdir | |
from os.path import isfile, join | |
# Preferences | |
supported_formats = ["mkv", "mp4", "wmv", "flv", "m4v"] | |
output_format = "mp4" | |
file_path = os.getcwd() | |
conversion_list = [] | |
# File Processing and Preparation | |
directory_files = [f for f in listdir(file_path) if isfile(join(file_path, f))] | |
for x in directory_files: | |
if (x[-3:] in supported_formats) and (x[-3:] != output_format): | |
x_safe = x.replace(" ", "\ ") | |
conversion_list.append(x_safe) | |
else: | |
pass | |
# Output | |
for video in conversion_list: | |
print ("Converting: " + video[0:-4]) | |
# os.system("touch " + video[0:-4] + ".txt") | |
os.system("FFmpeg -i " + video + " -vcodec copy -acodec copy " + video[0:-4] + "." + output_format) | |
print ("Conversion Completed") | |
print ("########## All Conversion Completed ##########") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment