Video Playback

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
thsock
Posts: 25
Joined: Sun Sep 25, 2005 1:04 pm

Video Playback

Post by thsock »

Does luaplayer have a video playback function? I bet not.
Gary13579
Posts: 93
Joined: Mon Aug 15, 2005 7:43 am

Post by Gary13579 »

You could make a function to play custom made movies.

Basically, you need to export your movie frame by frame.
Then make a little function to loop through them all and display them.

After that, all you need to do is export the sound out of the movie and play it in the function!

There probably isn't a movie playing function, nor will there be, because I don't think there is any code out there to play movies.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

loading an image sequence from ms isn't that easy, cause loading is bit slow... so movie would lag (think so)
the only possibility i see is that you implement xvid playback *rofl*
and add that to luaplayer so ppl can just playback xvid files (hell guess some ppl would kill for that :)) )

greets
lumo, who would love xvid playback too :D
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
Gary13579
Posts: 93
Joined: Mon Aug 15, 2005 7:43 am

Post by Gary13579 »

Oh, right, stupid me ^_^
I can't belive I acutally thought that would work..

You could convert everything into pixels and find a way to blit each scene, dunno how fast that would be though.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

sorry to get some information from other pages to here but i think this is not offtopic...
gaeko99 has released the PSP Media Player for PSP version 0.0.5. PSP Media Player is a media player which is capable of playing AVI (DivX)/OGG/WMA files, especially DivX AVI files at 480x272 full resolution of the PSP.
look at my signature and do what you have to do .oO(grab the code, if available, and put it into luaplayer *grhr*)

greets Lumo
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
2Xtremes2004
Posts: 53
Joined: Wed Aug 31, 2005 1:43 am

Post by 2Xtremes2004 »

I totaly agree with LuMo on this one! };-)
I want my money back!?
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

loading an image sequence from ms isn't that easy, cause loading is bit slow... so movie would lag (think so)
A certain amount of frames can be loaded into RAM at once before playing
anything, so if the movie is short enough, the frame rate can be very fast.

I took 36 Worldwind shots of a mountain at 10 degree intervals, shrunk
the images down to 436x333 (to maintain perspective), and converted
them to png.

Granted 36 frames of animation doesn't sound like too much of a movie
for a 360 degree rotating camera but it is very convincing, add joystick control and it is also fun to play with.

Code: Select all

--
xx = 23
uu = -30
dd = 0
dr = 0

--

barney000 = Image.load("barney0.png")
barney010 = Image.load("barney10.png")
barney020 = Image.load("barney20.png")
barney030 = Image.load("barney30.png")
barney040 = Image.load("barney40.png")
barney050 = Image.load("barney50.png")
barney060 = Image.load("barney60.png")
barney070 = Image.load("barney70.png")
barney080 = Image.load("barney80.png")
barney090 = Image.load("barney90.png")
barney100 = Image.load("barney100.png")
barney110 = Image.load("barney110.png")
barney120 = Image.load("barney120.png")
barney130 = Image.load("barney130.png")
barney140 = Image.load("barney140.png")
barney150 = Image.load("barney150.png")
barney160 = Image.load("barney160.png")
barney170 = Image.load("barney170.png")
barney180 = Image.load("barney180.png")
barney190 = Image.load("barney190.png")
barney200 = Image.load("barney200.png")
barney210 = Image.load("barney210.png")
barney220 = Image.load("barney220.png")
barney230 = Image.load("barney230.png")
barney240 = Image.load("barney240.png")
barney250 = Image.load("barney250.png")
barney260 = Image.load("barney260.png")
barney270 = Image.load("barney270.png")
barney280 = Image.load("barney280.png")
barney290 = Image.load("barney290.png")
barney300 = Image.load("barney300.png")
barney310 = Image.load("barney310.png")
barney320 = Image.load("barney320.png")
barney330 = Image.load("barney330.png")
barney340 = Image.load("barney340.png")
barney350 = Image.load("barney350.png")

--

