Playing 360 video example?

This forum is about all development around libVLC.
neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Playing 360 video example?

Postby neosettler » 01 Nov 2017 23:57

Greetings,

Getting my hands on today's VLC 3.0 nightly build. Playing a 360 video does unfold and play the video but I'm wondering what needs to be done to project the 360 video equirectangularly when using the SDK. Is it something that is handled by the VLC SDK with some options or we need to implement the movie projection + cursor input ourselves?

Any working example would be quite handy.

Thank you,

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 02 Nov 2017 12:02

Are you seeing the equirectangular one or the projected-360 one? If so, which one do you want?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Playing 360 video example?

Postby neosettler » 02 Nov 2017 15:21

Ideally I wouldn't have to choose, point in case, when I open a regular video, the libvlc_video_projection_t is libvlc_video_projection_rectangular and with a 360 video I get libvlc_video_projection_equirectangular. The problem is that the 360 surf video appears as rectangular anyways where with the VLC.exe, it seems to work just fine. Is there extra steps required to make sure that the 360 video is projected properly? Either equirectangular or projected-360 (taking for granted that equirectangular is also a 360 projection type)

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 11 Nov 2017 14:33

It should be automatic. What video output are you using?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Playing 360 video example?

Postby neosettler » 11 Nov 2017 21:59

Hello Jean-Baptiste, thank you for your support!

I'm not certain what video output you are referring to but I basically render a texture on an OpenGL plane. Here is a simplified code snippet. Hope it make sense.

PS: Code formatting doesn't seem to work for this message.

[code]void VideoLandMovie::CallbackDisplay(void *in_data, void *in_picture)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(in_data);
l_movie->SetUpdated(true);
}

void *VideoLandMovie::CallbackLock(void *in_data, void **in_pixels)
{
VideoLandMovie *l_movie = reinterpret_cast<ZVideoLandMovie*>(in_data);
l_movie->Lock();
*in_pixels = l_movie->GetPixels();
return NULL;
}

void VideoLandMovie::CallbackUnLock(void *in_data, void *in_id, void * const *in_pixels)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(in_data);
l_movie->Unlock();
}

unsigned VideoLandMovie::CallbackSetup(void **in_data, char *in_chroma, unsigned *in_width, unsigned *in_height, unsigned *in_pitches, unsigned *in_lines)
{
VideoLandMovie *l_movie = reinterpret_cast<VideoLandMovie*>(*in_data);

unsigned l_w = (*in_width);
unsigned l_h = (*in_height);

(*in_pitches) = l_w * l_movie->GetChannelCount();
(*in_lines) = l_h;

if (l_movie->GetChannelCount() == 3)
{
memcpy(in_chroma, "RGB8", 4); /// No BGR8?
}
else if (l_movie->GetChannelCount() == 4)
{
memcpy(in_chroma, "BGRA", 4);
}
l_movie->CreatePixels(l_w, l_h);
return 1;
}

void VideoLandMovie::Open()
{
SetEventHandler(&VideoLandMovie::CallbackEvent, this);
libvlc_media_parse(m_VLC_Media);
libvlc_media_player_set_media(m_VLC_Player, m_VLC_Media);
libvlc_video_set_format_callbacks(m_VLC_Player, VideoLandMovie::CallbackSetup, NULL);
libvlc_video_set_callbacks(m_VLC_Player,
VideoLandMovie::CallbackLock,
VideoLandMovie::CallbackUnLock,
VideoLandMovie::CallbackDisplay, this);
}[/code]

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 12 Nov 2017 18:32

As, so you are copying the video data. Then you need to apply the sphere yourself.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Playing 360 video example?

Postby neosettler » 13 Nov 2017 16:02

Oh, I see. Good challenge ahead!

Any good documentation/examples you would recommend?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 13 Nov 2017 17:42

the source code of vlc opengl code in modules/video_output/
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Playing 360 video example?

Postby neosettler » 14 Nov 2017 05:28

Hello Jean-Baptiste, I've been using the nightly build here:

http://nightlies.videolan.org/build/win64/last/

I cant find the source code in the packages. Where can I find the source code that correspond to a build?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 15 Nov 2017 14:09

Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ric62
New Cone
New Cone
Posts: 1
Joined: 13 Feb 2018 07:05

Re: Playing 360 video example?

Postby ric62 » 13 Feb 2018 07:27

Greetings.

Using VLC player I can play a 360 video example and, while it is playing, I can change the point of view by mouse moving.

I want to do the same using libvlc in delphi.
At now I can play the same 360 video example using libvlc in delphi, but I am not able to change the point of view by mouse moving.
Is there something I have to do to enable/activate the mouse pointing?

Thank you for your help.

Riccardo Dallara

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: Playing 360 video example?

Postby Jean-Baptiste Kempf » 13 Feb 2018 09:52

You must do it yourself and use the libvlc_viewpoint API
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

neosettler
Cone that earned his stripes
Cone that earned his stripes
Posts: 107
Joined: 18 Dec 2012 17:44

Re: Playing 360 video example?

Postby neosettler » 26 Feb 2018 06:04

Thank you JB,

I've been poking around and found the function libvlc_video_update_viewpoint but I'cant find where it is being called within the 3.0. source code, what am I missing?

PeterVS
New Cone
New Cone
Posts: 1
Joined: 11 Jan 2019 12:46

Re: Playing 360 video example?

Postby PeterVS » 15 Jan 2019 11:31

Hi neosettler,

Did you find a solution to your problem? I'm facing the same challenge...

I'm starting to think that libvlc_video_update_viewpoint isn't really working well, because it always gives me this System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

I took the sample code in https://github.com/videolan/libvlcsharp to start with, and I managed to get a 360° movie to play in my WPF C# application. The "looking around" behaviour isn't included in the sample code, so I'm trying to roll my own. But when I try to set the viewpoint programmatically using UpdateViewPoint (the LibVLCSharp wrapper around libvlc_video_update_viewpoint), I get this AccessViolationException, even when I call libvlc_video_new_viewpoint to create the new viewpoint.

Do you have sample code of how to look around in a 360 video?

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: Playing 360 video example?

Postby mfkl » 15 Jan 2019 12:39

This sounds like a libvlcsharp issue, not a libvlc issue. open a ticket here please https://code.videolan.org/videolan/LibVLCSharp
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests