-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1062 from luxonis/fix/video_recording
Improve mp4 video recording
- Loading branch information
Showing
5 changed files
with
180 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
depthai_sdk/sdk_tests/components/stereo/test_stereo_component.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,43 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
import time | ||
from pathlib import Path | ||
|
||
import cv2 | ||
from pyvirtualdisplay import Display | ||
|
||
EXAMPLES_DIR = Path(__file__).parent.parent.parent / "examples" | ||
EXAMPLES_DIR = Path(__file__).parents[1] / 'examples' | ||
os.environ['DISPLAY'] = '' # Hide the display | ||
|
||
# Create a temporary directory for the tests | ||
Path('/tmp/depthai_sdk_tests').mkdir(exist_ok=True) | ||
os.chdir('/tmp/depthai_sdk_tests') | ||
|
||
|
||
def test_examples(): | ||
python_executable = Path(sys.executable) | ||
for example in EXAMPLES_DIR.rglob("**/*.py"): | ||
print(list(EXAMPLES_DIR.rglob("**/*.py"))) | ||
print(EXAMPLES_DIR.absolute()) | ||
for example in [list(EXAMPLES_DIR.rglob("**/*.py"))[0]]: | ||
print(f"Running example: {example.name}") | ||
|
||
result = subprocess.Popen(f"{python_executable} {example}", stdout=subprocess.PIPE, stderr=subprocess.PIPE, | ||
env={"DISPLAY": ""}, shell=True) | ||
|
||
time.sleep(5) | ||
result.kill() | ||
time.sleep(5) | ||
print('Stderr: ', result.stderr.read().decode()) | ||
|
||
# if result.returncode and result.returncode != 0: | ||
# assert False, f"{example} raised an exception: {result.stderr}" | ||
|
||
cv2.destroyAllWindows() | ||
print(f'{EXAMPLES_DIR.parent}:{EXAMPLES_DIR.parent}/depthai_sdk') | ||
with Display(visible=False, size=(800, 600)): | ||
result = subprocess.Popen(f"{python_executable} {example}", | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
env={ | ||
'DISPLAY': '', | ||
'PYTHONPATH': f'{os.environ["PYTHONPATH"]}:{EXAMPLES_DIR.parent}' | ||
}, | ||
shell=True) | ||
|
||
time.sleep(5) | ||
result.kill() | ||
time.sleep(5) | ||
print('Stderr: ', result.stderr.read().decode()) | ||
|
||
# if result.returncode and result.returncode != 0: | ||
# assert False, f"{example} raised an exception: {result.stderr}" | ||
|
||
cv2.destroyAllWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters