I'm working on wrapping libavcodec up to build a prototyping framework that I can use to easily play around with real-time video post-processing, and I'm at the point where I'm just trying to get a simple video playing. I've been following the tutorials at:
http://www.dranger.com/ffmpeg/ And I'm breaking packets out and decoding them (video only ATM), and successfully displaying them on the screen. However, I noticed the video looked "sluggish", so I used VLC to play a second copy alongside and sure enough they were quickly out of sync (VLC played noticeable faster). Looking at the PTS values I'm getting out: Init PTS: 27028.000000 Time Base: 0.016683 Sending PTS: 450.917133 Init PTS: 30031.000000 Time Base: 0.016683 Sending PTS: 501.017183 Init PTS: 33034.000000 Time Base: 0.016683 Sending PTS: 551.117233 Init PTS: 36037.000000 Time Base: 0.016683 Sending PTS: 601.217283 Init PTS: 39040.000000 Time Base: 0.016683 Sending PTS: 651.317333 Init PTS is the pts from this code: <snip> avcodec_decode_video2(video_codec_ctx_, p_frame, &frame_finished, &packet); // Try grabbing DTS from packet if ((packet.dts == AV_NOPTS_VALUE) && (p_frame->reordered_opaque != AV_NOPTS_VALUE)) { pts = p_frame->reordered_opaque; } else if (packet.dts != AV_NOPTS_VALUE) { pts = packet.dts; } else { pts = 0.0; } <snip> The "Sending PTS" is PTS*time_base As you can see, it looks like the PTS values are separated by roughly 50ms, which seems quite high since this particular video stream is 29.97 fps, I'd expect the PTS values to be roughly 34 ms apart. So I guess my question is what exactly is the relationship between the PTS values and the time I should display frames on screen? _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
