GOPRO的命名规则及改名脚本
gopro吧
全部回复
仅看楼主
level 5
瞌睡虫甲 楼主
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/
2020年11月14日 23点11分 1
level 1
\看到您写了gopro文件重命名的python脚本 十分感兴趣 十分需要! 是否方便发我源文件 我试了调试程序 没有搞明白缩进关系 编译不通过 多谢了!
2020年11月18日 10点11分 2
缩进可以参考下一楼。(无关的行已经被我删了。)
2020年11月19日 15点11分
@瞌睡虫甲 链接:[url]https://pan.baidu.com/s/1Wo9Y3e7L7ltI-egs4wBT8g [/url]提取码:aenc
2020年11月22日 15点11分
@瞌睡虫甲 给力给力 可以安心整理素材了! 太感谢了
2020年11月25日 06点11分
level 5
瞌睡虫甲 楼主
2020年11月19日 15点11分 3
[无效] 谢谢很好用[太开心][太开心]
2024年02月19日 09点02分
2022年01月29日 06点01分
@瞌睡虫甲 感谢分享
2022年11月07日 13点11分
level 1
PYTHON不会不懂,怎么办? 我是GO9,从4开始就烦死了它这种命名方式
2020年11月21日 08点11分 5
给我你的邮箱,我可以把打包了python的可执行文件发给你。 直接放到目录下双击就可以了。
2020年11月22日 15点11分
链接:[url]https://pan.baidu.com/s/1Wo9Y3e7L7ltI-egs4wBT8g [/url] 提取码:aenc
2020年11月22日 15点11分
@瞌睡虫甲 好的,我才看到,非常感谢
2020年11月24日 16点11分
@349079584 不客气。如果有用的话,告诉我,不行也说一下,我看看如何改进。
2020年11月24日 20点11分
level 1
特来感谢,非常好用,大佬牛逼
2021年06月29日 14点06分 6
level 1
****,大佬大佬。帮大忙了,感谢
2021年06月30日 10点06分 7
level 1
谢谢大佬的代码
我把截图中的代码,稍微改动了一下,贴上来方便大家
# 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:
if 'GH' in file:
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()
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:]
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 ()
2021年09月20日 09点09分 8
你这个改动有什么变化啊,能不能简单介绍一下?
2022年10月01日 15点10分
level 1
大佬666
2021年10月30日 15点10分 10
level 1
已试用,效果极佳,哇,这也太牛逼了吧
2021年12月13日 01点12分 11
level 1
大佬,请问能帮忙打包成mac电脑上可运行的格式吗?我自己下载了pycharm打包后放在gopro视频目录里执行了没反应……非常感谢
2021年12月24日 05点12分 12
没有用过MAC电脑。
2022年01月29日 06点01分
level 5
瞌睡虫甲 楼主
源代码存放位置:
[无效] https://pan.baidu.com/s/1Wo9Y3e7L7ltI-egs4wBT8g
提取码:aenc
2022年01月29日 06点01分 13
level 1
非常好用,感谢大佬[真棒]
2022年03月29日 14点03分 14
level 1
老师,文件命名能否使用相机系统的时间为文件名?而不是相机自行编号。就向普通相机或行车记录仪一样。
2022年05月07日 22点05分 16
没有相关设置。
2022年05月19日 05点05分
level 4
楼主,你好,这个怎么用呀,我的机子是gopro10,拍成的视频保存老是乱序,很头疼,这个是不是解决这个的问题呀,小白,麻烦指导一下,谢谢
2022年05月21日 02点05分 18
可以解决这个问题。可以用SD卡读卡器在电脑上打开SD卡,把这个文件拷贝到SD卡上视频所在文件夹,在电脑上装上PYTHON软件,双击这个文件,就完事了。
2022年08月29日 17点08分
level 1
画质垃圾的要死啊,我艹,买了想死
2022年05月27日 06点05分 19
1 2 尾页