My new dashcam on my bike creates a heap of 5-minute video files as it records. Depending on whether or not I have hit the ‘Save’ button on the handlebars, the filename will start with a different pre-fix.

Embedded within the middle of the filename is the date-time stamp of the clip. After that, there is a F or R to indicate whether it’s from the Front or Rear camera.

None of this is useful for sorting the file clips into a proper order given that the prefixes get in the way of the date-time portion being the most significant section of the filename.

The format is:


To make matters worse, my Adobe Premier is failing to handle the MOV (MPEG encoded files) nicely. So I’ve had to bulk re-encode them into MP4 format before it will handle them properly, as such the ‘created date’ is no longer valid, since it’s a newly made local file.

Bulk re-encoding:

for i in *.MOV; do ffmpeg -i "$i" "${i%.*}.mp4"; done

I needed to shift the PRE_ to the end of the file: PRE_yyddmm_HHmmssX.mp4 -> yyddmm_HHmmssX_PRE.mp4

So, enter in ubuntu and useful shell commands: — This will list all of the changes which can be applied if you remove the -n, it will action it.

rename -n 's/^(...)\_(.*)\.mp4/$2_$1.mp4/' *.mp4

Adobe Premiere doesn’t like _ in filename strings – the filters don’t work nicely for them.

rename -n 's/\_/-/g' ./*.mp4

It will help for me to have the Front or Rear indicator as it’s own separate data element in the filename, so add in another – before it…

rename -n 's/R-/-REAR-/g' ./*.mp4
rename -n 's/F-/-FRONT-/g' ./*.mp4

Boom, all done. I can filter the files Front / Rear, by name based filtering of ‘REAR’ or ‘FRONT’

Sample filename format is now: 190725-172354-R-REC.mp4

%d bloggers like this: