ffmpeg code (API) -
i started deal ffmpeg api ( not command prompt ) build film editor, , i'm trying find tutorial how extract keyframes video, didn't find it.
someone did before , can write code here? someone has tutorial ffmpeg api?thank you!
in demuxing loop, check av_pkt_flag_key flag in avpacket::flags after calling av_read_frame() avformatcontext , confirming read packet right stream of input. example:
avpacket packet; if (av_read_frame(pformatctx, &packet) < 0) { break; } if (videostream/* e.g. 0 or 1 */ == packet.stream_index) { if (packet.flags & av_pkt_flag_key) { //do note that, in experience, need decode 2 keyframes before desired frame in order produce picture.
see doc/examples directory in ffmpeg distribution api usage examples, e.g. demuxing_decoding.c. can reference ffmpeg.c (the source of famous cli) if brave and/or have ide.
api ffmpeg
No comments:
Post a Comment