Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import subprocess
- from tqdm import tqdm_notebook as tqdm
- ## Run the code in the Videos folder. The script looks for videos in subdirectories of current folder.
- d = '.'
- video_dirs = [o for o in os.listdir(d) if os.path.isdir(os.path.join(d,o)) and o[0] != '.']
- video_dirs
- for video_dir in tqdm(video_dirs, desc='Directories', position=0):
- output_dir = 'Encoded ' + video_dir
- os.mkdir(output_dir)
- for video in tqdm(os.listdir(video_dir), desc=f'{video_dir} progress', position=1):
- proc = subprocess.run(["ffmpeg", "-i", video_dir + '/' + video, '-c:v', 'h264_nvenc', '-b:v', '2M', '-bufsize', '2M',
- output_dir + '/' + video])
- proc.check_returncode()
Add Comment
Please, Sign In to add comment