Created
July 28, 2019 09:41
-
-
Save samgooi4189/211a32fa92cff34ffbaba09b8ba67c60 to your computer and use it in GitHub Desktop.
Convert files to mp4 with 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
import glob | |
import re | |
import os | |
EXTENSION = "flv" | |
for filename in glob.iglob("*.%s" % EXTENSION): | |
filename_without_extension = re.search("(.*).%s" % (EXTENSION) , filename).group(1) | |
if filename_without_extension: | |
print(filename_without_extension) | |
os.system("ffmpeg -i '%s' '%s'" % (("%s.%s" % (filename_without_extension, EXTENSION)), (filename_without_extension + ".mp4"))) | |
else: | |
print("%s failed to regex" % filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment