代码中的文件名除了以h_开头的文件以h_00 h_100 h_200 h_400 h_900开头的文件名都从第二个英文开始截取import osimport globfrom natsort import natsorteddir_path = rEhomeupoutput_dir = rEhomeup1# 当前文件夹下的所有mp4路径L = for root dirs files in oswa
The code reads all mp4 files in a given directory, converts them to .ts format using ffmpeg, concatenates the .ts files, and then renames the output file to a new name.
The new file name is generated by removing the first character of the original file name (which is assumed to be 'h_' in the code), and then replacing the first occurrence of '00' with a hyphen. For file names that do not start with 'h_', the code simply replaces the first occurrence of '00' with a hyphen.
The code then strips any digits, periods, underscores, or hyphens from the end of the file name, and finally truncates the file name to the last English letter before any non-English characters.
The resulting file names may not be unique and could potentially overwrite existing files. Additionally, the code assumes that all input files are valid mp4 files and that the ffmpeg commands will execute successfully
原文地址: https://www.cveoy.top/t/topic/ddzZ 著作权归作者所有。请勿转载和采集!