How to Write a Video Player in Less Than 1000 Lines
2011-09-08 13:40
501 查看
http://dranger.com/ffmpeg/ffmpeg.html
ffmpeg is a wonderful library for creating video applications or even general purpose utilities. ffmpeg takes care of all the hard work of video processing by doing all the decoding, encoding, muxing and demuxing
for you. This can make media applications much simpler to write. It's simple, written in C, fast, and can decode almost any codec you'll find in use today, as well as encode several other formats.
The only prolem is that documentation is basically nonexistent. There is a single tutorial that shows the basics of ffmpeg and auto-generated doxygen documents. That's it. So, when
I decided to learn about ffmpeg, and in the process about how digital video and audio applications work, I decided to document the process and present it as a tutorial.
There is a sample program that comes with ffmpeg called ffplay. It is a simple C program that implements a complete video player using ffmpeg. This tutorial will begin with an updated version of the original tutorial, written by Martin
Böhme (I have stolen liberally borrowed from that work), and work from there to developing a working video player, based on Fabrice Bellard's ffplay.c. In each tutorial, I'll introduce
a new idea (or two) and explain how we implement it. Each tutorial will have a C file so you can download it, compile it, and follow along at home. The source files will show you how the real program works, how we move all the pieces around, as well as showing
you the technical details that are unimportant to the tutorial. By the time we are finished, we will have a working video player written in less than 1000 lines of code!
In making the player, we will be using SDL to output the audio and video of the media file. SDL is an excellent cross-platform multimedia library that's used in MPEG playback software, emulators, and many video games.
You will need to download and install the SDL development libraries for your system in order to compile the programs in this tutorial.
This tutorial is meant for people with a decent programming background. At the very least you should know C and have some idea about concepts like queues, mutexes, and so on. You should know some basics about multimedia; things like waveforms and such, but
you don't need to know a lot, as I explain a lot of those concepts in this tutorial.
There are printable HTML files along the way as well as old school ASCII files. You can also get a tarball of the text files and source code or just
the source. You can get a printable page of the full thing in HTML or in text.
ffmpeg is a wonderful library for creating video applications or even general purpose utilities. ffmpeg takes care of all the hard work of video processing by doing all the decoding, encoding, muxing and demuxing
for you. This can make media applications much simpler to write. It's simple, written in C, fast, and can decode almost any codec you'll find in use today, as well as encode several other formats.
The only prolem is that documentation is basically nonexistent. There is a single tutorial that shows the basics of ffmpeg and auto-generated doxygen documents. That's it. So, when
I decided to learn about ffmpeg, and in the process about how digital video and audio applications work, I decided to document the process and present it as a tutorial.
There is a sample program that comes with ffmpeg called ffplay. It is a simple C program that implements a complete video player using ffmpeg. This tutorial will begin with an updated version of the original tutorial, written by Martin
Böhme (I have stolen liberally borrowed from that work), and work from there to developing a working video player, based on Fabrice Bellard's ffplay.c. In each tutorial, I'll introduce
a new idea (or two) and explain how we implement it. Each tutorial will have a C file so you can download it, compile it, and follow along at home. The source files will show you how the real program works, how we move all the pieces around, as well as showing
you the technical details that are unimportant to the tutorial. By the time we are finished, we will have a working video player written in less than 1000 lines of code!
In making the player, we will be using SDL to output the audio and video of the media file. SDL is an excellent cross-platform multimedia library that's used in MPEG playback software, emulators, and many video games.
You will need to download and install the SDL development libraries for your system in order to compile the programs in this tutorial.
This tutorial is meant for people with a decent programming background. At the very least you should know C and have some idea about concepts like queues, mutexes, and so on. You should know some basics about multimedia; things like waveforms and such, but
you don't need to know a lot, as I explain a lot of those concepts in this tutorial.
There are printable HTML files along the way as well as old school ASCII files. You can also get a tarball of the text files and source code or just
the source. You can get a printable page of the full thing in HTML or in text.
相关文章推荐
- How to Write a Video Player in Less Than 1000 Lines
- An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines
- An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines
- 如何在vim中注释掉多行(how to comment out more than one lines in vim)
- How to make an IntelliJ IDEA plugin in less than 30 minutes
- 如何在vim中注释掉多行(how to comment out more than one lines in vim)
- How to Create an Video Player in jQuery, HTML5 & CSS3
- How to write mutiple graphs in a run in tensorflow
- How to use write and run MapReduce in eclipse on windows.
- How to write a script in Linux
- How to write a simple interpreter in JavaScript
- How to read video frames in hadoop?如何在Hadoop中读取视频帧?
- Parse how to write flash in uefi shell.
- How can I force Python's file.write() to use the same newline format in Windows as in Linux (“\r\n”
- How to write a diagup line over a mathematical formula in LaTex
- How to write paper in academic conference
- scala: How to write a simple HTTP GET request client in Scala (with a timeout)
- A good blog about how to write an Hadoop MapReduce program in Python
- How to add extra harddriver, relocate /home in Ubuntu with VMWare player
- [eZ publish] When a ezxml embed an video, how to get the ezxml object in the video embed template?