<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi,</div><div><br></div><div>Thanks for your quick reply. <span style="line-height: 1.7;">I have another related question.</span></div><div><br></div><div>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.</div><div><br></div><div>Are those packets with negatvie pts/dts useful in audio decoding process? <span style="line-height: 1.7;">Can I discard those packets with negative pts/dts?</span></div><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br></div><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><span style="line-height: 23.8px;">I want to mux video and audio streams into one mp4 file, but </span><span style="line-height: 23.8px;">there are several audio packets with negtive pts/dts at the beginning, and pts/dts of video packets start from 0. </span><span style="line-height: 23.8px;"> H</span><span style="line-height: 23.8px;">ow to put those packets with negtive pts/dts into mp4 file?</span></div><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><br></div><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><span style="line-height: 1.7;">Thanks!</span></div><div><br></div><div>B.R.</div><div><br></div><div>Andrew</div><br><br><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><br><pre><br>At 2015-10-09 16:49:57, "Hendrik Leppkes" <<a href="mailto:h.leppkes@gmail.com">h.leppkes@gmail.com</a>> wrote:
>On Fri, Oct 9, 2015 at 7:53 AM, qw <<a href="mailto:applemax82@163.com">applemax82@163.com</a>> 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
><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
>http://ffmpeg.org/mailman/listinfo/libav-user
</pre></div><br><br><span title="neteasefooter"><p> </p></span></div><br><br><span title="neteasefooter"><p> </p></span>