Step by step 1
Preparation of stereoscopic video using NOMAD VR on HTC Vive.
Based on Dr. Rubén J. García-Hernández talk Stereoscopic and Panoramic Video Creation presented on the Second NOMAD Data Workshop. The slides are available on the NOMAD Deliverable 3.5, pp 125-137.
We start with a configuration file and dataset for NOMADVR, such as the one from Tutorial 8:
For optimal results, please use an SSD to save the screenshots, and ensure there is enough free space.
Activating recording capabilities
In skin.ncfg, change
Also consider lowering the speed by using the animationspeed and movementspeed options.
Start recording by pressing the menu button on controller 2. Stop the recording by pressing the button again. You may record multiple sequences; the screenshots will be saved in disk consecutively, starting at c:\temp\frameL00000.bmp and c:\temp\frameR00000.bmp for the left and right frames. The screenshots are saved upside-down for efficiency reasons.
Even with SSD, the time required to save the screenshots to disk may slow the refresh rate of NOMAD VR. In addition, sudden movements in VR are especially noticeable (and can make users feel motion sickness). Move slowly and deliberately, almost in slow motion.
Creating the video
Open a terminal on c:\temp
We will create a video for each eye and then combine them.
ffmpeg -r 25 -i frameL%05d.bmp -c:v libx264 -crf 1 -vf vflip L.mpg
ffmpeg -r 25 -i frameR%05d.bmp -c:v libx264 -crf 1 -vf vflip R.mpg
Take note of the line regarding video resolution:
Stream #0:0: Video: bmp, bgr24, 2138x2376, 25 tbr, 25 tbn, 25 tbc
We want to create a full HD video (1920x1080), keeping the left and right at 960x1080 with the correct aspect ratio.
ffmpeg -i L.mpg -vf "scale=960:1080:force_original_aspect_ratio=decrease,pad=960:1080:(ow-iw)/2:(oh-ih)/2" L2.mpg
ffmpeg -i R.mpg -vf "scale=960:1080:force_original_aspect_ratio=decrease,pad=960:1080:(ow-iw)/2:(oh-ih)/2" R2.mpg
To merge the videos, we use (Linux, single quote)
ffmpeg -i L2.mpg -i R2.mpg -filter_complex '[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4
or (Windows, double quotes)
ffmpeg -i L2.mpg -i R2.mpg -filter_complex "[0:v]pad=iw*2:ih[int];[int][1:v]overlay=W/2:0[vid]" -map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4
You can check the videos using VLC.
Windows Movie Maker can be used to cut undesired parts of the video, and to join multiple sessions. Audio can also be added.
In Linux, ffmpeg's video editing capabilities may be used to prepare a final video and add an audio track.
Windows Movie Maker or blender.