# Video with SDL (H264)?

**URL:** <https://discourse.libsdl.org/t/video-with-sdl-h264/13777>\
**Category:** SDL Development\
**Created:** [August 24, 2006, 10:56am UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777 "2006-08-24T10:56:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gunnar\_von\_Boehn](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/48db29/32.png) [@Gunnar\_von\_Boehn](https://discourse.libsdl.org/u/Gunnar_von_Boehn)\
**Post date:** [August 24, 2006, 10:56am UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777/1 "2006-08-24T10:56:52Z")

</div>

Hello,

I would like to play back a video with SDL.  
The video is encoded with H264.

Has someone done this before?  
Can someone be so kind to give me start  
with some example code how to do this?

Or can someone give me a example for playing back video on windows using  
a directshow filter ?

Many thanks in advance

Gunnar

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cottenceau](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/g/e19adc/32.png) [@Guillaume\_Cottenceau](https://discourse.libsdl.org/u/Guillaume_Cottenceau)\
**Post date:** [August 26, 2006, 3:52pm UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777/2 "2006-08-26T15:52:42Z")

</div>

If you can switch to mpeg1, you can try:

[http://www.lokigames.com/development/smpeg.php3On](http://www.lokigames.com/development/smpeg.php3On) 8/24/06, Gunnar von Boehn wrote:

> Hello,
> 
> I would like to play back a video with SDL.  
> The video is encoded with H264.

–  
Guillaume Cottenceau - [http://zarb.org/~gc/](http://zarb.org/~gc/)

---

<div class="post-metadata">

**Author:** ![Patrick\_McFarland](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/patrick_mcfarland/32/124_2.png) [@Patrick\_McFarland](https://discourse.libsdl.org/u/Patrick_McFarland)\
**Post date:** [August 26, 2006, 11:26pm UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777/3 "2006-08-26T23:26:05Z")

</div>

> Hello,
> 
> I would like to play back a video with SDL.  
> The video is encoded with H264.
> 
> Has someone done this before?  
> Can someone be so kind to give me start  
> with some example code how to do this?

Use ffmpeg. ffmpeg comes with a sample app that uses SDL. ffmpeg also is one  
of the best h264 decoders in existence.

> Or can someone give me a example for playing back video on windows using  
> a directshow filter ?

You don’t. That is not a portable solution. Use ffmpeg.On Thursday 24 August 2006 06:56, Gunnar von Boehn wrote:

> Many thanks in advance
> 
> Gunnar
> 
> * * *
> 
> SDL mailing list  
> SDL at [libsdl.org](http://libsdl.org)  
> [http://www.libsdl.org/mailman/listinfo/sdl](http://www.libsdl.org/mailman/listinfo/sdl)

–  
Patrick McFarland || [www.AdTerrasPerAspera.com](http://www.AdTerrasPerAspera.com)  
“Computer games don’t affect kids; I mean if Pac-Man affected us as kids,  
we’d all be running around in darkened rooms, munching magic pills and  
listening to repetitive electronic music.” – Kristian Wilson, Nintendo,  
Inc, 1989

---

<div class="post-metadata">

**Author:** ![Peter\_Mulholland](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/p/74df32/32.png) [@Peter\_Mulholland](https://discourse.libsdl.org/u/Peter_Mulholland)\
**Post date:** [August 27, 2006, 8:05am UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777/4 "2006-08-27T08:05:22Z")

</div>

Hello Gunnar,

Thursday, August 24, 2006, 11:56:52 AM, you wrote:

> Hello,

> I would like to play back a video with SDL.  
> The video is encoded with H264.

ffmpeg (specifically, libavcodec) does seem to be the best way to do  
this.

I didn’t have much luck building a stripped down version of this  
though. By default it builds with tons of codecs.

There’s also the x264 library, part of videolan, but that’s licenced  
under “all your code are belong to GNU” so it most likely isn’t  
suitable.–  
Best regards,  
Peter mailto:@Peter_Mulholland

---

<div class="post-metadata">

**Author:** ![Simon\_Roby](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@Simon\_Roby](https://discourse.libsdl.org/u/Simon_Roby)\
**Post date:** [August 27, 2006, 5:42pm UTC](https://discourse.libsdl.org/t/video-with-sdl-h264/13777/5 "2006-08-27T17:42:51Z")

</div>

Everything Patrick said is right. However, keep in mind that like  
almost all multimedia codecs out there, H264 is patent-protected and  
therefore not free to use. Unless you actually have a license to use  
it, I’d suggest you use another codec instead. There’s the old MPEG1  
codec, and also Ogg Theora which is in alpha stages but still usable.On 8/26/06, Patrick McFarland wrote:

> On Thursday 24 August 2006 06:56, Gunnar von Boehn wrote:
> 
> > Hello,
> > 
> > I would like to play back a video with SDL.  
> > The video is encoded with H264.
> > 
> > Has someone done this before?  
> > Can someone be so kind to give me start  
> > with some example code how to do this?
> 
> Use ffmpeg. ffmpeg comes with a sample app that uses SDL. ffmpeg also is one  
> of the best h264 decoders in existence.
> 
> > Or can someone give me a example for playing back video on windows using  
> > a directshow filter ?
> 
> You don’t. That is not a portable solution. Use ffmpeg.

–

- SR
