<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Richard, 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 tried what you suggested,  to send a NULL frame to flush the decoder,  but I couldn't reset the codec anymore to accept the incoming frames again, I tried using with avcodec_flush_buffers(). </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
So I ended up resending my first frame (most important registration frame of my algorithm)  in a while loop until  I don't receive EAGAIN as return code. </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Apart from that everything is the same and I send the next frames as mentioned in my previous mail. But there are still some issues when I play the movie in VLC or so. The movie is not 5 seconds, what I expected after sending ( 120 frames at 24 fps ). Can you
 or anyone else answer the following questions, please? </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<ol>
<li><span>Why is it that if I use intra frame encoding the decoder buffers the images first? it only needs one frame for encoding that frame,right?  </span></li><li><span>Is my solution of sending the first frame multiple times a good solution from your expert point of view </span></li><li><span>Why is the movie playing so fast and not for 5 seconds? If I use ffprobe.exe to analyze this movie I see that the frame rate is 297.37 and not 24. </span></li></ol>
<div><span>Thank you in advance</span></div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Van:</b> Libav-user <libav-user-bounces@ffmpeg.org> namens Richard Hussong <rhussong@westpond.com><br>
<b>Verzonden:</b> donderdag 29 april 2021 06:14<br>
<b>Aan:</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user@ffmpeg.org><br>
<b>Onderwerp:</b> Re: [Libav-user] H264 intra frame coding</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Tue, Apr 27, 2021 at 4:19 PM laddoe <<a href="mailto:xyfix@hotmail.com">xyfix@hotmail.com</a>> wrote:<br>
</div>
<blockquote class="x_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)">
Hi there, thanks for responding but I do flush the codec in the "close()" function or is this not the correct place? </div>
</div>
</blockquote>
<div>To flush the codec, after you call avcodec_send_frame with a NULL frame you need to loop on avcodec_receive_packet until you get an AVERROR_EOF return. That will return all the queued packets in the codec.<br>
</div>
<div><br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div id="x_gmail-m_-7064768968424190646appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_-7064768968424190646divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Van:</b> Libav-user <<a href="mailto:libav-user-bounces@ffmpeg.org" target="_blank">libav-user-bounces@ffmpeg.org</a>>
 namens Richard Hussong <<a href="mailto:rhussong@westpond.com" target="_blank">rhussong@westpond.com</a>><br>
<b>Verzonden:</b> dinsdag 27 april 2021 18:47<br>
<b>Aan:</b> This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <<a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a>><br>
<b>Onderwerp:</b> Re: [Libav-user] H264 intra frame coding</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr"><br>
</div>
<br>
<div>
<div dir="ltr">On Sun, Apr 25, 2021 at 8:15 PM laddoe <<a href="mailto:xyfix@hotmail.com" target="_blank">xyfix@hotmail.com</a>> wrote:<br>
</div>
<blockquote 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)">
Hello, </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'm trying to use h264 with intra frame coding, but I can't seem to understand why my code isn't fully working. I can see that the first 13 frames aren't written to the file while all the other frames are. I have 120 images that needs to be encoded of which
 the first one is very important because it's a registration image. I understand that the first few frames send to the encoder will be buffered and as soon as a frame is available it can  be written, as I have done in my code. But how can I make sure that the
 buffered frames are written as well? </div>
</div>
</blockquote>
<div>I don't see why the first few frames aren't written, but it looks as though you aren't flushing the codec by sending a null frame at the end. This would cause the last few buffered frames not to be written. Not the same problem, but a problem nonetheless.</div>
<div><br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr"></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".<br>
</blockquote>
</div>
</div>
</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".<br>
</blockquote>
</div>
</div>
</div>
</body>
</html>