Skip to content

Commit

Permalink
Merge branch 'master' into fixing_videos
Browse files Browse the repository at this point in the history
  • Loading branch information
wmcclinton committed Nov 2, 2023
2 parents 3ca6080 + 770444e commit ae42d99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions igibson/render/viewer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

Check failure on line 1 in igibson/render/viewer.py

View workflow job for this annotation

GitHub Actions / build

Imports are incorrectly sorted and/or formatted.
import os
import random
import time
from os.path import isfile, join
from moviepy.editor import VideoFileClip, CompositeVideoClip

import cv2
import numpy as np
Expand Down Expand Up @@ -98,9 +98,6 @@ def update(self, save_video=False, task_name=""):
self.frame_idx += 1
cv2.waitKey(1)

def make_video(self, task_name=""):
convert_frames_to_video(self.video_folder+"/", task_name + "_first_person_pov.mp4", 25.0)

class Viewer:
def __init__(
self,
Expand Down Expand Up @@ -835,8 +832,18 @@ def update(self, save_video=False, task_name=""):
self.initialize = False

def make_video(self, task_name=""):
convert_frames_to_video(self.robotview_folder+"/", task_name + "_first_person_pov.mp4", 25.0)
convert_frames_to_video(self.externalview_folder+"/", task_name + "_third_person_pov.mp4", 25.0)
first_person_video_filename = task_name + "_first_person_pov.mp4"
third_person_video_filename = task_name + "_third_person_pov.mp4"
# First, make and save first and third person POV videos
# respectively.
convert_frames_to_video(self.robotview_folder+"/", first_person_video_filename, 25.0)
convert_frames_to_video(self.externalview_folder+"/", third_person_video_filename, 25.0)
# Then, load these and combine them together.
first_person_video = VideoFileClip(first_person_video_filename)
third_person_video = VideoFileClip(third_person_video_filename)
resized_first_person_video = first_person_video.resize(0.25)
final_video = CompositeVideoClip([third_person_video,resized_first_person_video.set_position(("right","top"))])
final_video.write_videofile(task_name + "_combined_view.mp4")

def convert_frames_to_video(pathIn,pathOut,fps):
"""Makes mp4 video from frames collected from recording."""
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def run(self):
"gitpython",
"py360convert",
"bddl",
"moviepy"
],
ext_modules=[CMakeExtension("MeshRendererContext", sourcedir="igibson/render")],
cmdclass=dict(build_ext=CMakeBuild),
Expand Down

0 comments on commit ae42d99

Please sign in to comment.