Riaan's SysAdmin Blog

My tips, howtos, gotchas, snippets and stuff. Use at your own risk!

Video Encoding

Webm Video Clips

Now and then I create a short clip from a video. Mostly mp4 video. I use ffmpeg and cut out the clip based on start and end time. Linux mostly does not play mp4 out of the box and need a few packages. I started using webm which so far have better compatibility playing with Gnome standard video player, VLC (whihc always plays everything anyhow), mobile phone messaging apps etc.. For my convenience here is the detail from a script I use.

➜  scripts cat video_to_webm.sh 
#!/bin/bash
VIDEOS=~/Downloads/video-to-webm/
find "$VIDEOS" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "${0%%.mp4}.webm"' {} \;
exit;

Example of a creating a clip.

$ ffmpeg -ss 1:04:42 -to 1:07:38 -i The\ Podcast\ of\ the\ Lotus\ Eaters\ \#120.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis The_Podcast_of_the_Lotus_Eaters_120-keto_fascism.webm

admin

Bio Info for Riaan