[Libav-user] dts/pts generated by aac encoder less than zero

qw applemax82 at 163.com
Fri Oct 9 14:26:11 CEST 2015


Hi,


Thanks for your quick reply. I have another related question.


If there is negative pts/dts in packet output from audio encoder, the total duration of output audio packets will be bigger than original audio duration.


Are those packets with negatvie pts/dts useful in audio decoding process? Can I discard those packets with negative pts/dts?


I want to mux video and audio streams into one mp4 file, but there are several audio packets with negtive pts/dts at the beginning, and pts/dts of video packets start from 0.  How to put those packets with negtive pts/dts into mp4 file?


Thanks!


B.R.


Andrew






At 2015-10-09 16:49:57, "Hendrik Leppkes" <h.leppkes at gmail.com> wrote:
>On Fri, Oct 9, 2015 at 7:53 AM, qw <applemax82 at 163.com> wrote:
>> Hi,
>>
>> I use avcodec_encode_audio2() to call aac encoder to compress audio.
>> AVFrame::pts is set to 0 for 1st frame, 1 for 2nd frame, 2 for 3rd frame,
>> and so on. But I find pts and dts are negtive values in 1st two output
>> packets, and 3rd packet's pts/dts is 0. Why pts and dts are less than 0 in
>> 1st two output packets?
>
>Encoders will produce negative timestamps when they have a delay.
>Otherwise they would cause A/V desync, since the audio is delayed.
>_______________________________________________
>Libav-user mailing list
>Libav-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/libav-user





 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20151009/ca7f2314/attachment.html>


More information about the Libav-user mailing list