Skip to content
Snippets Groups Projects
Verified Commit 4c8802f3 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: better video handling

parent 0d9f9169
No related branches found
No related tags found
1 merge request!36Support for Python
Pipeline #3623 passed
...@@ -103,12 +103,12 @@ This is a [Game Boy](https://en.wikipedia.org/wiki/Game_Boy) emulator built usin ...@@ -103,12 +103,12 @@ This is a [Game Boy](https://en.wikipedia.org/wiki/Game_Boy) emulator built usin
image = self.image() image = self.image()
image.save(filename, format=format) image.save(filename, format=format)
def video(self, encoder="avc1", display=True) -> Any: def video(self, encoder="avc1", display=True, file_name="output.mp4") -> Any:
from cv2 import VideoWriter, VideoWriter_fourcc, imread from cv2 import VideoWriter, VideoWriter_fourcc, imread
from IPython.display import Video, display as _display from IPython.display import Video, display as _display
image_paths = glob(f"{self._capture_temp_dir}/*.png") image_paths = glob(f"{self._capture_temp_dir}/frame_*.png")
video_path = f"{self._capture_temp_dir}/video.mp4" video_path = f"{self._capture_temp_dir}/{file_name}"
encoder = VideoWriter( encoder = VideoWriter(
video_path, video_path,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment