<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Dec 14, 2016 at 4:20 AM, Gabriele Giusti <span dir="ltr"><<a href="mailto:gabrielegiusti90@gmail.com" target="_blank">gabrielegiusti90@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">Good morning,</span><div style="font-size:12.8px">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.</div><div style="font-size:12.8px">Our purpose is to extract intra-frames from a video MPEG4 and trasform these frames in JPEG images. We know the following command line: <span style="background-color:rgb(247,247,247);color:rgb(0,0,0);font-size:13px"><i>ffmpeg -i input.flv -vf "select='eq(pict_type,PICT_TYP<wbr>E_I)'" -vsync vfr thumb%04d.png</i></span></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)">but we have 2 main problems:</span></font></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)"><br></span></font></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)">-We are working on an embedded system and for this we can't install the FFMPEG library.</span></font></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)">-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.</span></font></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)"><br></span></font></div><div style="font-size:12.8px"><font color="#000000"><span style="background-color:rgb(247,247,247)">In our opinion to solve these problems, we need an help on which specific functions and </span></font><span style="background-color:rgb(247,247,247);color:rgb(0,0,0)">source files we must use. So we can include these functions directly in our project. </span>Thanks for support,</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Best Regards,</div><div style="font-size:12.8px">Federico Contini</div><span class="gmail-HOEnZb"><font color="#888888"><div style="font-size:12.8px">Gabriele Giusti</div></font></span></div>
<br>______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/<wbr>listinfo/libav-user</a><br>
<br></blockquote></div><br></div><div class="gmail_extra">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. </div><div class="gmail_extra">I believe you would need libavformat (demux stream), libavcodec (decode frames), libswscale (convert frames to JPEG) and probably libavutil (helper utilities).</div><div class="gmail_extra"><br></div><div class="gmail_extra">Your program might look something like this:</div><div class="gmail_extra">- Initialize AVFormatContext and open your video stream.</div><div class="gmail_extra">- Initialize AVCodecContext with proper AVCodec for your video stream type.</div><div class="gmail_extra">In Loop</div><div class="gmail_extra">- Demux chunks of video stream using av_read_frame().</div><div class="gmail_extra">- Decode AVPackets from 3. into AVFrames using avcodec_send_packet()/avcodec_receive_frame()</div><div class="gmail_extra">- Check AVFrame type using AVFrame->key_frame or AVFrame->pict_type field</div><div class="gmail_extra"><font color="#000000" face="roboto, sans-serif"><span style="font-size:14px">- If I-frame, initialize a proper SwsContext and use sws_scale() to convert frame data into JPEG data.</span></font></div><div class="gmail_extra"><font color="#000000" face="roboto, sans-serif"><span style="font-size:14px"><br></span></font></div><div class="gmail_extra"><font color="#000000" face="roboto, sans-serif"><span style="font-size:14px">Good luck,</span></font></div><div class="gmail_extra"><font color="#000000" face="roboto, sans-serif"><span style="font-size:14px">Eric Lee</span></font></div></div>