Hi, I have an application that gets H264 frames and int64 timestamp in nanoseconds then writes these frames into a mp4 file in real time using av_interleave_write_frame.
How do you set pkt.dts and pkt.pts value correctly in this situation? I've seen examples divide by a timebase, however my frames do not arrive at exactly spaced time intervals so knowing the fps in advance is impossible. Through experimentation, I found setting the values to the following produces the video that looks OK when viewed in VLC. pkt.dts = av_rescale(timestamp, 1, 65104); pkt.pts = AV_NOPTS_VALUE; I'm not sure of the significance of the 65104 value I used to rescale with. I've read that the inherent timebase is 90000 for mp4, but using this value produces videos that playback quicker than real time. Even though viewing in VLC is fine, I've noticed that playing the video in Chrome web browser makes the replay display frames in the wrong order. Is this is because I have set pts to AV_NOPTS_VALUE (I, B, and P frames need to be ordered correctly)? Thanks, William _______________________________________________ libav-api mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-api
