Skip to content

Instantly share code, notes, and snippets.


Alexander Refsum Jensenius alexarje

View GitHub Profile
ffmpeg \
-i dance_addition.mp4 \
-i dance_and.mp4 \
-i dance_average.mp4 \
-i dance_blend.mp4 \
-i dance_burn.mp4 \
-i dance_darken.mp4 \
-i dance_difference.mp4 \
-i dance_divide.mp4 \
-i dance_dodge.mp4 \
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=addition" dance_addition.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=grainmerge" dance_grainmerge.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=and" dance_and.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=average" dance_average.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=burn" dance_burn.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=darken" dance_darken.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=difference" dance_difference.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=grainextract" dance_grainextract.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=divide" dance_divide.mp4
ffmpeg -i dance.avi -filter_complex "tblend=all_mode=dodge" dance_dodge.mp4
alexarje /
Created Nov 3, 2019
Convert a folder of MXF files to one MP4 file with FFmpeg
# Script for converting a folder of MXF video files to different to a single MP4 file.
# Alexander Refsum Jensenius, RITMO, University of Oslo
# v0.1 2019-11-03
# Find and move all MXF files to the "root" (where the script is run from)
find . -name "*.MXF" -exec mv {} . ";"
# Create list of files to be used for concatenation
alexarje /
Last active Jun 1, 2021
Convert MXF files to MP4 using FFmpeg
# Script for converting MXF video files to different to other file formats.
for i in *.MXF; do
if [ -e "$i" ]; then
file=`basename "$i" .MXF`
# MP4 file with default settings + deinterlacing
ffmpeg -i "$i" -c:v libx264 -vf yadif "$file.mp4"
alexarje /
Created Sep 13, 2019
Create circular thumbnails in the terminal
for i in *.jpg;
name=`echo $i | cut -d'.' -f1`;
convert "$i" \
\( +clone -threshold -1 -negate -fill white -draw "circle 100,100 100,0" \) \
-alpha off -compose copy_opacity -composite $name.png;
alexarje / Rotate multiple JPEG files
Created May 19, 2019
Automagically rotate multiple images based on EXIF descriptors
View Rotate multiple JPEG files
find . *.jpg -exec jhead -autorot {} \;
alexarje /
Created Nov 25, 2018
Sort images based on direction (portrait/landscape)
# Based on:
# make directories
mkdir portraits
mkdir landscapes
# Check that all images have correct rotation
jhead -autorot *.jpg
jhead -autorot *.JPG
alexarje /
Last active Dec 19, 2019
Trim video using ffmpeg
ffmpeg -i input.mp4 -ss 01:10:27 -to 02:18:51 -c:v copy -c:a copy output.mp4
alexarje /
Last active Mar 8, 2018
Convert multiple EPS files to PDF
find . -name "*.eps" -exec epstopdf {} ";"
alexarje /
Last active Dec 31, 2018
Small shell script (for Ubuntu) that splits up one multi-page PDF to individual PDF files
pdftk $@ burst output $@-%d.pdf