Home / AVCHD date and time filenames

AVCHD date and time filenames

I just bought a new JVC HD camera to finally get rid of the DV tapes (and the time it takes to extract video from tape). The files on the JVC are stored in a AVCHD file structure. This means that the actual files are in:
<SDROOT>PRIVATE/AVCHD/BDMV/STREAM and named 00000.MTS, 00001.MTS, 00002.MTS and so on... Not very useful file names. I like to store my photo and video files with a file name that first shows the date (yyyy-mm-dd) and than the time (hh:mm). This way it is easy to find a movie based on the date and time.

I wrote a little bourne shell script that I can use on my Ubuntu Linux system to copy the .MTS file from the SD card to the computer (NAS storage) and at the same time rename the files. Here it is (if you want to use it, change the location or label of your SD card, and the backup location.
The program uses exiftool to get the date and time from the file. If it is not installed, you can install it with:
sudo apt-get install libimage-exiftool-perl

# name: avchdextrac.sh
# function: copy .MTS files from SD card and rename them to date_time.MTS
# change your SDLABEL (or MTSPATH) and BACKUPLOCATION here
# don't change below (unless you know what you're doing :-)
if [ ! -d  ${MTSPATH} ]
echo "MTS video location does not exists... exiting..."
fi if [ ! -d ${BACKUPLOCATION} ]
echo "Backup location does not exists... exiting..."
fi # test if exiftools is installed
if ! which exiftool > /dev/null; then echo "exiftool not installed"; exit; fi
 for i in ${MTSPATH}/*.MTS 
echo $i
MOVIEDATE=`exiftool $i | grep Original|cut -b35-|tr ' ' '_' | sed 's/+00:00//' `
done echo 'DONE!'

Contact: gacmb5 at gmail.com

     RSS of this page