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: 8
Joined: Fri Jan 13, 2012 9:14 pm

Exif Data in pictures and videos

Post by iamklaus »

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
Guru
Posts: 12147
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: Exif Data in pictures and videos

Post by OneCD »

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

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
Post Reply

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