Should Discourse convert GIFs to mp4 video files?

Then put the following notice under each one

:mega: to make this full size, right click (or tap and hold) and open in a new tab.

Hmmm I’d submit something more official if I knew ruby, but sadly Python and C are my main languages.

I’ll probably write a python script that runs periodically, identifies new posts, identifies gifs in new posts, put them in a conversions folder, and then update the post with the path to the new webm file.

I found the configuration below to work well for the conversion. This script will convert every gif file in the ConvertToWebm folder into a webm, whilst retaining the original gif. For our use-case the loss is acceptable(small text still readable), and file size reduces by even 20x in some cases

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)
2 Likes