90.15 Video Rename

20230403

Videos in a directory can be renamed using a standard format of choice. We might begin the filename with a four digit year, two digit month, two digit day, an underscore and then hour, minutes and seconds, another underscore, and then either a sequential count starting at 00 or some text describing the contents, similar yo a standard naming for photos in Section 67.6.

YYYYMMDD_HHMMSS_NN.mp4
YYYYMMDD_HHMMSS_TEXT.mp4

An egrep regular expression for this is .*/[0-9]{8}_[0-9]{6}_([0-9]{2}|[a-z][a-z0-9_]*).mp4

A directory of videos that contain meta data can be easily renamed using the exiftool command. Our example here first uses -testname to report on the renaming but will not do it. Once the renaming plan is confirmed, replace -testname with -filename.

exiftool -d %Y%m%d_%H%M%S_%%.2c.%%le "-testname<CreateDate" -ext mp4 *.mp4

If the proposed changes are correct then do the actual renaming by adding a verbose option -v and changing -testname to -filename:

exiftool -v -d %Y%m%d_%H%M%S_%%.2c.%%le "-filename<CreateDate" -ext mp4 *.mp4


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0