Skip to content

Instantly share code, notes, and snippets.

@castrors
Last active August 25, 2018 17:03
Show Gist options
  • Save castrors/855d8dc94c8f9b7dd5a77f0d7c26e782 to your computer and use it in GitHub Desktop.
Save castrors/855d8dc94c8f9b7dd5a77f0d7c26e782 to your computer and use it in GitHub Desktop.
Converter todos os arquivos de uma pasta para gif. Pre requisito: instalar ffmpeg. Pra linux e mac é só colocar esse arquivo em uma pasta que voce tem os vídeos e rodar por commandline. Qualquer dúvida pode me chamar que eu ajudo a usar.
#!/usr/bin/env python
import os
for filename in os.listdir('.'):
if filename.endswith(".webm") or filename.endswith(".mp4"):
os.system('ffmpeg -i %s -r 10 -vf scale=480:-1 %s.gif' % (filename, filename))
continue
else:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment