[FFmpeg-user] trouble with AVChapter
steve.dibb at gmail.com
Wed Nov 25 23:43:53 EET 2020
On Wed, Nov 25, 2020 at 4:32 AM Pavel Koshevoy <pkoshevoy at gmail.com> wrote:
> On Wed, Nov 25, 2020, 00:01 Steve Dibb <steve.dibb at gmail.com> wrote:
> > Hey there,
> > So I'm creating an MP4 file, and testing setting some chapters, and
> > into two problems.
> > 1. The chapter ranges are wrong -- in the example below, they should all
> > one second apart, but the first chapter gets set to 0 to 4 seconds, then
> > the ones in the middle have no range, of 4 seconds to 4 seconds, and the
> > last chapter's range is 4 seconds to 5 seconds.
> > 2. The chapter titles are all set to the last metadata entry for title
> > given
> > Here's some sample, simplified code:
> > unsigned int num_chapters = 5;
> > unsigned int chapter_ix = 0;
> > unsigned char chapter_title;
> > memset(chapter_title, '\0', 80);
> > AVChapter *chapter = calloc(1, sizeof(AVChapter));
> > chapter->time_base.num = 1;
> > chapter->time_base.den = 1000;
> The above 3 lines should be inside the for-loop, otherwise your chapters
> array will have 5 entries all pointing to the same AVChapter.
That was it, thank you!!
More information about the ffmpeg-user