[FFmpeg-devel] In a stream, is there a way to wait some time before playing next packet after the previous one ended?

kprz kprz at o2.pl
Wed Feb 28 22:53:41 EET 2018


Hi FFmpeg team   Is there a way to force FFmpeg not to play next packet right after the previous one ended, but wait set amount of time before playing next packet instead?   Real-life example follows:  Recently I found certain IFF-files containing both audio and video data. Current releases of FFmpeg playing only one of the streams (which in itself would constitute a bug, I suppose, but it is out of scope of this post), so I decided to attempt at fixing it. Until now I was able to rewrite libavformat/iff.c to:  1. correctly identify and create both audio and video streams  2. split contents into distinct packets assigned to correct streams  3. play both streams alongside  However, one issue still remains.  Video stream in the files is, should I say, continuous. That is, video packets are decoded and played in given order, without any gaps and pauses. Thus video stream defines the duration of the clip. On the other hand, audio stream is not continuous. Instead, audio samples (sounds) are supposed to be played only at points in time defined in video frames. Most importantly, there are periods in video playback with no audio sample assigned - no audio at all should be played.  The expected result would be periods of silence between audio packets, when only video is being played. The actual result is that as soon as the playback of the file starts, all audio packets are played in correct order, but one after the other, with no pauses inbetween.   I experimented with setting audio packet pts manually, but it did not resolve the issue. The result remained the same.   Best regards   kprz


More information about the ffmpeg-devel mailing list