Skip to content

Instantly share code, notes, and snippets.

@cbrocas
Last active January 22, 2024 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbrocas/8cce37602be2c738e517 to your computer and use it in GitHub Desktop.
Save cbrocas/8cce37602be2c738e517 to your computer and use it in GitHub Desktop.
Renaming pictures according EXIF data + rotating pictures
- Renaming all *.JPG files according the EXIF date taken of the picture (it gives : 2014-11-24_13-13-42.jpg) :
#jhead -n%Y-%m-%d_%H-%M-%S *.JPG
- Rotate all jpeg pictures of a directory :
#jhead -autorot *.jpg
- Rename & rotate recursively *.JPG files (and here, *.jpg also due to non sensitive search with the -iname option) starting from local directory :
#find . -iname "*.JPG" -exec jhead -n%Y-%m-%d_%H-%M-%S -autorot {} \;
- Par exemple, pour enlever 1h15 à toutes les photos
#jhead -ta-1:15 *.jpeg
@doegox
Copy link

doegox commented Nov 9, 2014

Same for video:

for m in MVI*.[mM][oO][vV] VID*.3[gG][pP] VID*.[mM][pP]4; do
    [[ "$i" =~ '*' ]] && continue
    t=$(mplayer -vo null -ao null -frames 0 -identify $m 2>/dev/null|grep creation_time:|sed 's/.*creation_time: *//;s/[-:]//g;s/ /-/')
    if [[ ${t} == 19* ]]; then
        t=$((${t:0:4} + 66))${t:4}
    fi
    mv ${m} ${t}_${m}
done

@cbrocas
Copy link
Author

cbrocas commented Aug 5, 2017

To retire 1h15 to the EXIF shot date/time of all .jpeg photos :
jhead -ta-1:15:00 *.jpeg

To add 1h15 to the EXIF shot date/time of all .jpeg photos :
jhead -ta+1:15:00 *.jpeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment