|
@@ -2,7 +2,6 @@
|
|
|
import subprocess
|
|
|
import time
|
|
|
|
|
|
-from data_channel.data_help import dataHelp
|
|
|
|
|
|
|
|
|
class FFmpeg():
|
|
@@ -123,8 +122,7 @@ class FFmpeg():
|
|
|
def video_ggduration(cls, new_video_path, video_path_url, pw_random_id, gg_duration_total):
|
|
|
gg_duration_url = video_path_url + str(pw_random_id) + 'gg_duration.mp4'
|
|
|
# 获取视频时长
|
|
|
- total_duration = dataHelp.video_duration(new_video_path)
|
|
|
- # total_duration = cls.get_video_duration(new_video_path)
|
|
|
+ total_duration = cls.get_video_duration(new_video_path)
|
|
|
duration = int(total_duration) - int(gg_duration_total)
|
|
|
if int(total_duration) < int(gg_duration_total):
|
|
|
return new_video_path
|
|
@@ -153,7 +151,7 @@ class FFmpeg():
|
|
|
# 获取视频的原始宽高信息
|
|
|
jpg_url = video_path_url + str(pw_random_id) + 'png.jpg'
|
|
|
# 获取视频时长
|
|
|
- total_duration = dataHelp.video_duration(new_video_path)
|
|
|
+ total_duration = cls.get_video_duration(new_video_path)
|
|
|
time_offset = total_duration - 1 # 提取倒数第一秒的帧
|
|
|
# 获取视频最后一秒,生成.jpg
|
|
|
subprocess.run(
|
|
@@ -193,7 +191,7 @@ class FFmpeg():
|
|
|
single_video_srt = video_path_url + str(pw_random_id) +'video_zm.srt'
|
|
|
single_video_txt = video_path_url + str(pw_random_id) +'video_zm.txt'
|
|
|
single_video = video_path_url + str(pw_random_id) +'video_zm.mp4'
|
|
|
- total_duration = dataHelp.video_duration(new_video_path)
|
|
|
+ duration = cls.get_video_duration(new_video_path)
|
|
|
start_time = cls.seconds_to_srt_time(0)
|
|
|
end_time = cls.seconds_to_srt_time(duration)
|
|
|
# zm = '致敬伟大的教员,为整个民族\n感谢老人家历史向一代伟人'
|
|
@@ -241,9 +239,7 @@ class FFmpeg():
|
|
|
# 片尾位置
|
|
|
pw_url_path = video_path_url + str(pw_random_id) + 'pw_video.mp4'
|
|
|
# 获取视频时长
|
|
|
- pw_duration = dataHelp.video_duration(pw_url)
|
|
|
-
|
|
|
- # pw_duration = cls.get_video_duration(pw_url)
|
|
|
+ pw_duration = cls.get_video_duration(pw_url)
|
|
|
time.sleep(2)
|
|
|
# 添加字幕 wqy-zenhei Hiragino Sans GB
|
|
|
height = 1080
|
|
@@ -305,8 +301,7 @@ class FFmpeg():
|
|
|
single_video_url = video_path_url + 'single_video.mp4'
|
|
|
single_video_srt = video_path_url + 'single_video.srt'
|
|
|
# 获取时长
|
|
|
- duration = dataHelp.video_duration(new_video_path)
|
|
|
- # duration = cls.get_video_duration(new_video_path)
|
|
|
+ duration = cls.get_video_duration(new_video_path)
|
|
|
start_time = cls.seconds_to_srt_time(2)
|
|
|
end_time = cls.seconds_to_srt_time(duration)
|
|
|
single_video_txt = video_path_url + 'single_video.txt'
|