[Libav-user] Problem while developing with libav and C++

Gianluca Montecchi gianlum at gmail.com
Thu Aug 5 11:05:50 EEST 2021

 Hi guys,
I am having some trouble working with the ffmpeg's API while porting from
the 0.6 version (32 bit) to the 4.x (both 4.3.2 and 4.4) version 64 bit. (I
know, big leap, but nothing I can do about it :-( )

Specifically, I am having trouble with the MDAT atom, which as I understand
should be written by the *av_write_trailer *function and should indicate
the size of the video data. Conseguentely I fail to write the MOOV atom and
the file is unreadable.

Some context: the file is streamed from a proprietary server and it is
played in the application (this part works).
While streaming I also save it to a file with *av_read_frame/av_write_frame*
functions after having called *avformat_write_header*. When I write the
last frame I call the *av_write_trailer *function and close all the
After that, using the (modified version of) qt-faststart tool I try to move
the MOOV atom at the beginning, to write a cached file which can be played
without the need to stream it again, but I get the first 4 bytes of the
MDAT atom filled with 0's, which indicate that the MDAT size is 0, while
the file in this case is little more 100 Mb, so I expect a size of about
100 Mb.
At this point the program enter in a infinite loop, reading continuously
the MDAT atom.

I tried to debug the code in parallel with the version which work (ffmpeg
0.6 32 bit) and it seems that they do the same things at every step, aside
the modifications I needed to compile with the new version. No call to the
library functions return an error, which is what it is baffling me.

Any idea about what can be the problem ?
Or, if this is not the right place to ask, any pointer to some
documentation (aside the official's one that I have already combed through)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210805/093e82cb/attachment.htm>

More information about the Libav-user mailing list