Converting video to mp4 (H.264) and WEBM with avconv (ffmpeg)

Avconv is a fork of ffmpeg used by debian and ubuntu. For now they use the same commandline syntax. Avconv can convert almost every video format there is. I am using it to convert my video’s to mp4 and webm format. These formats are compatible with most HTML5 browsers. I use the video.js library to select which format to use and to provide a flash fallback (mostly IE).

convertvideo.sh:

name=`basename ${1} .mpg`
avconv -i ${name}.mpg -vcodec libx264 -b:v 600k -maxrate 600k -bufsize 1000k -deinterlace -threads 0 -acodec libvo_aacenc -b:a 96k ${name}.mp4
avconv -i ${name}.mpg -s 4cif -ab 96k -vb 600k -deinterlace -aspect "16:9" ${name}.webm

You can increase the video bit-rate values (600k) to get a better output quality.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *