Hi Pierre,

> I was using a 2009 version of FFmpeg source code for encoding some movies in
> x264.

Try getting a newer one. 

> Recently I installed a new svn version of FFmpeg (r26402) and I come through
> problems i didn't have before with the same sample code.
> 
> av_interleaved_write_frame() prints
> [libx264 @ xxx....] non-strictly-monotonic PTS
> for each frame i try to encode.

I know this problem. The reason is, that you did not send a correct pts to the 
function av_interleaved_write_frame(). If you want to encode a picture and get 
rid of those messages, you have to calculate a correct pts and dts.

> And time to time av_interleaved_write_frame() return a negative value
> meaning  error while writting frame and  crash my code.
> When the encoding finishes well, i read my video on vlc and i notice its
> start with a a quality ok and then  the quailty goes down.
> The same sample code was encoding pretty well on the previous version of
> ffmpeg.
> Anyone knows what is happening?
> 
> indications:
> c->time_base.den = 10;
> c->time_base.num =1;
> c->gop_size =12;

mmh. Which framerate do you want to have? 10 fps? If yes, then your settings 
are ok. But this is unusual. Normaly are 24, 25 or 30 fps are used. This is a 
important decision and direct conected with the calculation of a pts! Anyway. 
Here an example for you:

c->time_base.den = 25;
c->time_base.num=1;

(and for h.264 then)
c->gop_size=25;

A framerate of 25 frames per second means, that one frame plays 40ms. Because a 
second are 1000 milli sec. If you play 25 frames per seconds, then one frame 
needs 1000/25 = 40 ms. To get a correct PTS you have to know, that a PTS is 
scaled with 90 kHz. A valid sequence of PTS are:

Frame:                  1.              2.              3.              4.      
        5.              6.              7.              8.
Time:                   40 ms   80 ms   120 ms  160 ms  200 ms  240 ms  280 ms  
320 ms ...
PTS (time*90)           3600    7200    10800   ...

So. You have to give every AVFrame before encoding a correct PTS like above. 
After the encoding process, don't wonder, the order is a different one. Thats 
because every frames will saved in decoding order. 

> 
> I don't really know how PTS works i've put 1/fps for the AVPacket pts.

Try above ones.

> 
> Thanks
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to