function frame()
	if dd == 0 then
	screen:blit(xx, uu, barney000, false)
	end
	if dd == 1 then
	screen:blit(xx, uu, barney010, false)
	end
	if dd == 2 then
	screen:blit(xx, uu, barney020, false)
	end
	if dd == 3 then
	screen:blit(xx, uu, barney030, false)
	end
	if dd == 4 then
	screen:blit(xx, uu, barney040, false)
	end
	if dd == 5 then
	screen:blit(xx, uu, barney050, false)
	end
	if dd == 6 then
	screen:blit(xx, uu, barney060, false)
	end
	if dd == 7 then
	screen:blit(xx, uu, barney070, false)
	end
	if dd == 8 then
	screen:blit(xx, uu, barney080, false)
	end
	if dd == 9 then
	screen:blit(xx, uu, barney090, false)
	end
	if dd == 10 then
	screen:blit(xx, uu, barney100, false)
	end
	if dd == 11 then
	screen:blit(xx, uu, barney110, false)
	end
	if dd == 12 then
	screen:blit(xx, uu, barney120, false)
	end
	if dd == 13 then
	screen:blit(xx, uu, barney130, false)
	end
	if dd == 14 then
	screen:blit(xx, uu, barney140, false)
	end
	if dd == 15 then
	screen:blit(xx, uu, barney150, false)
	end
	if dd == 16 then
	screen:blit(xx, uu, barney160, false)
	end
	if dd == 17 then
	screen:blit(xx, uu, barney170, false)
	end
	if dd == 18 then
	screen:blit(xx, uu, barney180, false)
	end
	if dd == 19 then
	screen:blit(xx, uu, barney190, false)
	end
	if dd == 20 then
	screen:blit(xx, uu, barney200, false)
	end
	if dd == 21 then
	screen:blit(xx, uu, barney210, false)
	end
	if dd == 22 then
	screen:blit(xx, uu, barney220, false)
	end
	if dd == 23 then
	screen:blit(xx, uu, barney230, false)
	end
	if dd == 24 then
	screen:blit(xx, uu, barney240, false)
	end
	if dd == 25 then
	screen:blit(xx, uu, barney250, false)
	end
	if dd == 26 then
	screen:blit(xx, uu, barney260, false)
	end
	if dd == 27 then
	screen:blit(xx, uu, barney270, false)
	end
	if dd == 28 then
	screen:blit(xx, uu, barney280, false)
	end
	if dd == 29 then
	screen:blit(xx, uu, barney290, false)
	end
	if dd == 30 then
	screen:blit(xx, uu, barney300, false)
	end
	if dd == 31 then
	screen:blit(xx, uu, barney310, false)
	end
	if dd == 32 then
	screen:blit(xx, uu, barney320, false)
	end
	if dd == 33 then
	screen:blit(xx, uu, barney330, false)
	end
	if dd == 34 then
	screen:blit(xx, uu, barney340, false)
	end
	if dd == 35 then
	screen:blit(xx, uu, barney350, false)
	end

end
--

		------------------------
		-- Start main program --
		------------------------



--
while true do

frame()
--dd = dd + 1
--if dd == 36 then dd = 0 end


pad = Controls.read()
if pad:start() then
	break
	end


if pad&#58;analogY&#40;&#41; < -30 then
		uu = uu - 1
		end

if pad&#58;analogY&#40;&#41; > 30 then
		uu = uu + 1
		end

if pad&#58;analogX&#40;&#41; < -30 then
		dd = dd + 1
		if dd == 36 then dd = 0 end
end

if pad&#58;analogX&#40;&#41; > 30 then
		dd = dd - 1
		if dd == -1 then dd = 35 end
end


	screen.waitVblankStart&#40;5&#41;
	screen&#58;flip&#40;&#41;
end

Cheers, Art.
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

Art wrote:code
This code really sucks :-) What do you do when you have 1000 images? Should be possible, if they are small images, e.g. 32x32 pixels. You should take a look at http://www.lua.org/pil/ and especially 2.5: Tables, for-loops and how to create strings. But the best would be, if someone adds mng, gif and some movie formats. Should be added with external PRX modules to avoid a to big Lua Player EBOOT.PBP file.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

it's faster than a for next loop :D

I just needed to figure out how to put the filenames in a table for one of
your for next loop that doesn't have any next in it.

