Skip to content

Instantly share code, notes, and snippets.

@maxsvetlik
Created December 13, 2017 16:51
Show Gist options
  • Save maxsvetlik/4aa337e76ec4ec4c17bc6c70fbc72c9a to your computer and use it in GitHub Desktop.
Save maxsvetlik/4aa337e76ec4ec4c17bc6c70fbc72c9a to your computer and use it in GitHub Desktop.
This script renames sequential time (epoch time) timestamped images to a format that avconv can read and use to create a video file.
#!/bin/bash
#This script renames images named as a sequential timestamp to a standardized format used for avconv
a=0
ls vision_data/*.jpg | sed 's/^\([^0-9]*\)\([0-9]*\)/\1 \2/' | sort -k2,2n | tr -d ' ' |
while read filename; do
echo $filename
new=$(printf "%04d.JPG" ${a}) #04 pad to length of 4
ln ${filename} ${new}
echo ${i}
let a=a+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment