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

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay