LoveVideo - LÖVE module for playing video

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by undef »

Would it be possible to stream video and draw other stuff on the it?
That way I could make complex backgrounds which would be to expensive to calculate in realtime.
Like fractals.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by josefnpat »

undef wrote:Would it be possible to stream video and draw other stuff on the it?
That way I could make complex backgrounds which would be to expensive to calculate in realtime.
Like fractals.
If I understand you correctly, this should be no problem. If you look at the API, you can do whatever you want;

Code: Select all

LoveVideo = require "LoveVideo.lovevideo"
cool_joe = LoveVideo.newVideo('cool_joe')
function love.graphics.draw()
  cool_joe:draw()
  drawFractal() -- Draw a crazy fractal on top of your video!
end
Last edited by josefnpat on Wed Oct 08, 2014 1:05 pm, edited 1 time in total.
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by undef »

I was rather thinking of the fractal as the video:
(Because I can not animate fractals in realtime)

Code: Select all

fractal = love.video.newVideo( "crazyFractal" )
function love.graphics.draw()
  love.video.draw( fractal )
  drawStuff() -- Draw other, probably still quite crazy stuff on top of it
end
But I'm glad this should work.

I don't really know how this works, but since a video is only images with audio, is it also somehow possible to stream from a .gif file?
Otherwise I could just repack it as video, but that would seem strange...

Because I made some nice gifs with LÖVE (from pngs), that are to costly to render in realtime.
Attachments
Stuff like this
Stuff like this
n6.gif (4.79 MiB) Viewed 3310 times
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by josefnpat »

Your use case is rather out of scope.

You could just use imagemagick's convert to export them to PNG's and then just display them at whatever FPS you want.

But if you *REALLY* want to use LoveVideo, you can.

I used imagemagick's convert to extract the gif to a bunch of PNG's (119 of them). With the assumption that it should be 24fps, that means there needs to be an empty audio file of 119/24 seconds, which is about 4.983 seconds. I used audacity to make that.

Then I configured the info.lua as follows;

Code: Select all

local info = {}

info.image_format = "png"
info.fps = 24
info.frame = {
  width = 500,
  height = 500,
  rows = 1,
  columns = 1
}

return info
Attached is a working thing-a-ma-bob.
Attachments
LoveVideo-fractal.love
(3.92 MiB) Downloaded 120 times
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by undef »

Oh I'm terribly sorry.
It was quite a long time ago I wrote that code, and somehow I though it didn't run in realtime when I just looped through the pngs, but apperently it does...
I don't know why I thought it didn't, maybe it was still LÖVE 0.8, or there was some other reason it didn't run smoothly then.

Sorry again for the effort I've caused you.


Anyway, thanks a lot!
And great work on the module, keep it up :)
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by slime »

josefnpat wrote:

Code: Select all

cool_joe = love.video.newVideo('cool_joe')
function love.graphics.draw()
  love.video.draw( cool_joe )
  drawFractal() -- Draw a crazy fractal on top of your video!
end
You should update the code to make it use something other than love's namespace – it's bad practice in general to do that, plus if/when a real love.video module gets added to LÖVE then any code that overwrites love.video for its own purposes (such as the above snippet) will cause the real love.video to break horribly.
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: LoveVideo - LÖVE module for playing video

Post by Zilarrezko »

Maybe it's a hint that he wants you to implement his library, slime. :awesome:

Cool stuff though, I wish I had the brain capacity to use magic and threads like that. :o
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by slime »

Zilarrezko wrote:Maybe it's a hint that he wants you to implement his library, slime. :awesome:
Causing a real love.video to break when this one is used is an odd way to encourage me. :P
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by bartbes »

slime wrote: Causing a real love.video to break when this one is used is an odd way to encourage me. :P
I don't know, you do love breaking things.
User avatar
Shell32
Prole
Posts: 6
Joined: Wed Jun 26, 2013 12:24 am
Location: Bebedouro, Brazil
Contact:

Re: LoveVideo - LÖVE module for playing video

Post by Shell32 »

https://www.youtube.com/watch?v=9sG6eBYT_Ts

My video conversion went bad when I sent it in youtube, btw the second video playing is 1280x720
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests