|
@@ -166,14 +166,14 @@ class AgcVidoe():
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
- # 获取视频文件的时长(秒)
|
|
|
|
- @classmethod
|
|
|
|
- def get_video_duration(cls, video_file):
|
|
|
|
- result = subprocess.run(
|
|
|
|
- ["ffprobe", "-v", "error", "-show_entries", "format=duration",
|
|
|
|
- "-of", "default=noprint_wrappers=1:nokey=1", video_file],
|
|
|
|
- capture_output=True, text=True)
|
|
|
|
- return float(result.stdout)
|
|
|
|
|
|
+ # # 获取视频文件的时长(秒)
|
|
|
|
+ # @classmethod
|
|
|
|
+ # def get_video_duration(cls, video_file):
|
|
|
|
+ # result = subprocess.run(
|
|
|
|
+ # ["ffprobe", "-v", "error", "-show_entries", "format=duration",
|
|
|
|
+ # "-of", "default=noprint_wrappers=1:nokey=1", video_file],
|
|
|
|
+ # capture_output=True, text=True)
|
|
|
|
+ # return float(result.stdout)
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def clear_mp4_files(cls, folder_path):
|
|
def clear_mp4_files(cls, folder_path):
|
|
@@ -192,7 +192,7 @@ class AgcVidoe():
|
|
@classmethod
|
|
@classmethod
|
|
def concat_videos_with_subtitles(cls, videos, audio_duration, platform, mark):
|
|
def concat_videos_with_subtitles(cls, videos, audio_duration, platform, mark):
|
|
# 计算视频文件列表总时长
|
|
# 计算视频文件列表总时长
|
|
- total_video_duration = sum(cls.get_video_duration(video_file[3]) for video_file in videos)
|
|
|
|
|
|
+ total_video_duration = sum(cls.get_audio_duration(video_file[3]) for video_file in videos)
|
|
if platform == "koubo":
|
|
if platform == "koubo":
|
|
# 视频时长大于音频时长
|
|
# 视频时长大于音频时长
|
|
if total_video_duration > audio_duration:
|
|
if total_video_duration > audio_duration:
|