It compresses a single master video file in different sizes and bitrates for web using FFMPEG. It works in Linux an Mac, not shure about Windows (If it doesn't work in windows, you just need to adjust the arrays).
After fighting a long time with video compression for websites I think this is the best approach. The codecs you need, the sizes and bitrates you need, correct MOOV atom position, reliable and adjustable, light videos but almost lossless in terms of human perception...
- Download and install FFMPEG
- Downlad the script
video4web.sh
from this repo. - Drop into a folder the script
video4web.sh
and your master video file (let's call itmaster.mp4
from now on) - Edit
video4web.sh
and set the sizes, bitrates and codecs you want to export your video to:
#codecs
h264_codec=true
vp9_codec=true
vp8_codec=false
#bit rates
q[0]=1
q[1]=2
q[2]=3
q[3]=5
q[4]=8
q[5]=10
q[6]=20
q[7]=30
#resolutions
r[0]=640
r[1]=1280
r[2]=1920
r[3]=3840
- Set permisions: from your terminal run
chmod +x video4web.sh
in the folder where you put the script and the video. - Run the script: from your terminal run
./video4web.sh master.mp4 filename
in the folder where you put the script and the video.filename
is the filename you want to give to the output files (it'll be something likefilename_1280_8MB.mp4
)
Depending on your output settings and your original video, it can take a fair amount of time