You can learn a lot from the source of the command line utilities supported by the FFmpeg project.
In ffplay.c, main () will show you how to initialize the library. stream_component_open () shows the matching codecs with the streams on the media, and get_video_frame () shows how to decode the packet and receive its PTS (presentation timestamp). You will need time to get your cleavage right.
This should help you get started with decoding. On the encoding side, see ffmpeg.c . It's bigger and more complicated than ffplay, but the frame encoding process almost reflects the decoding process, so when you work with decoding, it should make more sense.
Lightstruk
source share