fix scene duration
This commit is contained in:
parent
334b4af5fe
commit
0c4f55006d
1 changed files with 7 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import lxml.etree
|
|||
import ox
|
||||
|
||||
from .render_kdenlive import melt_xml
|
||||
from .utils import format_duration
|
||||
|
||||
|
||||
def parse_lang(lang):
|
||||
|
|
@ -57,17 +58,20 @@ def get_clip_by_seqid(clips, seqid):
|
|||
return None
|
||||
|
||||
|
||||
def get_scene_duration(scene):
|
||||
def get_scene_duration(scene, fps=24, track=None):
|
||||
if isinstance(scene, str):
|
||||
with open(scene) as fd:
|
||||
scene = json.load(fd)
|
||||
duration = 0
|
||||
for key, value in scene.items():
|
||||
for name, clips in value.items():
|
||||
if track and '%s:%s' % (key, name) != track:
|
||||
continue
|
||||
if clips:
|
||||
for clip in clips:
|
||||
duration += int(clip["duration"] * 24)
|
||||
return duration / 24
|
||||
duration += round(clip["duration"] * fps)
|
||||
#print("scene duration based on %s:%s is %s %s" % (key, name, duration / fps, format_duration(duration / fps, fps)))
|
||||
return duration / fps
|
||||
|
||||
|
||||
def get_offset_duration(prefix):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue