[Libav-user] Extract Intra-frames from stream video without installing ffmpeg

Eric Lee erclee2 at gmail.com
Thu Dec 15 02:05:41 EET 2016


On Wed, Dec 14, 2016 at 4:20 AM, Gabriele Giusti <gabrielegiusti90 at gmail.com
> wrote:

> Good morning,
> we are two italian master thesis students of the Faculty of Engineering of
> Florence. We want to ask you a question about the use of the FFMPEG library.
> Our purpose is to extract intra-frames from a video MPEG4 and trasform
> these frames in JPEG images. We know the following command line: *ffmpeg
> -i input.flv -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync vfr
> thumb%04d.png*
> but we have 2 main problems:
>
> -We are working on an embedded system and for this we can't install the
> FFMPEG library.
> -We have to extract a I-frame every second from a video that is not fully
> created because stream video is builded in real time. Therefore we must
> capture the last I-frame that it's been created.
>
> In our opinion to solve these problems, we need an help on which specific
> functions and source files we must use. So we can include these functions
> directly in our project. Thanks for support,
>
> Best Regards,
> Federico Contini
> Gabriele Giusti
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
The FFmpeg command line tools are built using the libav* C libraries (you
can download from the FFmpeg website). You could use these libraries to
decode the video and convert the I-frames to JPEG images yourselves.
I believe you would need libavformat (demux stream), libavcodec (decode
frames), libswscale (convert frames to JPEG) and probably libavutil (helper
utilities).

Your program might look something like this:
- Initialize AVFormatContext and open your video stream.
- Initialize AVCodecContext with proper AVCodec for your video stream type.
In Loop
- Demux chunks of video stream using av_read_frame().
- Decode AVPackets from 3. into AVFrames using
avcodec_send_packet()/avcodec_receive_frame()
- Check AVFrame type using AVFrame->key_frame or AVFrame->pict_type field
- If I-frame, initialize a proper SwsContext and use sws_scale() to convert
frame data into JPEG data.

Good luck,
Eric Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20161214/25545645/attachment.html>


More information about the Libav-user mailing list