<div dir="ltr"><div class="gmail-content" style="display:block"><p>Hi!<br></p><p>I'm getting closer to create an animated GIF using a (Qt) QImage array as input. <br></p><p>This is the latest GIF file I could create -> <a href="http://maefloresta.com/tmp/test.gif" rel="nofollow">http://maefloresta.com/tmp/test.gif</a><br>
</p><p>Using this method as part of the process, I insert every frame into the GIF file:</p>
<pre class="gmail-markdown-highlight"><code class="gmail-hljs gmail-objectivec">writeVideoFrame(AVFormatContext *oc, AVStream *video_st, const QImage &image) <br>{<br> QImage img = image.convertToFormat(Format_RGB888);
<span class="gmail-hljs-built_in"> AVPacket</span> pkt;
av_init_packet(&pkt);
pkt.flags |= <span class="gmail-hljs-built_in">AV_PKT_FLAG_KEY</span>;
pkt.stream_index = video_st->index;
pkt.data = (uint8_t *) img.bits();
pkt.size = <span class="gmail-hljs-keyword">sizeof</span>(<span class="gmail-hljs-built_in">AVFrame</span>);
av_write_frame(oc, &pkt);
frameCount++;<br>} <br></code></pre>
<p>As you can see it, the GIF file is not animated. Just the first frame
is displayed, but the picture encoding is accurate. I was sneaking around
inside the container using an hex editor and the 15 frames I created for that example are
there. I am missing some kind of flag or instruction to activate the
animated format.</p>
<p>Any suggestion?</p>
<p>PS: I tried to use the function <strong>avcodec_encode_video2()</strong> to add the frames into the file, but it was unsuccessful. Creating my own packets (AVPacket) was the best approach for now.</p>
</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-14 18:58 GMT-05:00 Carl Eugen Hoyos <span dir="ltr"><<a href="mailto:ceffmpeg@gmail.com" target="_blank">ceffmpeg@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">2017-02-14 21:09 GMT+01:00 Malik Jahanzeb <<a href="mailto:malikjahanzeb7@gmail.com">malikjahanzeb7@gmail.com</a>>:<br>
<br>
> I needed a different muxer for my program but I couldn't find an example to<br>
> follow.<br>
<br>
</span>Did you look into doc/examples?<br>
<span class="HOEnZb"><font color="#888888"><br>
Carl Eugen<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">============================<br> Gustav Gonzalez<br> <a href="mailto:xtingray@gmail.com" target="_blank">xtingray@gmail.com</a><br>============================</div>
</div>