# Should Discourse convert GIFs to mp4 video files?

**URL:** <https://meta.discourse.org/t/should-discourse-convert-gifs-to-mp4-video-files/16739>\
**Category:** Feature\
**Created:** [21 Junho , 2014 08:24 UTC](https://meta.discourse.org/t/should-discourse-convert-gifs-to-mp4-video-files/16739 "2014-06-21T08:24:22Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![Tris20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tris20/32/264639_2.png) [@Tris20](https://meta.discourse.org/u/Tris20)\
**Post date:** [14 Janeiro , 2022 09:33 UTC](https://meta.discourse.org/t/should-discourse-convert-gifs-to-mp4-video-files/16739/26 "2022-01-14T09:33:13Z")

</div>

Hmmm, eu enviaria algo mais oficial se soubesse Ruby, mas infelizmente Python e C são minhas principais linguagens.

Provavelmente escreverei um script Python que roda periodicamente, identifica novas postagens, identifica GIFs em novas postagens, os coloca em uma pasta de conversões e, em seguida, atualiza a postagem com o caminho para o novo arquivo webm.

Achei a configuração abaixo que funciona bem para a conversão. Este script converterá todos os arquivos GIF na pasta ConvertToWebm em um webm, mantendo o GIF original. Para o nosso caso de uso, a perda é aceitável (texto pequeno ainda legível) e o tamanho do arquivo é reduzido em até 20x em alguns casos.

```python
import glob, os
os.chdir("C:/Users/username/Videos/ConvertToWebm")
for file in glob.glob("*.gif"):
    print(file)
    filename = str(file[:-4])
    command = 'ffmpeg -i "'+ str(file) + '" -c vp9 -b:v 0 -crf 41 -strict experimental "' + filename + '.webm"'
    print(command)
    os.system(command)

```

---

_[View the full topic](https://meta.discourse.org/t/should-discourse-convert-gifs-to-mp4-video-files/16739)._
