🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Updates to Lesson 35 for Linux, libavcodec

Started by
1 comment, last by sorceror 17 years, 7 months ago
I needed to display some odd video files in OpenGL, and found "Lesson 35" extremely helpful, of course, along with the example Linux code. I've updated that code to use the ffmpeg "libavcodec" library, so now it can play essentially any media format and codec that ffmpeg supports, which is quite a few. I've tested it on AVI, MPG, MOV, WMV, ASF, FLV, and - my target - SMK (the old Smacker video used in a lot of games). Also, I found a bug in the existing Linux example code - when it's figuring out how to size the texture, it essentially never chooses more than 512 for a width or height, even if the video is larger. I think this: if (width > 256) TEX_WIDTH = 512; else if (width > 512) TEX_WIDTH = 1024; else if (width > 1024) TEX_WIDTH = 2048; Should be: if (width > 1024) TEX_WIDTH = 2048; else if (width > 512) TEX_WIDTH = 1024; else if (width > 256) TEX_WIDTH = 512; How can I submit at least a patched version of the old Linux code, and hopefully my lavc version as well?
Advertisement
I suggest you make a "find power of 2" function instead, and use that to size up the texture instead based on the movie size.

As for using ffmpeg, I would suggest against using it unless you 1) only plan to release your application/code free of charge and not make any money from it, 2) Plan to pay organizations like MpegLA for rights to use various codecs, or 3) are doing this only for learning, or a personal project that will never be shared. Or else, Codec patent holders are notorious for going after payments ;)
Quote: Original post by pjcast
I suggest you make a "find power of 2" function instead, and use that to size up the texture instead based on the movie size.


For a real project, certainly - for example code, I don't know if it's really worth it. Even HD video isn't bigger than 2048x2048 (yet).

Quote: As for using ffmpeg, I would suggest against using it unless you 1) only plan to release your application/code free of charge and not make any money from it


I'm adding support for the in-game movies to the Linux port of the old "Aliens versus Predator" game. Moneymaking is... er... unlikely in this case. I'm just learning how to do this sort of thing here (next up: extracting the audio stream from the movie and playing it via OpenAL) and I thought a few others might find it useful.

This topic is closed to new replies.

Advertisement