Compare commits

..

5 commits

Author SHA1 Message Date
j
73a9481ef1 fix off by one and make option to load melt outside of class 2023-10-19 15:53:18 +01:00
j
7fe4b02552 use batch for vo 2023-10-19 15:52:55 +01:00
j
6071b71752 load editing tags 2023-10-19 15:52:35 +01:00
j
4491abc277 add editing tags 2023-10-19 15:52:12 +01:00
j
e0b157de64 only create 5.1 mix once 2023-10-19 13:10:23 +01:00
5 changed files with 58 additions and 26 deletions

View file

@ -547,6 +547,16 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"filter": true, "filter": true,
"sort": true "sort": true
}, },
{
"id": "editingtags",
"title": "Editing Tags",
"type": ["string"],
"autocomplete": true,
"columnRequired": true,
"columnWidth": 180,
"filter": true,
"sort": true
},
{ {
"id": "tags", "id": "tags",
"title": "Tags", "title": "Tags",

View file

@ -38,6 +38,7 @@ class Command(BaseCommand):
durations.append(e.files.all()[0].duration) durations.append(e.files.all()[0].duration)
clip["duration"] = min(durations) clip["duration"] = min(durations)
clip['tags'] = i.data.get('tags', []) clip['tags'] = i.data.get('tags', [])
clip['editingtags'] = i.data.get('editingtags', [])
if "original" in clip and "foreground" in clip and "background" in clip: if "original" in clip and "foreground" in clip and "background" in clip:
clips.append(clip) clips.append(clip)
else: else:

View file

@ -90,6 +90,10 @@ def compose(clips, target=150, base=1024, voice_over=None):
length += clip['duration'] length += clip['duration']
fg = clip['foreground'] fg = clip['foreground']
if 'foley' in clip:
foley = clip['foley']
else:
foley = fg
if 'foreground2' in clip: if 'foreground2' in clip:
if chance(seq, 0.5): if chance(seq, 0.5):
fg = clip['foreground2'] fg = clip['foreground2']
@ -140,9 +144,10 @@ def compose(clips, target=150, base=1024, voice_over=None):
'duration': clip['duration'], 'duration': clip['duration'],
'src': clip['original'], 'src': clip['original'],
}) })
# TBD: Foley
scene['audio']['A2'].append({ scene['audio']['A2'].append({
'duration': clip['duration'], 'duration': clip['duration'],
'src': fg, 'src': foley,
}) })
return scene return scene
@ -286,33 +291,43 @@ def render_all(options):
fragment_prefix = Path(fragment_prefix) fragment_prefix = Path(fragment_prefix)
cmds = [] cmds = []
for src, out1, out2 in ( for src, out1, out2 in (
('audio-A1.wav', 'fl.wav', 'fr.wav'), ("audio-A1.wav", "fl.wav", "fr.wav"),
('audio-A2.wav', 'fc.wav', 'lfe.wav'), ("audio-A2.wav", "fc.wav", "lfe.wav"),
('audio-A3.wav', 'bl.wav', 'br.wav'), ("audio-A3.wav", "bl.wav", "br.wav"),
): ):
cmds.append([ cmds.append([
'ffmpeg', '-y', "ffmpeg", "-y",
'-nostats', '-loglevel', 'error', "-nostats", "-loglevel", "error",
'-i', fragment_prefix / src, "-i", fragment_prefix / src,
'-filter_complex', "-filter_complex",
"[0:0]pan=1|c0=c0[left]; [0:0]pan=1|c0=c1[right]", "[0:0]pan=1|c0=c0[left]; [0:0]pan=1|c0=c1[right]",
"-map", "[left]", fragment_prefix / out1, "-map", "[left]", fragment_prefix / out1,
"-map", "[right]", fragment_prefix / out2, "-map", "[right]", fragment_prefix / out2,
]) ])
cmds.append([ cmds.append([
'ffmpeg', '-y', "ffmpeg", "-y",
'-nostats', '-loglevel', 'error', "-nostats", "-loglevel", "error",
'-i', fragment_prefix / "fl.wav", "-i", fragment_prefix / "fl.wav",
'-i', fragment_prefix / "fr.wav", "-i", fragment_prefix / "fr.wav",
'-i', fragment_prefix / "fc.wav", "-i", fragment_prefix / "fc.wav",
'-i', fragment_prefix / "lfe.wav", "-i", fragment_prefix / "lfe.wav",
'-i', fragment_prefix / "bl.wav", "-i", fragment_prefix / "bl.wav",
'-i', fragment_prefix / "br.wav", "-i", fragment_prefix / "br.wav",
'-filter_complex', "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]", "-filter_complex", "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]",
"-map", "[a]", "-c:a", "aac", fragment_prefix / "audio-5.1.mp4" "-map", "[a]", "-c:a", "aac", fragment_prefix / "audio-5.1.mp4"
]) ])
for cmd in cmds: for cmd in cmds:
#print(" ".join([str(x) for x in cmd]))
subprocess.call(cmd) subprocess.call(cmd)
'''
for fn in (
"audio-A1.wav", "audio-A2.wav", "audio-A3.wav",
"fl.wav", "fr.wav", "fc.wav", "lfe.wav", "bl.wav", "br.wav",
):
fn = fragment_prefix / fn
if os.path.exists(fn):
os.unlink(fn)
'''
print("Duration - Target: %s Actual: %s" % (target_position, position)) print("Duration - Target: %s Actual: %s" % (target_position, position))
with open(_cache, "w") as fd: with open(_cache, "w") as fd:
json.dump(_CACHE, fd) json.dump(_CACHE, fd)

