Skip to content

Instantly share code, notes, and snippets.

@tingplenting
Created September 18, 2018 07:28
Show Gist options
  • Save tingplenting/63f9b5b654c3871293e654cd9d1a7973 to your computer and use it in GitHub Desktop.
Save tingplenting/63f9b5b654c3871293e654cd9d1a7973 to your computer and use it in GitHub Desktop.
bulk convert with ffmpeg and python
import os
DIRECTORY = "videos2"
for f in os.listdir(DIRECTORY):
if f.endswith(".mp4"):
in_file = DIRECTORY + '/' + f
out_file = DIRECTORY + '/ytout-- ' + f
ex = 'ffmpeg -i "{in_file}" -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low "{out_file}"'.format(in_file=in_file, out_file=out_file)
os.system(ex)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment