Add liveview only, fix ffmpeg QT export, default config

This commit is contained in:
ABelliqueux 2024-11-16 18:26:11 +01:00
parent ea41eb22bf
commit 5ab96d1123
2 changed files with 28 additions and 7 deletions

View File

@ -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

View File

@ -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..."))
@ -475,6 +478,16 @@ def main(args):
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