An FFmpeg
wrapper for creating HTML5 snippets of videos.
htmlvid
is a command line tool that lets you easily extract parts of videos so that you can share them online. It lets you choose between the WebM and MP4 formats, which are becoming increasingly dominant on the web as HTML5 video formats. (Even Twitter and Imgur use them for GIFs) These provide numerous advantages over the outdated GIF format including more colors, immensely smaller filesizes, and smoother playback.
htmlvid
is written in Python. It uses FFmpeg
to encode videos. It's only dependency is configargparse
. (For config file support)
You just need to set the start time and duration and you're good to go. No need to write a complicated FFmpeg
command.
If you were to just use FFmpeg
without specifying options like -b:v
and -crf
, the default quality would be abysmal. htmlvid
chooses recommended defaults that give you a good output quality.
It's very easy to tweak the quality and bitrate to your liking. Fast action scenes looking blurry? Just add more bitrate. Have a huge 1920p video? Just set the output width and you'll get a file that is easier to share. You can even set a size limit on the output file.
You can set every option that you can specify on the command line in a config file. You can even use presets by choosing custom config files.
FFmpeg
has a large amount of filters. The most useful ones are integrated directly into htmlvid
for doing things like scaling the video and embedding subtitles. If you find you need to use more filters, just give them to htmlvid
(-F
) and it'll pass them along.
Here's a simple command to create a 5-second WebM from 5 minutes and 10 seconds into a video:
htmlvid -s 5:10 -t 5 -o snippet.webm video.mkv
Here's a slightly more advanced command for creating a MP4 of a movie from the specified time ranges, limiting the size to 2 Megabytes, with a width of 400 pixels.
htmlvid -f mp4 -s 40:26.324 -t 40:38 -l 2M -w 400 movie.mkv
Please see installing.md
For help using htmlvid
, run it with the -h
option to see a nice help message detailing each option. Technically, the only required option is the path to the video, but you'll most likely want to set the start time and video duration each time also. You can also tweak the default quality and bitrate.
The default config file is located at ~/.htmlvid
. Instructions for the config file and possible values for each option are documented inside the config file.
For more help see faq.md.
htmlvid
is licensed under the MIT license.