An ffmpeg and SDL Tutorial

What now?

So we have a working player, but it's certainly not as nice as it could be. We did a lot of handwaving, and there are a lot of other features we could add:

If you want to know more about ffmpeg, we've only covered a portion of it. The next step would be to study how to encode multimedia. A good place to start would be the output_example.c file in the ffmpeg distribution. I may write another tutorial on that, but I might not get around to it.

UPDATE It has been a long time since I updated this, and the world of video software has gotten a lot more mature. This tutorial has only required simple API updates; very little has actually changed in terms of the basic concepts. Most of those updates have actually simplified the code. However, while I have gone through and updated the code here, ffplay still totally outperforms this toy player. Let's be frank, it's pretty unusable as an actual movie player. So if you or your future self wants to improve this tutorial, go into ffplay and find out what we're missing. My guess is it's mostly taking advantage of video hardware, but maybe I'm missing some obvious things. It's possible ffplay might have drastically changed some things; I haven't looked yet.

But I'm very proud that it has still helped a lot of people out over the years, even if you had to go get code elsewhere. My absolute gratitude to chelyaev who did the work in replacing all the functions that were deprecated since I wrote this 8 (!) years ago.

Well, I hope this tutorial was instructive and fun. If you have any suggestions, bugs, complaints, accolades, etc., about this tutorial, please email me at dranger at gmail dot com. Please do not ask me for help in your other ffmpeg projects. I get way too many of those emails.

Links:
ffmpeg home page
Martin Bohme's original tutorial
libSDL
SDL Documentation


This work is licensed under the Creative Commons Attribution-Share Alike 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.5/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.

Code examples are based off of FFplay, Copyright (c) 2003 Fabrice Bellard, and a tutorial by Martin Bohme.