Python-VLC 360 Video runtime error

This forum is about all development around libVLC.
InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Python-VLC 360 Video runtime error

Postby InsetStory » 08 May 2018 02:36

Hi I'm new to the VLC api, and I'm trying to write a short python script to play a 360 mp4 video, setting the viewpoint to a specific pitch/yaw/roll/zoom. So far my code looks something like this:

import vlc

Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new('S2.mp4')
Media.get_mrl()
player.set_media(Media)

view = vlc.libvlc_video_new_viewpoint()
x = player.video_update_viewpoint(view, True)

---

But it crashes every time I try to create a new viewpoint -- "vlc.libvlc_video_new_viewpoint()"-- with the error: Runtime Error: ffi_prep_cif failed

Any help as to what I'm doing wrong?

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

Re: Python-VLC 360 Video runtime error

Postby mfkl » 08 May 2018 05:10

Please provide more info so we can reproduce the problem, like your python interop code.
Runtime Error: ffi_prep_cif failed
This sounds like your FFI code is incorrect.

Have a look at this, if you're not already using it:
https://github.com/oaubert/python-vlc/b ... c.py#L7128

And be mindful that type definitions might differ depending on whether you use libvlc 2.2 or 3+.
https://mfkl.github.io

InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Re: Python-VLC 360 Video runtime error

Postby InsetStory » 10 May 2018 01:25

Thanks for the reply! Yes, the file you linked to is the one I'm using, and it definitely crashing when trying to run the interop code. Here's the whole crash message I get when running the above code:
Traceback (most recent call last):
File "sample.py", line 9, in <module>
view = vlc.libvlc_video_new_viewpoint()
File "/home/me/Projects/vlc.py", line 5175, in libvlc_video_new_viewpoint
return f()
RuntimeError: ffi_prep_cif failed
I tried downloading the pre-generated vlc.py file, and after that didn't work I generated my own. Here's the info with my libvlc version:
Build date: Wed May 9 15:03:47 2018 3.0.1 (0x0)
LibVLC version: 3.0.1 Vetinari (0x3000100)
LibVLC compiler: gcc version 7.3.0 (Ubuntu 7.3.0-15ubuntu2)
Let me know if there's any other info I can provide.

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

Re: Python-VLC 360 Video runtime error

Postby mfkl » 10 May 2018 05:28

Hi InsetStory,

Are you sure you're using the latest version of the generated vlc.py? https://github.com/oaubert/python-vlc/b ... 3.0/vlc.py
Your error mentions "line 5175, in libvlc_video_new_viewpoint" yet it's more like at line 7128 in the 3.0 generated vlc.py code.

Not a python expert, so other than that your best luck is to open an issue on the github repo.
https://mfkl.github.io

InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Re: Python-VLC 360 Video runtime error

Postby InsetStory » 11 May 2018 04:24

Tried that version and no go as well. Took your advice and opened the issue. I'll update here if I find out more.

InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Re: Python-VLC 360 Video runtime error

Postby InsetStory » 13 May 2018 23:21

The developer of python-vlc patched the issue with FFI. However, I am still trying to figure out the proper procedure for setting the desired variables and have not had success so far. Could you explain how you would implement a very basic yaw change, for example, in the c libvlc code with a single VLC instance/ media player?

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

Re: Python-VLC 360 Video runtime error

Postby mfkl » 14 May 2018 05:26

Could you explain how you would implement a very basic yaw change, for example, in the c libvlc code with a single VLC instance/ media player?
Just set the yaw property on the viewpoint struct returned from the new call and call update_viewpoint with it.
https://mfkl.github.io

InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Re: Python-VLC 360 Video runtime error

Postby InsetStory » 31 May 2018 02:57

There was a bug but after reporting it the developer has patched it, the variables can now be assigned and the viewpoint updated.

However-- I can't update the viewpoint before playing the video, it simply doesn't acknowledge the change when I play. If I set the command to update the viewpoint just after playing, I see the original viewpoint for a moment before cutting to the new one.

Is this more likely a bug in the libvlc library or the python wrapper?

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

Re: Python-VLC 360 Video runtime error

Postby mfkl » 31 May 2018 06:02

Is this more likely a bug in the libvlc library or the python wrapper?
Without your code, it's hard to tell.
https://mfkl.github.io

InsetStory
New Cone
New Cone
Posts: 6
Joined: 08 May 2018 02:19

Re: Python-VLC 360 Video runtime error

Postby InsetStory » 31 May 2018 18:45

So, this code works to adjust the viewpoint, but only after a brief flash of the unaltered viewpoint:
import vlc
p = vlc.MediaPlayer('V1.mp4")
p.play()
v = vlc.VideoViewpoint()
v.yaw = 100
p.video_update_viewpoint(v,False)
while p.get_state() != 6:
continue

Whereas the following code does not result in an altered viewpoint, despite the documentation saying that the viewpoint can be set before playing.
import vlc
p = vlc.MediaPlayer("V1.mp4")
v = vlc.VideoViewpoint()
v.yaw = 100
p.video_update_viewpoint(v, False)
p.play()
while p.get_state() != 6:
continue

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

Re: Python-VLC 360 Video runtime error

Postby mfkl » 05 Jun 2018 06:47

despite the documentation saying that the viewpoint can be set before playing
If you are referring to this note "It is safe to call this function before the media player is started", all it is saying is that it is a safe operation to perform, nothing more.
the values are set asynchronously, it will be used by the next frame displayed.
Try getting to the next frame maybe?
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 32 guests