Skip to content

Instantly share code, notes, and snippets.

View alexarje's full-sized avatar

Alexander Refsum Jensenius alexarje

View GitHub Profile
@alexarje
alexarje / NIME-proceedings-analysis-script
Created July 2, 2014 08:55
OSX shell script for carrying out a spotlight search on words in all PDFs from the proceedings of the International Conference on New Interfaces for Musical Expression.
#!/bin/sh
clear
echo "Outputting some NIME data"
max=2013
for ((i=2001; i<=$max; ++i )) ;
do
echo "NIME $i"
mdfind -count -onlyin $i music
mdfind -count -onlyin $i gesture
mdfind -count -onlyin $i action
@alexarje
alexarje / QoM-MoCap.m
Created July 5, 2014 16:32
Plot Quantity of Motion (QoM) of all mocap markers using the MoCapToolbox
% Read in C3D file
a=mcread;
% Fill gaps, in case there are holes in trajectories
b=mcfillgaps(a);
% Calculate velocities for all markers
d2v=mctimeder(b);
% Calculate vector length (norm/amplitude) of velocities
@alexarje
alexarje / pdf-split.sh
Last active December 31, 2018 14:58
Small shell script (for Ubuntu) that splits up one multi-page PDF to individual PDF files
#!/bin/sh
cd $NAUTILUS_SCRIPT_CURRENT_URI
pdftk $@ burst output $@-%d.pdf
@alexarje
alexarje / multieps2pdf.sh
Last active March 8, 2018 18:40
Convert multiple EPS files to PDF
find . -name "*.eps" -exec epstopdf {} ";"
@alexarje
alexarje / trimvideofile.sh
Last active December 19, 2019 17:34
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
alexarje / sortimages.sh
Created November 25, 2018 11:37
Sort images based on direction (portrait/landscape)
# Based on: https://unix.stackexchange.com/questions/294341/shell-script-to-separate-and-move-landscape-and-portrait-images
# make directories
mkdir portraits
mkdir landscapes
# Check that all images have correct rotation
jhead -autorot *.jpg
jhead -autorot *.JPG
@alexarje
alexarje / Rotate multiple JPEG files
Created May 19, 2019 16:55
Automagically rotate multiple images based on EXIF descriptors
find . *.jpg -exec jhead -autorot {} \;
@alexarje
alexarje / circle_image.sh
Created September 13, 2019 22:15
Create circular thumbnails in the terminal
#!/bin/bash
for i in *.jpg;
do
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;
done
@alexarje
alexarje / mxf2mp4.sh
Last active February 12, 2024 13:28
Convert MXF files to MP4 using FFmpeg
#!/bin/bash
# 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
alexarje / mxf-folder2mp4.sh
Last active May 3, 2023 15:35
Convert a folder of MXF files to one MP4 file with FFmpeg
#!/bin/bash
# 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