Exif Data in pictures and videos

Please post your questions about using the web-based Photo, Music, Video Stations here.
Post Reply
iamklaus
New here
Posts: 7
Joined: Fri Jan 13, 2012 9:14 pm

Exif Data in pictures and videos

Post by iamklaus » Mon May 21, 2018 4:35 pm

Hey guys,

I regularly upload pictures from my families smartphone to a common upload folder. Until now the pictures are flat and unsorted within this folder.

Recently I wrote a bash script, which loops through the files, read the creation date from the exif data and moves the file into a folder structure. This word perfectly with images. I use the tool "identify" from imagemagick, which is already installed on the QNAP nas. Now I loog for a similar tool for the (mainly) MP4 files.

Any recommendations?

And for those who are interested in the script, here it is:

Code: Select all

#!/bin/bash
INPUT_DIR="/share/Pictures"
OUTPUT_DIR="/share/Pictures"

shopt -s nullglob

for filename in "$INPUT_DIR/"*.{jpg,jpeg,png,JPG,PNG}; do
        imageDateTaken=$(identify -verbose $filename | grep date:modify | awk '{ print $2 }' | awk '{ print substr ($1,1,7) }')

   if [ ! -d "$OUTPUT_DIR/$imageDateTaken" ]; then
            mkdir $OUTPUT_DIR/$imageDateTaken
   fi

   cp -v $filename $OUTPUT_DIR/$imageDateTaken
   rm -v $filename
done


Regards,
Klaus

User avatar
OneCD
Ask me anything
Posts: 6566
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Exif Data in pictures and videos

Post by OneCD » Mon May 21, 2018 4:46 pm

Nice work! :geek:

Try mediainfo. It's available via the Entware QPKG:

Code: Select all

opkg install mediainfo

ffprobe is another good one:

Code: Select all

opkg install ffprobe

production NAS: TS-569 Pro with Debian 10.2 'Buster' (power on/off times are < 1 minute)
backup NAS: TS-559 Pro+ with QTS 4.2.6 #20191107

one.cd.only@gmail.com

Image Image Image Image

Post Reply

Return to “Photo Station, Music Station, Video Station”