DEV Community

epassaro
epassaro

Posted on

Make your videos Twitter (X) compatible

If you are getting stuck at 99% while updating videos to Twitter, try this solution. It just requires having ffmpeg installed on the system and adding this function to your.bashrc:

twitterfix() { ffmpeg -i "$1" -c:v libx264 -crf 20 -preset slow -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2, format=yuv420p" -c:a aac -movflags +faststart out.mp4 }
Enter fullscreen mode Exit fullscreen mode

Usage example:

$ twitterfix my_video.mp4
$ ls
my_video.mp4 out.mp4
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
Sloan, the sloth mascot
Comment deleted