From 5ab96d112348fb8517cd2e275c887cc2b2f6e61b Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Sat, 16 Nov 2024 18:26:11 +0100 Subject: [PATCH] Add liveview only, fix ffmpeg QT export, default config --- config.toml | 8 ++++---- frame_opencv.py | 27 ++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/config.toml b/config.toml index a9ebd6b..3347bb9 100644 --- a/config.toml +++ b/config.toml @@ -12,10 +12,10 @@ framerate = 16 ffmpeg_path = '/usr/bin/ffmpeg' export_options = 'scale=1920:-1,crop=1920:1080' [CAMERA] -cam_w = 1920 -cam_h = 1080 +cam_w = 1600 +cam_h = 900 vflip = 1 hflip = 1 -auto_exposure = 0 -white_balance_auto_preset = 0 +auto_exposure = 1 +white_balance_auto_preset = 2 video_bitrate=25000000 diff --git a/frame_opencv.py b/frame_opencv.py index 04c8c21..103d048 100644 --- a/frame_opencv.py +++ b/frame_opencv.py @@ -423,6 +423,9 @@ def export_animation(input_filename, export_filename): '-r', framerate, '-i', input_filename, '-vf', output_options, + # Fix for Quicktime + '-pix_fmt', 'yuv420p', + '-vcodec', 'libx264', export_filename, ]) return ffmpeg_process @@ -430,7 +433,7 @@ def export_animation(input_filename, export_filename): def main(args): - global onionskin, playback, loop_playback, playhead, index, img_list, first_playback, camera_current_settings + global onionskin, liveview_only, playback, loop_playback, playhead, index, img_list, first_playback, camera_current_settings if not testDevice(0): print(_("No camera device found. Exiting...")) @@ -474,7 +477,17 @@ def main(args): if 'onionskin_was_on' in locals(): onionskin = True loop_playback = False - + + if liveview_only: + # ~ onionskin = False + ret, overlay = cam.read() + if not ret: + print(_("Failed to grab frame.")) + break + cv2.imshow("StopiCV", overlay) + # ~ else: + # ~ onionskin = True + if onionskin: ret, overlay = cam.read() og_frame = overlay.copy() @@ -490,14 +503,21 @@ def main(args): break cv2.imshow("StopiCV", overlay) - if not playback and not onionskin: + if not playback and not onionskin and not liveview_only: cv2.imshow("StopiCV", frame) k = cv2.waitKey(1) + # TODO : Show liveview only + # Key l / 5 + if (k%256 == 108) or (k%256 == 53): + # Toggle liveview + liveview_only = not liveview_only + onionskin = not onionskin # Key o / 9 if (k%256 == 111) or (k%256 == 47): # Toggle onionskin onionskin = not onionskin + liveview_only = False # Key w / 7 - cycle wb if (k%256 == 119) or (k%256 == 55): camera_current_settings = apply_cam_setting(camera_current_settings, ['white_balance_auto_preset']) @@ -611,6 +631,7 @@ next_letter = 'Z' img_list = [] savepath = get_session_folder() onionskin = project_settings['onion_skin_onstartup'] +liveview_only = False playback = False first_playback = True playhead = 0