[FFmpeg-devel] NUT and no PTS

Michael Niedermayer michaelni
Tue Oct 12 11:57:25 CEST 2010

On Tue, Oct 12, 2010 at 10:30:13AM +0200, Luca Barbato wrote:
> On 10/12/2010 10:21 AM, Michael Niedermayer wrote:
>> On Tue, Oct 12, 2010 at 09:09:17AM +0200, Luca Abeni wrote:
>>> In few words, the problem happens when I try to mux an AVPacket having
>>> pts == AV_NOPTS_VALUE (see the end of this email for a way to reproduce
>>> this problem).
>>> The error is due to the check
>>> 	    if(pkt->pts<  0)
>>> 	        return -1;
>>> at line 637 of nutenc.c, which is triggered by AV_NOPTS_VALUE.
>>> So, my questions:
>>> 1) Is this a bug, or I am not supposed to pass  AV_NOPTS_VALUE as pts?
>>>     (other formats, such as MPEG TS, do not show this problem)
>> muxing packets with unknown timestamps is not supported by ffmpegs muxer API
> I thought there was some code in libavformat that tries to guess the pts  
> in a number of ways, I had been bitten by it since I was feeding it with  
> misleading data once.

There is code on the demuxer side that fills in pts that are not stored in the
file based on what the mpeg specs say. For mpeg this is exact and calling it
guessing feels insulting its not any more guessing than the IDCT is guessing
the output. If the code ends up used for non mpeg it of course can mess up

On the muxer side there is only code that fills in pts for videos that dont do
frame reordering. (this of course can mess up if you do not set the values
that muxers needs to know about frame reordering, they need them for other
reasons as well)
The reason why this code is there is historic ABI/API IIRC, its definitly needed
to supply the muxer with timestamps. nut needs pts, mpeg-ps/ts need dts for
their buffering models, mov/mp4 need both, some formats like raw need none.

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101012/3c538049/attachment.pgp>

More information about the ffmpeg-devel mailing list