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.
LoveVideo - LÖVE module for playing video
- 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
If I understand you correctly, this should be no problem. If you look at the API, you can do whatever you want;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.
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
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
Re: LoveVideo - LÖVE module for playing video
I was rather thinking of the fractal as the video:
(Because I can not animate fractals in realtime)
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.
(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
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.
- 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
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;
Attached is a working thing-a-ma-bob.
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
- 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
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
Re: LoveVideo - LÖVE module for playing video
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
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
- 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
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.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
- Zilarrezko
- Party member
- Posts: 345
- Joined: Mon Dec 10, 2012 5:50 am
- Location: Oregon
Re: LoveVideo - LÖVE module for playing video
Maybe it's a hint that he wants you to implement his library, slime.
Cool stuff though, I wish I had the brain capacity to use magic and threads like that.
Cool stuff though, I wish I had the brain capacity to use magic and threads like that.
- 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
Causing a real love.video to break when this one is used is an odd way to encourage me.Zilarrezko wrote:Maybe it's a hint that he wants you to implement his library, slime.
- 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
I don't know, you do love breaking things.slime wrote: Causing a real love.video to break when this one is used is an odd way to encourage me.
Re: LoveVideo - LÖVE module for playing video
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
My video conversion went bad when I sent it in youtube, btw the second video playing is 1280x720
Who is online
Users browsing this forum: No registered users and 0 guests