add more files
This commit is contained in:
parent
80d8845eda
commit
8cef9fe666
7
src/math/cost.py
Normal file
7
src/math/cost.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"""
|
||||||
|
Functions in this file should always target for 0 to be the
|
||||||
|
lowest possible error -> smaller values win
|
||||||
|
"""
|
||||||
|
|
||||||
|
def quadratic_loss(target, result):
|
||||||
|
return (target - result)**2.0
|
13
src/mediautils/video.py
Normal file
13
src/mediautils/video.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import moviepy.editor as mp
|
||||||
|
|
||||||
|
def get_subclips(source_video_path, moments):
|
||||||
|
vid = mp.VideoFileClip(source_video_path)
|
||||||
|
clips = []
|
||||||
|
for m in moments:
|
||||||
|
clips.append(vid.subclip(m.start, m.stop))
|
||||||
|
return clips, vid
|
||||||
|
|
||||||
|
def render_moments(moments, input_video_path, output_path):
|
||||||
|
clips, vid = get_subclips(input_video_path, moments)
|
||||||
|
to_render = mp.concatenate_videoclips(clips, logger=None)
|
||||||
|
to_render.write_videofile(output_path, logger=None)
|
Loading…
Reference in New Issue
Block a user