GOPRO的文件命名规则比较反人类,自己研究了一下,规律如下:
以GH010057.MP4为例,按顺序:
2个字母:GH,GX,这些是固定的,
2个数字:01是分割号,每次录到4G分割,序列号就加1,0057是序列号
4个数字:0057是序列号,每次按下录像照相键,即加1
.MP4是扩展名。
大家在导出后,可以将文件名的字符顺序改一下。如改成GH0057_01.MP4
因为比较规律,我自己做了个python脚本,可以自动把文件夹下的文件都改掉。(我直接拷在了SD卡上,直接双击就能运行,且不会重复执行),有兴趣的同学可以看一下。(前提是你已经装了PYTHON)
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import os
def rename_gopro_all():
# Use a breakpoint in the code line below to debug your script.
path = "./"
count = 0
file_list = os.listdir(path)
print (file_list)
for file in file_list:
olddir = os.path.join(path,file)
if os.path.isdir(olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1].upper()
print ("Filename =", filename)
print ("FileTYpe =", filetype)
if filetype in [".MP4",".JPG",".LRV",".THM"] and filename[0]=="G" and "_" not in filename:
NAME_PREFIX = filename[:2]
NAME_INDEX = filename[2:4]
NAME_SEQ = filename[4:]
print ("Name_Prefix=", NAME_PREFIX)
print ("Name Index =", NAME_INDEX)
print ("Name Seq =", NAME_SEQ)
newdir = os.path.join(path, NAME_PREFIX + NAME_SEQ + "_" + NAME_INDEX + filetype.lower())
print (newdir)
os.rename(olddir,newdir)
count +=1
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
rename_gopro_all ()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
以GH010057.MP4为例,按顺序:
2个字母:GH,GX,这些是固定的,
2个数字:01是分割号,每次录到4G分割,序列号就加1,0057是序列号
4个数字:0057是序列号,每次按下录像照相键,即加1
.MP4是扩展名。
大家在导出后,可以将文件名的字符顺序改一下。如改成GH0057_01.MP4
因为比较规律,我自己做了个python脚本,可以自动把文件夹下的文件都改掉。(我直接拷在了SD卡上,直接双击就能运行,且不会重复执行),有兴趣的同学可以看一下。(前提是你已经装了PYTHON)
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import os
def rename_gopro_all():
# Use a breakpoint in the code line below to debug your script.
path = "./"
count = 0
file_list = os.listdir(path)
print (file_list)
for file in file_list:
olddir = os.path.join(path,file)
if os.path.isdir(olddir):
continue
filename = os.path.splitext(file)[0]
filetype = os.path.splitext(file)[1].upper()
print ("Filename =", filename)
print ("FileTYpe =", filetype)
if filetype in [".MP4",".JPG",".LRV",".THM"] and filename[0]=="G" and "_" not in filename:
NAME_PREFIX = filename[:2]
NAME_INDEX = filename[2:4]
NAME_SEQ = filename[4:]
print ("Name_Prefix=", NAME_PREFIX)
print ("Name Index =", NAME_INDEX)
print ("Name Seq =", NAME_SEQ)
newdir = os.path.join(path, NAME_PREFIX + NAME_SEQ + "_" + NAME_INDEX + filetype.lower())
print (newdir)
os.rename(olddir,newdir)
count +=1
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
rename_gopro_all ()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/