<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 30, 2021 at 4:24 PM laddoe <<a href="mailto:xyfix@hotmail.com" target="_blank">xyfix@hotmail.com</a>> wrote:<br></div><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">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I know you guys are busy but can someone please  have a look at my question in the post that I did .... " Buffered encoded images not saved"</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
thank you in advance</div>
<div id="gmail-m_3804505457745095851gmail-m_3821833647753187837appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_3804505457745095851gmail-m_3821833647753187837divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Van:</b> Libav-user <<a href="mailto:libav-user-bounces@ffmpeg.org" target="_blank">libav-user-bounces@ffmpeg.org</a>> namens laddoe <<a href="mailto:xyfix@hotmail.com" target="_blank">xyfix@hotmail.com</a>><br>
<b>Verzonden:</b> donderdag 25 maart 2021 12:08<br>
<b>Aan:</b> <a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a> <<a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a>><br>
<b>Onderwerp:</b> [Libav-user] Buffered encoded images not saved</font>
<div> </div>
</div>

<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi all, </div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have an issue with the first 12 images not being saved to file. I have attached my code ( the relevant ones ) in this email, I have also attached a log file to show that the first 12 images aren't written to the file that is generated. The frame rate is 24
 fps and the recording is 5 sec, so there should be 120 frames written to the file. This can be seen in the 4th column. The lines in the log files are as follows : </div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
[cpp filename] : image num [ unique num from camera]  [temp image num for recording seq] [time in ms]</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The image class is actually a simple wrapper around  OpenCV's mat class with some addition members. The output file is around 10 MB and when I open it in VLC it doesn't run for 5 seconds but more like 1 - 2 seconds. Can anyone explain the files not written
 and the duration not being 5 secs. As you can see I have tried with  "av_interleaved_write_frame"  but that didn't help</div></div></div></blockquote><div><br></div><div>I think the problem is that you are not using the encoding interface properly. After you send a frame with avcodec_send_frame, you should loop on the result of avcodec_receive_packet until it returns AVERROR_AGAIN. Also, when you are out of frames to encode, you need to call avcodec_send_frame once more with a NULL frame pointer to put the encoder in draining mode, then receive as usual. See the ffmpeg docs at <a href="https://ffmpeg.org/doxygen/4.0/group__lavc__encdec.html">https://ffmpeg.org/doxygen/4.0/group__lavc__encdec.html</a> for further details.</div><div><br></div><div>- Richard</div><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"><div dir="ltr">
</div>
</div>

_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>
</div>