合并时,逻辑修正
This commit is contained in:
parent
61c54899d8
commit
6d543d3a7a
@ -10,7 +10,7 @@ template_video_part = {
|
||||
"start": "",
|
||||
"end": "",
|
||||
"part_start": "",
|
||||
"duration": "",
|
||||
"_duration_str": "",
|
||||
}
|
||||
template_current_video = {
|
||||
"parts": [],
|
||||
@ -31,15 +31,15 @@ def merge_video_parts_and_split(video):
|
||||
for part in video["parts"]:
|
||||
if part["part_start"] is None:
|
||||
raise Exception("视频片段part_start读取异常")
|
||||
if prev_part["duration"] == "":
|
||||
if prev_part["_duration_str"] == "":
|
||||
duration = float(part["part_start"]) - float(prev_part["part_start"])
|
||||
if duration <= 60:
|
||||
raise Exception("视频片段duration过小")
|
||||
prev_part["duration"] = str(duration)
|
||||
prev_part["_duration_str"] = str(duration)
|
||||
new_filename = str(time.time())
|
||||
os.system(" ".join([
|
||||
"ffmpeg", "-y", "-i", "\"{filename}.{file_ext}\"".format_map(prev_part),
|
||||
"-c copy", "-f mpegts", "-t {duration}".format_map(prev_part),
|
||||
"-c copy", "-f mpegts", "-t {_duration_str}".format_map(prev_part),
|
||||
"\"{}.ts\"".format(new_filename)
|
||||
]))
|
||||
os.system(" ".join([
|
||||
|
Loading…
x
Reference in New Issue
Block a user