<div dir="ltr">Coming back to this issue, I have tested 2 scenarios<div><br></div><div>a. I am simply setting pts to the timestamp received from encoder and dts to 0 but the resulting file is showing very large frame rate value.</div>

<div><br></div><div>b. Setting pts to the timestamp received from encoder but this time setting dts with an increment of 1001 starting from -1001 (2002/-1001, 0/0, 1001/1001, 5005/2002, 3003/3003). The framerate is correct this time but the quicktime player displays a white frame at the start of the movie. I investigated this issue further by using libav demuxer sample and the pts/dts have been changed from what I set and start_time is also not 0. VLC plays fine but I also want Quicktime player to play the file normally as well.<br>

</div><div><br></div><div>The movies created by the software which ships with he encoder shows correct frame rate and start time of 0, also the pts/dts investigated with the demuxing sample are in the same sequence as described in the second scenario.</div>
<div><br></div><div>I really need to understand why my pts/dts are changed by the muxer to different values, may be it is trying to guess correct values based on the inputs I provided. Which inputs matter in this kind of scenarios and how they relate to each other?</div>
<div><br></div><div>Thanks in advance</div><div>Nisar</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 17, 2013 at 11:05 AM, Nisar Ahmed <span dir="ltr"><<a href="mailto:nisar.med@gmail.com" target="_blank">nisar.med@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for your answer, when I set timestamp of decoder, the frame rate jumps up to a very large value<div>
<br></div><div><span style="font-family:arial,sans-serif;font-size:13px">pts/dts = (2002/0, 0/0, 1001/0, 5005/0, 3003/0...)</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">am I setting the time_base to correct values 1001/30000 and pkt.duration = 1001? the timescale of the timestamp is also 30000</span></div>

</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 17, 2013 at 2:10 AM, Anshul maheshwari <span dir="ltr"><<a href="mailto:er.anshul.maheshwari@gmail.com" target="_blank">er.anshul.maheshwari@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>-</p><div><div><br>
On Aug 16, 2013 7:30 PM, "Nisar Ahmed" <<a href="mailto:nisar.med@gmail.com" target="_blank">nisar.med@gmail.com</a>> wrote:<br>
><br>
> I am muxing h264/aac stream to mp4 coming from an encoder and having issues syncing audio and video streams.<br>
><br>
> I suspect that the problem is with PTS and DTS but I am not sure what values should i set to properly sync both streams.<br>
><br>
> I have set the time_base of video stream's AVCodecContext to 1001/30000 and each AVPacket gets a duration of 1001<br>
><br>
> I am recieving time stamps from the encoder with each NAL packet which is set as PTS of the AVPacket. the sequence of PTS/DTS I set is (2002/0, 0/1001, 1001/2002, 5005/3003, 3003/4004...)<br>
><br>
> Audio stream AVCodecContext sample rate is 48000 and PTS/DTS are simply multiples of 1024 starting from 0 and AVPacket duration is 1024.<br>
><br>
> The output movie 's frame rate is 20fps when it should be 29.97fps as it is ntsc.<br>
><br>
> Please tell me how to debug this problem and what are the guidelines of creating pts/dts for both video and audio in my case<br>
><br></div></div>
> _______________________________________________<br>
> Libav-user mailing list<br>
> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
><br>
Hi naseer<p></p>
<p>If you are getting timestamp with encoder,  i would suggest "dont try to manuplate that" you may set that same timestamp as presentation timestamp (pts) if your video is realtime then try not to generate B type video frame hence no need to set dts.<br>



Whatever clock is set by encoder try generating the pts of audio according to that.</p>
<p>@enjoy<span><font color="#888888"><br>
Anshul</font></span></p>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>