I’ll confess; I’ve never figured out how to make animated gifs work well. They always wind up tiny, grainy, low-frame-rate, and huge to download. So it’s great that one can upload videos to Twitter directly, instead of having to convert them into those terrible animated gifs. But Twitter is very, very fussy about what formats it will accept, and every time I need to do this, I lose half a day trying to remember the procedure for making Twitter accept my video files.
I don’t know why it never occurred to me to do this before, but now that I’ve figured it out (again), I’m just going to post the answer here as a blog post, so that I can find it again the next time I want to tweet a video. And maybe it’ll help somebody else, too.
I’ve been hopeless at getting my video editor to spit out video in a format which Twitter will accept, so (as is so often the case), a command-line tool has come to my rescue. I use ffmpeg to handle the conversion from whatever format my video editor wants to use, into the very specific format that Twitter wants me to have used.
Here’s the command that does the magic:
ffmpeg -i INPUT_FILENAME -c:v libx264 -strict -2 OUTPUT_FILENAME.mp4
That’s it! If you want, you can be fancy and specify image filters and other adjustments during the conversion. But if your video is already edited and scaled like you want it, and if all you need to do is to just make Twitter stop complaining that “one selected file is not an image”, then the above seems to reliably do that!