View file

@ -12,6 +12,12 @@ def get_propery(element, name):
return element.xpath('property[@name="%s"]' % name)[0].text return element.xpath('property[@name="%s"]' % name)[0].text
def melt_xml(file):
if file in _CACHE:
out = _CACHE[file]
else:
out = _CACHE[file] = subprocess.check_output(['melt', file, '-consumer', 'xml']).decode()
return out
class KDEnliveProject: class KDEnliveProject:
@ -423,10 +429,7 @@ class KDEnliveProject:
return prefix + self.get_counter(prefix) return prefix + self.get_counter(prefix)
def get_chain(self, file, kdenlive_id=None): def get_chain(self, file, kdenlive_id=None):
if file in _CACHE: out = melt_xml(file)
out = _CACHE[file]
else:
out = _CACHE[file] = subprocess.check_output(['melt', file, '-consumer', 'xml']).decode()
chain = lxml.etree.fromstring(out).xpath('producer')[0] chain = lxml.etree.fromstring(out).xpath('producer')[0]
chain.tag = 'chain' chain.tag = 'chain'
chain.attrib['id'] = self.get_id('chain') chain.attrib['id'] = self.get_id('chain')
@ -614,7 +617,7 @@ class KDEnliveProject:
self.get_element("entry", attrib={ self.get_element("entry", attrib={
"producer": chain.attrib["id"], "producer": chain.attrib["id"],
"in": chain.attrib["in"], "in": chain.attrib["in"],
"out": str(frames), "out": str(frames - 1)
}, children=[ }, children=[
["kdenlive:id", id], ["kdenlive:id", id],
] + filters_), ] + filters_),

View file

@ -567,7 +567,7 @@ pandora.ui.infoView = function(data, isMixed) {
], ],
operator: '&' operator: '&'
}, },
keys: ['title', 'type', 'id'], keys: ['title', 'type', 'id', 'batch'],
range: [0, 10] range: [0, 10]
}; };
$element.appendTo($text); $element.appendTo($text);
@ -575,6 +575,9 @@ pandora.ui.infoView = function(data, isMixed) {
response.data.items.forEach(item => { response.data.items.forEach(item => {
if (item.id != data.id) { if (item.id != data.id) {
var type = item.type ? item.type[0] : 'Unknown' var type = item.type ? item.type[0] : 'Unknown'
if (type == 'Voice Over' && item.batch) {
type = item.batch
}
$element.append( $element.append(
` <a href="/${item.id}/info">${type}</a>` ` <a href="/${item.id}/info">${type}</a>`
) )