fix error in long video recording in server/main.py
This commit is contained in:
@@ -2,7 +2,7 @@ import ctypes
|
||||
import os
|
||||
import platform
|
||||
import shlex
|
||||
import subprocess
|
||||
import subprocess, signal
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
from typing import List, Dict, Tuple
|
||||
@@ -997,7 +997,7 @@ def start_recording():
|
||||
|
||||
start_command = f"ffmpeg -y -f x11grab -draw_mouse 1 -s {screen_width}x{screen_height} -i :0.0 -c:v libx264 -r 30 {recording_path}"
|
||||
|
||||
recording_process = subprocess.Popen(shlex.split(start_command), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
recording_process = subprocess.Popen(shlex.split(start_command), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
return jsonify({'status': 'success', 'message': 'Started recording.'})
|
||||
|
||||
@@ -1009,10 +1009,8 @@ def end_recording():
|
||||
if not recording_process:
|
||||
return jsonify({'status': 'error', 'message': 'No recording in progress to stop.'}), 400
|
||||
|
||||
recording_process.terminate()
|
||||
recording_process.send_signal(signal.SIGINT)
|
||||
recording_process.wait()
|
||||
# return_code = recording_process.returncode
|
||||
output, error = recording_process.communicate()
|
||||
recording_process = None
|
||||
|
||||
# return recording video file
|
||||
|
||||
Reference in New Issue
Block a user