Question about making lua extension for forcing VR SBS playback

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>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;
</code>
<code>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; </code>
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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>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
</code>
<code>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 </code>
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

New contributor

R Ginting is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật