Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Play Videos in Codea Workaround

edited July 2013 in Questions Posts: 391

I got an idea on how to get Codea to play videos, at least until videos are supported through Codea itself.

So I am going to use my Linux server, utilizing FFmpeg and a php script that returns a specified frame of a video as an image. With this php script, I can call an http.request and pull the variables for second and frame to make sure I grab a specific frame at the specified second of the video being hosted on my server. This may require a lot of http.request calls for long videos, but I can also have it skip frames to lower the number of total images.

I am currently setting up my server to run this and will be testing it out sometime today. When I get it running I will post the code for you all to see.

My question regarding this is... Do you think this is an effective way to accomplish the task of playing videos in Codea? To build the initial table of frames I assume would take quite a bit of time, and it may be sending too many requests to my server. The idea is logical, but really inefficient, lol.

Tagged:

Comments

  • edited July 2013 Posts: 1,595

    Well a 1 minute video can have around 1000 frames so that should give you and idea, and that's at 30fps..

    I don't know how long it will take to do 1000 http.request calls

  • edited July 2013 Posts: 391

    I was thinking of only doing 5-10 fps. I am going to test it with a 10 sec video, so 50 to 100 images shouldn't be too bad, but a 1 min or longer video would still be crazy, lol.

    Edit: the sample php code I found actually recommends doing only 3 fps, hehe. This would make for a very choppy looking video, but a video nonetheless.

  • edited July 2013 Posts: 2,820

    There's been discussion already on the forums about this. I'll see if I can find it.
    Edit: Urg, I can't find the one with the good answer, but here's one of the threads:
    http://twolivesleft.com/Codea/Talk/discussion/1785/is-there-any-way-to-insert-a-video-into-my-program/p1

  • Posts: 2,820

    Anyways, just look at this thread on GameSalad (I don't know why I ever used it). http://forums.gamesalad.com/discussion/comment/313353/

  • Posts: 391

    @Zoyt, I've seen the threads similar to the ones you linked. I know how to show a movie using a sequence of frames stored as images. I am trying to create the frame images on the fly, so you simply use an actual video file and the code on my server converts it into usable images.

    I have FFmpeg working correctly to where it can pull out specific frames, but for some reason I can't get FFmpeg to execute in php. I can use all other functions, such as cp to copy, but FFmpeg refuses to run.

    I think I may just scrap the idea since I know it will just end up causing some server issues in the long run.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @slasin8r what you could do instead of frame per frame sending, would be to build a low resolution 10x10 image from a video: then you would get a 100 images buffer to display at, say, 10 Hz? Then you have 10s to get the next image, good enough. This would be fun as a hack.

Sign In or Register to comment.