[Ffmpeg-devel] creation file - video stream with no constant duration

yvan.eliebo at free.fr yvan.eliebo
Thu Jun 8 17:16:39 CEST 2006


I want to record an audio/video stream received in RTP packet with libavformat
and libavcodec.
But when I play the recorded file with QuickTime, audio and video are not
synchronized because the audio duration is bigger than video duration.

For example, I record a 3gp file with amr-nb and h263. All the duration of each
audio stream are constant (timestamp in rtp is increased by 160) but the
duration of each video stream are not constant (most of time, timestamp in rtp
duration is increased by 3600 but sometime it is increased by 7200).
When I analyse the 3gp file, the stts box indicates that all the video stream
have the same duration : 3600. I expected to have several entry_count in stts
or a ctts box.  By reading movenc.c, I notice that I can only create one
entry_count in stts box and I can not create ctts box.
I have the same problem with avi file (g711, H263). But I do not known how to
analyse avi file.

Do you have an explanation ?
Does it mean that I can only record stream which have constant duration ?

For recorded the frame, I use the following code :

pktRecord.data = (uint8_t*)&dataFrame;
pktRecord.size = dataFrameSize;
lv_pktRecord.pts  = ptsVideo;  (ptsVideo+=1 when timestamp is 3600, ptsVideo+=2
when timestamp is 7200)
videoStream->codec->time_base.num=ov_diffTimestamp;  (ov_diffTimestamp is equal
to 3600 or 7200)


Thanks you in advance.



More information about the ffmpeg-devel mailing list