How To

Tips are given here for the following subjects:


A. Create a high-quality, high-resolution movie

For best viewing (for example, on the CoViz facility), movies are required to be of high resolution, generally UHD (3840x2160 pixels) or FullHD (1920x1080 pixels). At the same time, it is required that the file size not be excessive. The following aspects are important to choose appropriately:

The following information is provided as a guideline for the implementation of the above choices. 

 - using QuickTime 7 Pro

(available on Mac OS X and Windows)

Complete details are provided in the Technical Note and the QuickTime User's Guide (see Chapters 2-4).

  1. Produce a series of images using your application or visualization software (e.g. ParaView, VMD). While the software may enable the direct export of a movie file, this is generally not the optimal method. (For a stereo movie, two series of images are required, one for the left eye and the other for the right.)
  2. Read the images into QuickTime 7 Pro using File/Open Image Sequence ...
  3. Select Export, and the "Movie to MPEG-4". Similar file control is possible for MPEG-4 and QuickTime file types, and both can provide good quality movies.
  4. Select "Options" and then the following values:
    • Video Format: H.264
    • Data Rate: Determines file quality and size. Adjust so that file size (shown at bottom of window) is not excessive. (For UHD format, 15000 kbits/s may be appropriate.)
    • Optimized for: Download
    • Image Size: Custom
    • wxh: 3840x2160 (for UHD format)
    • Frame Rate: 15
    • Key Frame: Automatic
    • Video Options:
      • Restrict Profile(s) to: Main
      • Encoding Mode: Best quality (Multi-pass)
  5. Save file

 - using graphicsmagick and avconv

(available on Linux and Mac OS X)

to be completed
 

B. Create a top-bottom stereo movie

 - using QuickTime 7 Pro

(available on Mac OS X and Windows)

For viewing on a passive stereo screen, stereo movies should be created in top-bottom format, with half the final resolution in the movie for each eye. This can be easily achieved using QuickTime 7 Pro.

  1. Open both the left and right eye movie files in QuickTime 7 Pro.
  2. For each individual movie, open the Show Movie Properties from the Window menu. Click on Video Track and choose Visual Settings tab, then using Scaled Size with Preserve Aspect Ratio unchecked, reduce to 50% the size of the movies in the vertical direction.
  3. Choosing the right eye movie, use the Select All then Copy functions from the Edit menu.
  4. Click on the left eye movie, use the Select All and then apply the Add to Selection and Scale function from the Edit menu. Both movies will now be directly on top of each other.
  5. Open again the Show Movie Properties from the Window menu: The left eye movie will be Video Track 1, and the right eye will be Video Track 2. Select Video Track 1 and click the Visual Setting tab. Now using the Offset, change the the second value to height of the video file. In the Player window, the left eye video tracks should be on top of the right eye track.
  6. Now Save/Export the file and the creation of the stereo movie is complete.

[25.02.2014 - ms]
 

Note: Using 'Save', the resulting video is still composed of two videos embedded together. This means that there is no quality loss, but you require a fast computer to view and scale the two videos at the same time, and the you need to view the video with QuickTime (in my case, the resulting video did not work in VLC). If you want to get a single-channel video, you have to use 'Export' in QuickTime (that requires though much more time and may bring some quality loss if the compression parameters are not chosen properly).

[03.04.2014 - gp]

 - using graphicsmagick and avconv

(available on Linux and Mac OS X)

STEP 1: get the frames [only if you have the video, and not the single frames, otherwise skip to step 2]
 
avconv -i INPUTVIDEOL.mp4 -an 'L%5d.png'
avconv -i INPUTVIDEOR.mp4 -an 'R%5d.png'
 
where INPUTVIDEOL.mp4 and INPUTVIDEOR.mp4 are the videos for the left and right eye, respectively.
This will produce files L00000.png, L00001.png, … files for the left eye, and R00000.png, R00001.png for the right eye (note that this may produce many GB of temporary PNG files for long or high-resolution videos).
 
STEP 2: merge them
 
Execute the following line for each frame if you want to "loose" vertical resolution (and get a final video with the same resolution of each of the two videos):
 
gm convert L.png R.png -append -scale 100%x50% LR.png
 
Otherwise, if you want to double the resolution (e.g. from 1920x1080 frames to 3840x2160 3D video - of course by fictitiously increasing the horizontal resolution)
gm convert L.png R.png -append -scale 200%x100% LR.png
 
A note on the graphickmagick commands: -append will append the pictures in a top-bottom stacking, while +append will append them left-to-right.
 
To do all frames in one shot, you may want to use a script similar to the following one (that may require adaptation if you have less than 10000 frames to add the missing zeros in the filenames):
 
for i in `seq -w 1 LASTFRAME` ; do gm convert L$i.png R$i.png -append -scale 100%x50% LR$i.png ; done
 
STEP 3: merge back in a video
 
Here we merge the frames back in a video. The relevant parameters here are the framerate (we are not specifying it, to use the default one), and most importantly the codec and the bitrate.
 
As a very rough guideline, for H.264 videos, I find that a bitrate of 3500k can be ok for a 1920x1080 video, and the bitrate scales with the number of pixels (roughly). With the standard video codec (no -c:v option), one typically needs larger bitrates (by a factor of 3 or 4) to get the same quality. But of course, this depends a lot on your video, so try and experiment.
 
An example script to make the video is:
 
avconv -i LR%d.png -b:v 4000k -pass 1 -c:v libx264 stereo.mp4 && avconv -i LR%d.png -b:v 4000k -pass 2 -y -c:v libx264 stereo.mp4
 

Note: I strongly suggest to use two passes to get a better quality

Note: to use the libx264 on ubuntu for encoding, you need an additional package: libavcodec-extra-53 

 

[03.04.2014 - gp]