Intro: Linux Shell Script Conversion for 3d-video and Pictures
This little instructable shows how to use the linux-shell to convert 3d-video files and 3d-picture files to a format for the google cardboard.
I have the rare privilege to own a Fuji Real 3D W3. When I bought it some years ago it was a rather expensive camera. The technical features of the camera itself were limited, but it had two sensors, the output was aligned and the display was even in 3d!!!
After an initial phase of show and try I left it at home more and more often. But now with the google cardboard this camera is perfect to capture real 3d footage. But most of the scripting-steps also apply for other cameras or even if you use two separate cameras.
Step 1: Converting MPO to a Side by Side Jpg
A MPO-file is a Multi-Picture-Object. In principle this is just two jpgs in one file.
Most picture-viewers will open this file and display it as one picture.
If the script is executed in the folder of MPO pictures, the script does the following:
- get a list of all MPOs in this folder
- extract the left and right image
- stick them together side-by-side
Optional parts are:
- make a folder for the MPOs and
- move the MPOs in there
- remove the temporal pictures
Step 2: Convert the Stereo-AVI to a Side-by-side-movie
With the movie we do just the same as with the pictures, just with different tools.
For the movie we need ffmpeg, which is very mighty and can split and join several streams in one file.
Here I added an additional check before starting execution. But the script doesn't delete something original, so there is no real need for this.
I found that my LG G3 won't play movies with the double width of Full-HD. But the movies from the Fuji 3D W3 are not Full HD either, they only come in 1280x720. Which results in a side-by-side movie of 2560x720. And this is perfectly played on the G3.
Step 3: Transfer the Results to Your Smartphone and Use Google Cardboard (Hardware) to View Them
This is principally the easiest step, as you only have to connect you smartphone to your computer and you should be able to copy the files to the smartphone.
The good thing is, you don't need any special app to view them with your cardboard viewer. But you might want to use a bluetooth controller to step through the folder once the phone in in the viewer.
Just start the gallery and navigate to the pictures, then slide the phone into the cardboard-viewer and enjoy.
For movies I use the mx-Player. A screenshot you can see here.