Created
April 17, 2015 12:52
-
-
Save djds23/84750c10da2fb9fddf98 to your computer and use it in GitHub Desktop.
concat all videos in a directory alphabetically
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 os | |
import subprocess | |
FILES = os.listdir('.') # ~/path/to/vids | |
TEMPLATE_PREFIX = 'file ' | |
OUTPUT_LIST = [] | |
for file_name in sorted(FILES): | |
full_file_path = os.path.abspath(file_name) | |
OUTPUT_LIST.append(TEMPLATE_PREFIX + full_file_path) | |
with open('list.txt', 'rb') as f: | |
for line in OUTPUT_LIST: | |
f.write(line+'\n') | |
command = 'ffmpeg -f concat -i list.txt -c copy output'.split() | |
subprocess.call(command) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment