start time of video on Garmin VFAT camera
Nils Kassube
kassube at gmx.net
Wed Jan 20 14:40:29 UTC 2016
Adam Funk wrote:
> I have a Garmin video camera that plays nicely with Ubuntu as a USB
> device with a VFAT filesystem. It records files with sequential
> numbers, e.g.,
>
> VIRB0123.MP4
> VIRB0124.MP4
> VIRB0125.MP4
> What I want to do now is write something in bash or python to copy
> files off the camera but rename the destination file to include the
> start time of the recording. From looking at the `stat` output on the
> files, I get the impression that the "change" timestamp could well be
> when the recording started & the "modify" one could be when it
> finished. Has anyone else corroborated this sort of thing?
This should do the trick:
for f in /input/path/*.MP4;do
n="${f%.MP4}-$(date -d @$(stat -c %X "$f") +%m%d%H%M)"
echo "$f" "/output/path/$n.MP4"
done
Replace the "/input/path/" and "/output/path/" accordingly. This version
only shows the filames - if everything is OK, you can replace the "echo"
with "cp" or "mv". Do you need some explanation how it works?
Nils
More information about the ubuntu-users
mailing list