<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 Gonzalo, 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);">
thanks for pointing out what I did wrong. I now get files that are of reasonable sizes 20 MB, something that one would expect. I have added the .h and .cpp file that I have modified according to your feedback and I have also added the .h file for the image
 class. But the generated videofiles that I get can not be read by VLC or any other application. </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
When I run "ffmpeg.exe -v error -i c:\tmp\myVideo.mp4 -f null - >error.log 2>&1 " , I get the following error lines multiple times :</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);">
[h264 @ 05c0c780] No start code is found.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
[h264 @ 05c0c780] Error splitting the input into NAL units.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Error while decoding stream #0:0: Invalid data found when processing input<br>
</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 also attached a debug output file that is created by my C++/Qt application in which you'll see which images are send to the encoder. What I don't understand is that the first 26 frames are send to the encoder but not written to the file, I know that
 the H264 needs some frames before it starts encoding but I would like those frames to be written to the videofile as well. </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);">
Your help is greatly appreciated. </div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Van:</b> Libav-user <libav-user-bounces@ffmpeg.org> namens Gonzalo Garramuño <ggarra13@gmail.com><br>
<b>Verzonden:</b> maandag 22 februari 2021 17:55<br>
<b>Aan:</b> libav-user@ffmpeg.org <libav-user@ffmpeg.org><br>
<b>Onderwerp:</b> Re: [Libav-user] help needed on "Encoding .png images with h264 to a file on disk"</font>
<div> </div>
</div>
<div style="background-color:#FFFFFF">
<p><br>
</p>
<div class="x_moz-cite-prefix">El 22/2/21 a las 05:25, laddoe escribió:<br>
</div>
<blockquote type="cite"><style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
can anybody please help me with my post of 2 days ago, I'm really stuck but not able to understand what is wrong. I have also tried several different code examples but it all ends up the same as mentioned in the post. Am I not understanding this ? Are my expectations
 of the results incorrect? I'm new to this so please bear with me. </div>
<br>
</blockquote>
<p><br>
</p>
<p>One thing that is wrong in your code is that you never call av_write_trailer(), which should be called before avio_close().</p>
<p>Also, there's no need for m_file in your code.  avformat handles the file for you.</p>
<p>Other things are hard to say, as you don't provide the code to the Image or cv::Mat classes.  You should provide a self-compilable example for us to help you.<br>
</p>
</div>
</body>
</html>