Jump to: navigation, search

Preparing videos for blog posts

442 bytes added, 11:09, 16 June 2019
add bottom text script
Here's a short cheat sheet of how to get videos ready for blog posts. We convert them to the widely supported {{wikipedia|webm}} ({{wikipedia|mp4}} will for example not work on Fedora out of the box), and create short and smaller video thumbnails. These thumbnails will be embedded into the blog post directly as little animated pictures, just like gifs, but much more size efficient.
==== Converting Convert to webm ====
<syntaxhighlight lang="shell-session">
$ ffmpeg -i video.mp4 video.webm
==== Shortening Shorten ====
Start at 10 seconds and cut after the next 5 seconds:
==== Scaling Scale down ====
Resize to 300x533 px:
<syntaxhighlight lang="shell-session">
$ ffmpeg -y -i video-short.webm -vf scale=300:533 video-thumb.webm
==== Add bottom text ====
<syntaxhighlight lang="shell">
#!/bin/sh -e
if [ "$#" -ne 3 ]; then
echo "usage: $(basename $0) input output text"
exit 1
set -x
ffmpeg -i "$1" -vf drawtext="fontfile=$font: \
text=\'$3\': fontcolor=white: fontsize=24: box=1: boxcolor=black@0.5: \
boxborderw=5: x=(w-text_w)/2: y=h-text_h-15" -codec:a copy "$2"

Navigation menu