I wanted to watch my SBS VR video files in VLC. currently there is no straight forward way to play these files like other player. in other player you just select 3D > SBS and it shows the typical VR in 2d view. If I want to play these files in VLC I need to inject VR metadata to make the vlc recognize the format. I’m working on how to make a script that forces the vlc to play the files in VR view. I tried few things but still no luck. I browsed through source code and found the thing I might want. Looking at libvlc_video.h
typedef enum libvlc_video_projection_t
{
libvlc_video_projection_rectangular,
libvlc_video_projection_equirectangular, /**< 360 spherical */
libvlc_video_projection_cubemap_layout_standard = 0x100,
} libvlc_video_projection_t;
typedef enum libvlc_video_multiview_t
{
libvlc_video_multiview_2d, /**< No stereoscopy: 2D picture. */
libvlc_video_multiview_stereo_sbs, /**< Side-by-side */
libvlc_video_multiview_stereo_tb, /**< Top-bottom */
libvlc_video_multiview_stereo_row, /**< Row sequential */
libvlc_video_multiview_stereo_col, /**< Column sequential */
libvlc_video_multiview_stereo_frame, /**< Frame sequential */
libvlc_video_multiview_stereo_checkerboard, /**< Checkerboard pattern */
} libvlc_video_multiview_t;
I found that I need to somehow make the video_multiview to be multiview_stereo_sbs and maybe also libvlc_video_projection to video_projection_rectangular. I am not so experienced in vlc lua scripting nor how vlc codebase even work. Can someone tell me how to change the thing if at all possible?
I tried something like
function activate()
local input_item = vlc.input.item()
local name = input_item:name()
vlc.msg.info("Activating extension for: " .. name)
if string.match(name, "3dh") then
vlc.msg.info("SBS file detected: " .. name)
-- Attempt to set stereoscopy mode using libvlc_video_multiview_t
local vout = vlc.object.vout()
if vout then
-- set the stereoscopy mode, assuming supported by the VLC and API
local multiview_mode = 'stereo-sbs' -- translating the C enum to Lua supported string, if exact match required consult API documentation
vlc.var.set(vout, "video-multiview", multiview_mode)
-- Assuming libvlc_video_projection_t is properly set for VR mode supported by the libVLC
local projection_mode = 'equirectangular' -- 360 spherical projection
vlc.var.set(vout, "video-projection", projection_mode)
vlc.msg.info("VR mode enabled for: " .. name)
else
vlc.msg.err("No video output object found")
end
end
end
but then I got ...AppDataRoamingvlcluaextensionsdetectvr.lua:23:VLC lua error in file /builds/videolan/vlc/extras/package/win32/../../../modules/lua/libs/variables.c line 139 (function vlclua_tovalue)
. I think I am stuck on finding the right variable to set
R Ginting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.