Sign in to follow this  

SDL: playing videos

This topic is 2047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been trying to figure out how to play videos in SDL for a while now, and I cam across libtheora for playing OGV files. I can't figure out how to use it and pipe a result to SDL. If someone could point me into the direction of a cross platform library or a tutorial for libtheora that shows how to open a file, decode it and pipe it to SDL. I've searched and searched for such a tutorial and I couldn't find one. Doing this with SDL_OpenGL would be even better. I know there's SMPEG and FFMPEG, and I've tried them, and I couldn't get them to work because of a lack of a proper tutorial. I don't care what video format I'd have to use, so long as I can convert a video into that format and keep the original quality.

Any help is appreciated.

Share this post


Link to post
Share on other sites
There's a simular topic here:
[url="http://www.gamedev.net/topic/348340-play-video-files-in-sdl/"]http://www.gamedev.net/topic/348340-play-video-files-in-sdl/[/url]

the best post in there being this:


[quote name='Drew_Benton' timestamp='1128162726' post='3282104']
I'll refer you to my new post here at [url="http://www.gamedev.net/community/forums/topic.asp?topic_id=348801"]this thread[/url], Link66.
[/quote]

Share this post


Link to post
Share on other sites
Just out of curiosity, will these videos have audio in them that you want to play as well? Do you need to be able to seek in the video, or do you just want to open and play it? It sounds like you have control over the videos, which will help [i]a lot[/i] (because two videos that appear the same can have different file contents, and playing one video correctly can be a much larger pain in the butt than the other one, depending on various factors I won't bore you with). These things have a big impact on how robust your player needs to be.

For what it's worth, I haven't ever written anything that used libtheora or libvpx. I've written a few programs that use FFmpeg to decode a video, and I'm in the process of writing a reader that reads both audio and video, so I could help with FFmpeg code if you haven't given up yet on it. I've never used SDL though, but I could tell you how to decode frames in FFmpeg, how they're represented, and how to properly copy the frame buffers to another buffer (which would probably be an SDL buffer, though I don't know SDL). Let me know if this would be useful to you or not.

As a side note, [url="http://dranger.com/ffmpeg/"]this site[/url] has a FFmpeg tutorial that creates an SDL video player. I'll be the first to warn you that the site is a bit old and some of the things they do have been deprecated, but for the most part it could help give a lot of direction.

Share this post


Link to post
Share on other sites
[quote name='falconmick' timestamp='1336478488' post='4938349']
There's a simular topic here:
[url="http://www.gamedev.net/topic/348340-play-video-files-in-sdl/"]http://www.gamedev.n...o-files-in-sdl/[/url]

the best post in there being this:


[quote name='Drew_Benton' timestamp='1128162726' post='3282104']
I'll refer you to my new post here at [url="http://www.gamedev.net/community/forums/topic.asp?topic_id=348801"]this thread[/url], Link66.
[/quote]
[/quote]
Actually I made my decision of FFMPEG because I didn't get an answer here for quite some time. And I've seen that, but the links are dead, and the example he gives is in C++.

[quote name='Cornstalks' timestamp='1336486168' post='4938380']
Just out of curiosity, will these videos have audio in them that you want to play as well? Do you need to be able to seek in the video, or do you just want to open and play it? It sounds like you have control over the videos, which will help [i]a lot[/i] (because two videos that appear the same can have different file contents, and playing one video correctly can be a much larger pain in the butt than the other one, depending on various factors I won't bore you with). These things have a big impact on how robust your player needs to be.

For what it's worth, I haven't ever written anything that used libtheora or libvpx. I've written a few programs that use FFmpeg to decode a video, and I'm in the process of writing a reader that reads both audio and video, so I could help with FFmpeg code if you haven't given up yet on it. I've never used SDL though, but I could tell you how to decode frames in FFmpeg, how they're represented, and how to properly copy the frame buffers to another buffer (which would probably be an SDL buffer, though I don't know SDL). Let me know if this would be useful to you or not.

As a side note, [url="http://dranger.com/ffmpeg/"]this site[/url] has a FFmpeg tutorial that creates an SDL video player. I'll be the first to warn you that the site is a bit old and some of the things they do have been deprecated, but for the most part it could help give a lot of direction.
[/quote]

You actually answered my question about playing videos with FFMPEG in my thread where I ended up having to use malloc on a pointer. I decided on FFMPEG once I got it to work, and this thread is from April 30th, and I got no replies until now, so I gave up and searched the net for a few hours and got FFMPEG working.

Share this post


Link to post
Share on other sites
[quote name='Spirrwell' timestamp='1336503867' post='4938460']
You actually answered my question about playing videos with FFMPEG in my thread where I ended up having to use malloc on a pointer. I decided on FFMPEG once I got it to work, and this thread is from April 30th, and I got no replies until now, so I gave up and searched the net for a few hours and got FFMPEG working.
[/quote]
Oh wow, I didn't even realize. I just saw falconmick replied today so I figured it was a new thread from today. Teach me to read the dates [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] Edited by Cornstalks

Share this post


Link to post
Share on other sites
[quote name='Cornstalks' timestamp='1336511303' post='4938482']
[quote name='Spirrwell' timestamp='1336503867' post='4938460']
You actually answered my question about playing videos with FFMPEG in my thread where I ended up having to use malloc on a pointer. I decided on FFMPEG once I got it to work, and this thread is from April 30th, and I got no replies until now, so I gave up and searched the net for a few hours and got FFMPEG working.
[/quote]
Oh wow, I didn't even realize. I just saw falconmick replied today so I figured it was a new thread from today. Teach me to read the dates [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
[/quote]

Nah, it's fine, I just didn't expect to get a reply. I've asked other questions before and have gotten no reply. Thank you all the same.

Share this post


Link to post
Share on other sites

This topic is 2047 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this