Where can I find a C/C++ FFmpeg extensive tutorial?

ticofab picture ticofab · Jul 9, 2012 · Viewed 19.9k times · Source

I want to use ffmpeg (in its c library form) to split a video in more parts, recompose them and encode the final result. Something basic. But it's very difficult to find documentation or hints about this. Where should I look/ask for advice?

Answer

LightStruk picture LightStruk · Sep 26, 2012

You can learn a great deal from the source of the command-line utilities maintained by the FFmpeg project.

In ffplay.c, the main() will show you how to get the library initialized. stream_component_open() demonstrates matching codecs to streams in the media, and get_video_frame() shows how to decode a packet and get its PTS (presentation time stamp). You'll need that to time your splits correctly.

That should get you started on the decode side. On the encode side, look at ffmpeg.c. It's larger and more complicated than ffplay, but the process of encoding a frame nearly mirrors the process of decoding it, so once you have decoding working, it should make more sense.