Jump to content

LibTheora video


AggrorJorn
 Share

Recommended Posts

I am at a point where I want to add video into my project. Now I know that Niosop made this great video library for Lua called LibTheora player. However I recall there was this video about it how to use it, but I can't seem to find it.

 

I am trying to get the video's to play inside as well as outside the editor, but with no luck.

 

C++ version:

http://leadwerks.com/werkspace/index.php?/topic/730-video-to-texture-via-libtheoraplayer/page__hl__theora

 

showcase:

http://leadwerks.com/werkspace/index.php?/topic/741-video-playing-example/page__p__6579#entry6579

 

download section:

http://leadwerks.com/werkspace/index.php?/files/file/89-letheorazip/

 

 

Does anybody have a working Lua example of how things work?

 

Steps taken so far:

  1. extracted the lib theora file,shaders, lua scripts in to the game project.
  2. added a .ogg video inside the project
    this code:
    require("Scripts/constants/keycodes")
    require("Scripts/math/math")
    require("Scripts/video")
    
    
    RegisterAbstractPath("")        
    Graphics(1440,900,32)        
    fw=CreateFramework()        
    
    
    cube = CreateCube()
    cube:SetPosition(Vec3(0,0,5))
    
    video = TheoraClip:new()
    videoMat:CreateMaterial("video.ogg", video)
    cube:Paint(videomat)
    video:Play()
    
    while KeyHit(KEY_ESCAPE)==0 do        
    
    
           fw:Update() 
           fw:Render()
    
           Flip(0)
    end
    


Link to comment
Share on other sites

Yips, I have the following files:

 

  • libtheoraplayer.dll (root)
  • letheora.dll (root)
  • lua51.dll (root)
  • lua5.1.dll (root)
  • video.mat (root)
  • video.ogg (root)
  • nio_util.lua (inside scripts folder)
  • video.lua (inside scripts folder)
  • mesh_video.frag (placed inside the shader.pak/mesh folder)

Link to comment
Share on other sites

Gimpys Old TV using Nio's video material works for me in both 2.4 and 2.32r5

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

I must be forgetting something. Do you have the same files as I do?

 

libtheoraplayer.dll (root)

letheora.dll (root)

lua51.dll (root)

lua5.1.dll (root)

video.mat (root)

video.ogg (root)

nio_util.lua (inside scripts folder)

video.lua (inside scripts folder)

mesh_video.frag (placed inside the shader.pak/mesh folder)

Link to comment
Share on other sites

Do you have the same files as I do?

 

 

no ... mine work :)

 

 

On a serious note

 

 

libtheoraplayer.dll (SDK root)

letheora.dll (SDK root)

lua51.dll (SDK root)

lua5.1.dll (SDK root)

video.mat (Materials root)

bunny.ogg (SDK root)

nio_util.lua (scripts root)

video.lua (scripts root)

mesh_video.frag (placed inside the shader.pak/mesh folder)

 

Make sure old-tv.lua does have the right path to the correct .ogg file

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

thx marley,

 

the editor version is working now. I made the mistake of using the abstract function for finding the video.

 

Only thing left to find out is getting it to work outside the editor.

 

require("Scripts/constants/keycodes")
require("Scripts/math/math")
require("Scripts/video")

RegisterAbstractPath("")        
Graphics(1440,900,32)        
fw=CreateFramework()        

camera = fw.main.camera
camera:SetPosition(Vec3(0,10,0))
light = CreatePointLight(10)

scene = LoadScene("abstract::scene.sbx")

---------------------------------------------
-- Video is loaded on a cube.
---------------------------------------------

cube = CreateCube()
cube:SetPosition(Vec3(0,10,5))


TheoraVideo:Init()
videoclip = TheoraVideo:CreateMaterial("video.ogg", "Videotest")
cube:Paint(videoclip,1)

videoclip:SetLoop(1)
--videoclip:Play(1)

---------------------------------------------
-- Video is loaded on a cube.
---------------------------------------------

camRotation=Vec3(0,0,0)
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
HideMouse(1)

while KeyHit(KEY_ESCAPE)==0 do

--Camera look
gx=Curve(MouseX()- GraphicsWidth()/2,gx,10)
gy=Curve(MouseY()- GraphicsHeight()/2,gy,10)
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
camRotation.x = camRotation.x+gy /10
camRotation.y = camRotation.y-gx /10	
camera:SetRotation(camRotation,1)

--keys
move   = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10)
strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10)	
camera:Move(Vec3(strafe /11,0,move/11))	

       fw:Update() 
       fw:Render()

       Flip(0)
end

 

I am sure that there was this video or article were Niosop showed how to set this up. I have send him a message.

Link to comment
Share on other sites

getting it to work outside the editor

 

 

Not 100% sure what you mean by that.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...