summaryrefslogtreecommitdiff
path: root/cli/app/search/video.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-01-09 13:16:51 +0100
committerJules Laplace <julescarbon@gmail.com>2020-01-09 13:16:51 +0100
commit21bb879e00eea74a5df9e703749b8cfa20ec1732 (patch)
tree46728510c70b97a7325d1b95daeb0146e357f730 /cli/app/search/video.py
parentdcf472bbd3d26072b03924b2b0d1592e964d6392 (diff)
video
Diffstat (limited to 'cli/app/search/video.py')
-rw-r--r--cli/app/search/video.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/app/search/video.py b/cli/app/search/video.py
new file mode 100644
index 0000000..4f10d49
--- /dev/null
+++ b/cli/app/search/video.py
@@ -0,0 +1,39 @@
+import shutil
+import os
+
+from app.settings import app_cfg
+
+def export_video(fp_frames, fps=30):
+ print("Exporting video...")
+ cmd = [
+ '/home/lens/bin/ffmpeg',
+ '-hide_banner',
+ '-y', # '-v', 'quiet',
+ '-r', fps,
+ '-i', join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_%04d.png'),
+ '-pix_fmt', 'yuv420p',
+ join(app_cfg.DIR_OUTPUTS, fp_frames + '.mp4')
+ ]
+ # print(' '.join(cmd))
+ call(cmd)
+ shutil.rmtree(join(app_cfg.DIR_OUTPUTS, fp_frames))
+
+def export_video_final(fp_frames):
+ print("Exporting video...")
+ cmd = [
+ '/home/lens/bin/ffmpeg',
+ '-hide_banner',
+ '-y', # '-v', 'quiet',
+ '-r', fps,
+ '-i', join(app_cfg.DIR_OUTPUTS, fp_frames, 'frame_%05d.png'),
+ '-c:v', 'libx264',
+ '-preset', 'slow',
+ '-crf', '19',
+ '-vf', 'fps=25',
+ '-pix_fmt', 'yuv420p',
+ '-s', '512x512',
+ join(app_cfg.DIR_RENDERS, fp_frames + '.mp4')
+ ]
+ # print(' '.join(cmd))
+ call(cmd)
+ shutil.rmtree(join(app_cfg.DIR_OUTPUTS, fp_frames))