Page 1 of 1
Playing 360 video example?
Posted: 01 Nov 2017 23:57
by neosettler
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,
Re: Playing 360 video example?
Posted: 02 Nov 2017 12:02
by Jean-Baptiste Kempf
Are you seeing the equirectangular one or the projected-360 one? If so, which one do you want?
Re: Playing 360 video example?
Posted: 02 Nov 2017 15:21
by neosettler
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)
Re: Playing 360 video example?
Posted: 11 Nov 2017 14:33
by Jean-Baptiste Kempf
It should be automatic. What video output are you using?
Re: Playing 360 video example?
Posted: 11 Nov 2017 21:59
by neosettler
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]
Re: Playing 360 video example?
Posted: 12 Nov 2017 18:32
by Jean-Baptiste Kempf
As, so you are copying the video data. Then you need to apply the sphere yourself.
Re: Playing 360 video example?
Posted: 13 Nov 2017 16:02
by neosettler
Oh, I see. Good challenge ahead!
Any good documentation/examples you would recommend?
Re: Playing 360 video example?
Posted: 13 Nov 2017 17:42
by Jean-Baptiste Kempf
the source code of vlc opengl code in modules/video_output/
Re: Playing 360 video example?
Posted: 14 Nov 2017 05:28
by neosettler
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?
Re: Playing 360 video example?
Posted: 15 Nov 2017 14:09
by Jean-Baptiste Kempf
Re: Playing 360 video example?
Posted: 13 Feb 2018 07:27
by ric62
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
Re: Playing 360 video example?
Posted: 13 Feb 2018 09:52
by Jean-Baptiste Kempf
You must do it yourself and use the libvlc_viewpoint API
Re: Playing 360 video example?
Posted: 26 Feb 2018 06:04
by neosettler
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?
Re: Playing 360 video example?
Posted: 15 Jan 2019 11:31
by PeterVS
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?
Re: Playing 360 video example?
Posted: 15 Jan 2019 12:39
by mfkl
This sounds like a libvlcsharp issue, not a libvlc issue. open a ticket here please
https://code.videolan.org/videolan/LibVLCSharp