This was realy a toy program to see if it fit in RAM.
mrn
Posts: 116
Joined: Wed Nov 02, 2005 2:26 am

Post by mrn »

The video information inside MPEG files is stored in the frequency domain rather than in the spatial domain (the images we see). That way, the information is compacted and that compactation can be used to compress (reduce) the amount of information you have to send over the transmission channel. MPEG uses the DCT (Discrete Cosine Transform) to translate spatial information into frequency information. To bring back the spatial information from the MPEG stream you have to apply the iDCT...........
^ quoted from:
http://www.divx.com/support/glossary.php

So, DCT (for Video) and FFT (for Audio) is smthng what we REALLY NEED.
It would ... no! It will attrack many-many Video and Audio programmers,
and they will use Lua.
Just started a "feature request" thread to close .)
http://forums.ps2dev.org/viewtopic.php?t=4221

cheeeers. mrn
link
Posts: 61
Joined: Wed Oct 19, 2005 6:17 am

Post by link »

just have several different folders at low res.(unless you have a big ms)


at the end of each sequence just do a "dofile("scene2.lua") and have your next picture sequences code there and at the end of that do "dofile("scene3.lua") and soforth. that should be enough to get started. thats what i did for my ingame cutscenes(which are handdone so they look horrible). matching up the framerate and sound is pretty hard. if its off by just alittle, about 20 seconds into your movie it will look dubbed. I personally used the the basis of the "pixel fixer" but supsotuted the colors for my images. that way it made it easy to change my framerate.
Julu Julu
Posts: 9
Joined: Tue Nov 01, 2005 8:57 am
Location: Germany

Post by Julu Julu »

@Shine
"This code really sucks :-) What do you do when you have 1000 images?"
:)


You can load the images in an Array.

barneyPics = { }
for i=1, 1000 do
barneyPics = Image.load("barney" .. i .. ".png")
end
MikeHaggar
Posts: 116
Joined: Mon Jul 18, 2005 2:20 am

Post by MikeHaggar »

I think I'd rather see some true video stuff or even gif animation support then 1000 images loaded into an array...
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

MikeHaggar wrote:I think I'd rather see some true video stuff or even gif animation support then 1000 images loaded into an array...
For 1000 images with the size 32x32 you'll need to load only 4 images of size 512x512, using the tiling concept, like in my Snake game. At 30 fps this would be half a minute animation.
SiGi
Posts: 11
Joined: Thu Oct 20, 2005 3:24 am
Location: Phoenix, AZ

Post by SiGi »

Art wrote:it's faster than a for next loop :D

I just needed to figure out how to put the filenames in a table for one of
your for next loop that doesn't have any next in it.

This was realy a toy program to see if it fit in RAM.

That code is REALLY laughable. This is how it should look like:

Code: Select all




-- 
xx = 23
uu = -30
dd = 0
dr = 0

-- 
barney=&#123;&#125;
for i=0,35 do
  str="barney" .. &#40;10*i&#41; .. ".png"
  barney&#91;i&#93;=Image.load&#40;str&#41;
end

function frame&#40;n&#41; 
  screen&#58;blit&#40;xx, uu, barney&#91;n&#93;, false&#41;
end




while true do

frame&#40;dd&#41;
--dd = dd + 1
--if dd == 36 then dd = 0 end


pad = Controls.read&#40;&#41;
if pad&#58;start&#40;&#41; then
   break
   end


if pad&#58;analogY&#40;&#41; < -30 then
      uu = uu - 1
      end

if pad&#58;analogY&#40;&#41; > 30 then
      uu = uu + 1
      end

if pad&#58;analogX&#40;&#41; < -30 then
      dd = dd + 1
      if dd == 36 then dd = 0 end
end

if pad&#58;analogX&#40;&#41; > 30 then
      dd = dd - 1
      if dd == -1 then dd = 35 end
end


   screen.waitVblankStart&#40;5&#41;
   screen&#58;flip&#40;&#41;
end

HaQue
Posts: 91
Joined: Fri Nov 25, 2005 8:52 am
Location: Adelaide, Australia
Contact:

Post by HaQue »

It may be laughable to some, but everyone starts somewhere!!

Give the beginners a break, or, like you did do... some help :-)
Post Reply