Skip to content

Instantly share code, notes, and snippets.

@motu81
Last active July 7, 2017 20:51
Show Gist options
  • Save motu81/570fe3848aecf2e0b16ac04eb886f0c0 to your computer and use it in GitHub Desktop.
Save motu81/570fe3848aecf2e0b16ac04eb886f0c0 to your computer and use it in GitHub Desktop.
resizing mp4 videos and generate poster .jpg with ffmpg
## rezize videos (change resolution here 854x480)
for i in $(ls p*); do ffmpeg -i $i -vf scale=854:480 $(echo $i | cut -d. -f1)_480p.mp4; done
## generate posters (only from resized files)
for i in $(ls *_480*); do echo ffmpeg -i $i -ss 00:00:14.435 -vframes 1 $(echo $i | cut -d. -f1).jpg; done
### ffmpeg timelapse script
#!/bin/bash
set -x
if [ $# -ne 3 ]; then
echo "Usage:"
echo -e "\t${0} <pics> <audio> <out>"
echo
echo "Example:"
echo -e "\t${0} DSC_%d.jpg track.flac timelapse.mp4"
echo -e "%d must start with 1 (DSC_0001.jpg)"
exit 0
fi
#START=$1
PICS=$1
AUDIO=$2
OUT=$3
ffmpeg -i "$PICS" -i "$AUDIO" -map 0:0 -map 1:0 -r 30 -s hd1080 -vcodec libx264 -shortest "$OUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment