[Libav-user] help needed on "Encoding .png images with h264 to a file on disk"
laddoe
xyfix at hotmail.com
Thu Feb 25 16:07:09 EET 2021
Hi Gonzalo, all,
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.
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 :
[h264 @ 05c0c780] No start code is found.
[h264 @ 05c0c780] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
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.
Your help is greatly appreciated.
________________________________
Van: Libav-user <libav-user-bounces at ffmpeg.org> namens Gonzalo GarramuƱo <ggarra13 at gmail.com>
Verzonden: maandag 22 februari 2021 17:55
Aan: libav-user at ffmpeg.org <libav-user at ffmpeg.org>
Onderwerp: Re: [Libav-user] help needed on "Encoding .png images with h264 to a file on disk"
El 22/2/21 a las 05:25, laddoe escribiĆ³:
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.
One thing that is wrong in your code is that you never call av_write_trailer(), which should be called before avio_close().
Also, there's no need for m_file in your code. avformat handles the file for you.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210225/3406a674/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: moviecodec.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210225/3406a674/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: moviecodec.cpp
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210225/3406a674/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: image.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210225/3406a674/attachment-0001.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debugOutput.txt
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210225/3406a674/attachment.txt>
More information about the Libav-user
mailing list