Set up packet duration correctly when encoding using FFmpeg (#2588).
authorCarl Hetherington <cth@carlh.net>
Thu, 24 Aug 2023 13:44:32 +0000 (15:44 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 26 Aug 2023 08:23:21 +0000 (10:23 +0200)
commitd33678b8e64de795becd3fa336dbbb099c691f58
treeb59ab213687d29183eef464881ac4ee0b01d980f
parentef72505c60da17a67b7ea1ea914290fd204d29bd
Set up packet duration correctly when encoding using FFmpeg (#2588).

It seems strange that this is necessary (maybe I'm missing some
other way that the packet duration is supposed to be set up).

Without this, when the mov muxer writes the trak tags it uses an
incorrect length value because the length value is calculated
from trk->end_pts, which in turn is calculated from the last-seen
pts + the duration of the last packet.  If that packet is marked
as length 0 the length of the track is 1 frame short, so the export
is missing a frame.
run/tests
src/lib/ffmpeg_file_encoder.cc
test/ffmpeg_encoder_test.cc