[FFmpeg-devel] [PATCH] Support for variable frame duration

Henrik Gulbrandsen henrik
Fri Apr 18 07:06:00 CEST 2008

Well, time for the bug I am really trying to fix. What I have is a small
slide show generated as a set of timed JPEG images in an MP4 container.
This file should be converted to various other video formats, but FFmpeg
currently doesn't cope well with randomly varying frame durations.

The original set of test slides and Ogg Theora files generated before
and after my preliminary patch attempt are found at the following URLs:


Attached output of the mp4info and mp4videoinfo tools from MPEG4IP shows
what the slides.mov file looks like. It's exactly 24 seconds long, with
new slides appearing at 1, 2, 3, 4, 6, 8, 12, and 16 seconds. Each slide
shows the slide number and the time when it should ideally be presented.

Now, in an attempt to make a minimal patch set, I am trying to fix the
problem by hooking into the existing video synchronization code. This is
based on syncing all the way up to the next PTS, so it requires correct
duration info from the demuxer. Replacing our pts with next_pts actually
does the right thing (in terms of frame count) without other changes, so
there may potentially have been an off-by-one problem in the past...

These changes are more central, more extensive, and probably much more
controversial than my earlier patches, so feel free to flame me now! :-)
I haven't checked the regression tests either, but will be back with any
needed updates within a day or two. Right now, I have a train to catch.


-------------- next part --------------
mp4info version 1.6.1
Track	Type	Info
1	video	JPEG, 24.000 secs, 25 kbps, 320x240 @ 0.375000 fps
-------------- next part --------------
tracks 1
mp4file slides.mov, track 1, samples 9, timescale 10
sampleId      1, size  7620 time 0(0)
sampleId      2, size  7752 time 10(1000)
sampleId      3, size  8430 time 20(2000)
sampleId      4, size  8233 time 30(3000)
sampleId      5, size  8154 time 40(4000)
sampleId      6, size  8469 time 60(6000)
sampleId      7, size  8204 time 80(8000)
sampleId      8, size  9168 time 120(12000)
sampleId      9, size  9379 time 160(16000)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: video_duration.patch
Type: text/x-patch
Size: 2477 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080418/68cbb9c4/attachment.bin>

More information about the ffmpeg-devel mailing list