[Libav-user] Frames not written and incorrect pts/dts in .mp4 file

laddoe xyfix at hotmail.com
Fri May 14 23:40:15 EEST 2021


Hi all,

I'm really a bit lost and I was hoping that somebody could help me out by explaining a couple of things. With the code attached I can generate a .mp4 file and it shows the correct image if I play it in VLC, but the length of the movie is not correct. I have a camera stream that I want to capture (no sound). The first captured image is very important for my algorithm. I want to know

  1.  Because my first 13 frame were not written to the .mp4 file, I ended up sending the first frame to the encoder (addBufferFrames) until EAGAIN is not returned anymore. Is this good practice or not? and why does the encoder need those frames, I'm using intra frame compression so each frame should be encoded without any other frame, right?
  2.  Since the frame rate is 24 fps and I save 120 frames (see log.txt) I should end up with 5 secs of movie but instead it's only 4 secs if I play it in VLC


I would really appreciate it if someone could help me with this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210514/bdee9b1d/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: image.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210514/bdee9b1d/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xcodec.cpp
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210514/bdee9b1d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xcodec.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210514/bdee9b1d/attachment-0001.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xcodeclog.txt
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210514/bdee9b1d/attachment.txt>


More information about the Libav-user mailing list