Skip to content

Instantly share code, notes, and snippets.

@AnoRebel
Forked from jdye64/gist:ca07e01ff3d8e93210c3
Last active August 22, 2024 12:49
Show Gist options
  • Save AnoRebel/a6e4dc2ef4080bfa21ad225fe30b14e0 to your computer and use it in GitHub Desktop.
Save AnoRebel/a6e4dc2ef4080bfa21ad225fe30b14e0 to your computer and use it in GitHub Desktop.
Convert .dav files in current directory to .mp4
#!/usr/bin/python
print("Converting all of the .dav files in this current directory into .mp4 files using ffmpeg")
import os
from subprocess import call
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
ext = f.split(".")[-1]
if ext == "dav" or ext == "DAV":
mp4Name = f.replace("dav", "mp4")
print("Converting: " + f)
# ffmpeg -y -i file.dav -vcodec libx264 -crf 24 file.mp4
call(['ffmpeg', '-y', '-i', f, "-vcodec", "libx264", "-crf", "24", mp4Name])
print("Converted: " + f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment