Skip to content

Instantly share code, notes, and snippets.

@sawaYch
Last active December 28, 2019 14:28
Show Gist options
  • Select an option

  • Save sawaYch/7a8895f084901669e53af603874c7106 to your computer and use it in GitHub Desktop.

Select an option

Save sawaYch/7a8895f084901669e53af603874c7106 to your computer and use it in GitHub Desktop.
Convert *.mp4 to twitter supported video format.
# Thnak you @nik hanselmann
# When you use facebook video downloader like https://www.getfvid.com/,
# You may get a mp4 video that can;t uploaded to twitter (Perhaps codec problems?)
# Or others online converter will give you a video with broken sound channel (audio turns into noises)
# So, what we can do is convert the video source again ot correct format/ codec (libx264).
# You can use the command below:
ffmpeg -i test.mov -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 out.mp4
#!/bin/bash
for i in *.mp4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 "$name"-output.mp4
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment