4

I think I figured out the issue i'm facing with my original question here. When I downloaded the 360 videos they look like a normal video file like this:

Normal Video

But for the VR View to work properly, the video needs to be split like this:

VR Video

Is there any way I can convert the downloaded 360 videos into the VR (dual screen) format or can I programmatically set my app to accept the 360 mp4 file and display without overly zooming in or out on certain areas on the video?

Extract from my xml file:

<com.google.vr.sdk.widgets.video.VrVideoView
    android:id="@id/video_view"
    android:layout_width="match_parent"
    android:layout_height="250dip"
    android:scrollbars="null" /> 
Community
  • 1
  • 1
Anish
  • 740
  • 4
  • 11
  • 27

1 Answers1

5

I downloaded the video you linked to and was able to get it to play properly using the VrVideoView in both regular and goggle modes. The video you linked to is not a stereoscopic video, but is a monoscopic video.

For the clarity of this answer, I'll briefly explain the two types of VR videos supported by Google's VR SDK: Monoscopic and Stereoscopic videos. With monoscopic, the video was shot with only one camera and when viewed in a regular player, it looks like the top image in your question, with all the distortions. With stereoscopic, the video was shot using two cameras and depending on the stereoscopic format (there's top/bottom and left/right), it will look like the bottom image in your question when viewed with a regular player and will also look distorted. Google's VR player only supports the top/bottom version of the stereoscopic format.

If the video you are attempting to play is a monoscopic 360 video (as is the case with the linked video), then you can play it using the VR SDK as follows:

VrVideoView vrVideoView;

// initialize the view here

Options options = new Options();

// This tells the player that the video is a monoscopic 360 video
options.inputType = Options.TYPE_MONO;

// This tells the player that it should play using HLS or progressive video play
// If you are linking to a single video file, use default.
options.inputFormat = Options.FORMAT_DEFAULT;

// Assuming you've downloaded the video...
vrVideoView.loadVideoFromAssets("my-video.mp4", options);
vrVideoView.playVideo();

Now if you are playing a stereoscopic top/bottom format 360 video, then you can similarly play it by just altering the input type of the video:

VrVideoView vrVideoView;

// initialize the view here

Options options = new Options();

// This tells the player that the video is a stereoscopic top/bottom 360 video
options.inputType = Options.TYPE_STEREO_OVER_UNDER;

// This tells the player that it should play using HLS or progressive video play
// If you are linking to a single video file, use default.
options.inputFormat = Options.FORMAT_DEFAULT;

// Assuming you've downloaded the video...
vrVideoView.loadVideoFromAssets("my-video.mp4", options);
vrVideoView.playVideo();

Now, you probably want to play this video using goggles. In this case, you can simply set the display mode of the VR player. The embedded mode is the regular small player that fits into your UI and acts as a small one-eyed viewport into the 360 video, with distortions corrected. The fullscreen monoscopic mode is similar to embedded in that is is the same one-eyed perspective, but instead the device's entire screen is used as the viewport. The fullscreen stereo option will split the video into two images, one for each eye, and will be viewable with the VR goggles. See below for the code to do this (note: this code can be called anytime after the VrVideoView is constructed and it will adjust accordingly):

// This displays the video as inside the normal bounds for viewing without the VR goggles.
vrVideoView.setDisplayMode(DisplayMode.EMBEDDED);

// If you want to go full-screen without goggles...
vrVideoView.setDisplayMode(DisplayMode.FULLSCREEN_MONO);

// If you want to go full-screen and use goggles...
vrVideoView.setDisplayMode(DisplayMode.FULLSCREEN_STEREO);

There might be some confusion surrounding the naming of the Options and the DisplayMode. The Options are simply used by the player to determine whether the source video has one perspective or two. The DisplayMode is used by the player to determine how to display that video. You can have a monoscopically shot video that is displayed stereoscopically, it will just have each eye seeing the same perspective. Likewise, you can have a stereoscopically shot video displayed monoscopically, it's just that the viewport will only be displaying one eye's perspective and the other perspective will be ignored.

I hope that clears things up. Let me know if you have still have trouble playing the video.

anthonycr
  • 4,146
  • 1
  • 28
  • 35
  • 1
    Have you seen God? I have. He goes by the name of anthonycr on stackoverflow. Thanks a lot for your help here. Setting the input type to `MONO` was what caused the issues. I was trying to watch monoscopic video with a `STEREO_OVER_UNDER` input type. Really appreciate your explanation too! – Anish Jan 25 '17 at 18:20
  • You're welcome! The input type was problematic for me too, so I'm glad I could help someone else figure it out. – anthonycr Jan 25 '17 at 19:47