Skip to content

Instantly share code, notes, and snippets.

@samuelcolvin
Last active January 16, 2019 17:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save samuelcolvin/c52ca48d790d923f6665 to your computer and use it in GitHub Desktop.
Save samuelcolvin/c52ca48d790d923f6665 to your computer and use it in GitHub Desktop.
video.js ffmpeg encoding
# example video encoding for vidoe.js
# for the mp4 video you need aac installed, on Ubuntu:
sudo apt-get install libfaac0
# you seem to need two files for video js, a webm file and an mp4 file
# using ffmpeg these can be generated hence, assuming you start from a .mov file.
ffmpeg -i video.mov -codec:a aac -strict -2 -codec:v h264 -b:a 128k -b:v 1200k -flags +aic+mv4 video.mp4
ffmpeg -i video.mov -codec:a libvorbis -codec:v libvpx -b:a 128k -b:v 1200k video.webm
<video id="into-video" class="video-js vjs-default-skin" autoplay controls preload="auto" width="640"
poster="https://mycdn.cloudfront.net/myposter.png">
<source src="https://mycdn.cloudfront.net/video.webm" type='video/webm' />
<source src="https://mycdn.cloudfront.net/video.mp4" type='video/mp4' />
<p class="vjs-no-js">To view this video please enable JavaScript, or consider upgrading your browser.</p>
</video>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment