Skip to content

Instantly share code, notes, and snippets.

@jmhobbs
Created April 24, 2017 18:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmhobbs/b88037dfef48093fd6e8d48d1e744ab8 to your computer and use it in GitHub Desktop.
Save jmhobbs/b88037dfef48093fd6e8d48d1e744ab8 to your computer and use it in GitHub Desktop.
Docker container to stabilize videos. https://hub.docker.com/r/jmhobbs/ffmpeg-video-stabilizer/
FROM ubuntu:xenial
RUN apt-get update && \
apt-get install -yq software-properties-common python-software-properties && \
add-apt-repository ppa:mc3man/ffmpeg-test && \
apt-get update && \
apt-get install -yq ffmpeg-static
ADD stabilize.sh /opt/
CMD ["/bin/bash", "/opt/stabilize.sh"]
#!/bin/bash
mkdir /convert/stable
for f in /convert/*.mp4
do
echo "=====[ $f ]======="
rm -f transform_vectors.trf
echo "-----[ Extract Vectors ]------"
ffmpeg2 -i "$f" -vf vidstabdetect=stepsize=6:shakiness=10:accuracy=15:result=transform_vectors.trf -f null -
echo "-----[ Stabalize ]------"
ffmpeg2 -i "$f" -vf vidstabtransform=input=transform_vectors.trf:zoom=1:smoothing=30,unsharp=5:5:0.8:3:3:0.4 -vcodec libx264 -preset slow -tune film -crf 18 -acodec copy "/convert/stable/$(basename "$f")"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment