bino-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bino-list] adding chapters, skipping chapters in video files


From: Nate
Subject: Re: [Bino-list] adding chapters, skipping chapters in video files
Date: Sat, 12 Nov 2011 20:55:59 -0800 (PST)

> From: Martin Lambers <address@hidden>
> On Fri, 11 Nov 2011 11:50:41 -0800 (PST), Nate wrote:
> > > On Wed, 9 Nov  2011 18:26:36 -0800 (PST), Nate wrote:
> > > > I'm interested in   creating this feature.
> > > > Either as an external text file with  the data  that you would load
> > > > each time. or using  something like mp4box to add the  metadata
> > > > directly to  the movie file.
> > > > 
> > > > how difficult do  you  think this would be?
> > > 
> > > It should not be too diffcult.  FFmpeg already  supports chapter
> > > metadata (see the AVChapter  entries in AVFormat). You would  have to
> > > extract it and export  it from media_object/media_input to the
> > > player and user interface,  and then add controls that let the user
> > > jump  between  chapters.
> > > 
> > 
> > What's the best way to export those  values to the player UI?
> > Can I just write a getter function to pull out  the values?
> > Or is the media object already available in the UI  code?
> 
> The UI knows about the player, which in turn knows about the  media
> input.
> 
> The question is how you would like to present chapters to  the users. Do
> you just want forward/backward chapter skip buttons? Or also  e.g. a
> ComboBox that lets the user choose a chapter? Should the UI  display
> which chapter is currently active? I never saw video files  with
> chapters and have no idea how they are supposed to be  used.
> 
> Switching chapters should work through the  controller/notification
> mechanism; then we can easily add support for LIRC  remote controls and
> Equalizer in addition to the GUI.
> 
> Admittedly, this  part of the code is very ugly. It comes from a very
> early version of Bino  that did not yet have a GUI. I'm currently
> restructuring this so that adding  new features will be easier in the
> future.


Thanks for the info! I will try to conform to that model. Will probably have 
more questions for you.

I'd like forward and backward chapter skipping buttons with keyboard shortcuts.
A combo box that selects any chapter and displays the current chapter would 
also 
be good.

So far, I have extracted chapter data from a H264 file in bino. My code snippet 
from model_object and screen output is below:

    unsigned int chapter_num = _ffmpeg->format_ctx->nb_chapters;
    int timebase_num = _ffmpeg->format_ctx->chapters[0]->time_base.num;
    int timebase_den = _ffmpeg->format_ctx->chapters[0]->time_base.den;
    msg::wrn(_("number chapters: %d"),chapter_num);
    msg::wrn(_("timebase rational: %d / %d"),timebase_num,timebase_den);

    int chapter_id;
    int64_t chapter_start, chapter_end;
    for ( int i = 0 ; i < chapter_num ; i++ ) {
        chapter_id = _ffmpeg->format_ctx->chapters[i]->id;
        chapter_start = _ffmpeg->format_ctx->chapters[i]->start;
        chapter_end = _ffmpeg->format_ctx->chapters[i]->end;
        msg::wrn(_("chapter id: %d"),chapter_id);
        msg::wrn(_("chapter start: %lld"),chapter_start);
        msg::wrn(_("chapter end: %lld"),chapter_end);
        while ((tag = av_dict_get(_ffmpeg->format_ctx->chapters[i]->metadata, 
"", tag, AV_DICT_IGNORE_SUFFIX)))
        {
            msg::wrn(_("key: %s, value: %s"),tag->key,tag->value);
        }
    }


bino: [wrn] number chapters: 10
bino: [wrn] timebase rational: 1 / 25
bino: [wrn] chapter id: 0
bino: [wrn] chapter start: 0
bino: [wrn] chapter end: 375
bino: [wrn] key: title, value: Start
bino: [wrn] chapter id: 1
bino: [wrn] chapter start: 375
bino: [wrn] chapter end: 750
bino: [wrn] key: title, value: Chapter 1
bino: [wrn] chapter id: 2
bino: [wrn] chapter start: 750
bino: [wrn] chapter end: 1125
bino: [wrn] key: title, value: Chapter 2
bino: [wrn] chapter id: 3
bino: [wrn] chapter start: 1125
bino: [wrn] chapter end: 1500
bino: [wrn] key: title, value: Chapter 3
bino: [wrn] chapter id: 4
bino: [wrn] chapter start: 1500
bino: [wrn] chapter end: 1875
bino: [wrn] key: title, value: Chapter 4
bino: [wrn] chapter id: 5
bino: [wrn] chapter start: 1875
bino: [wrn] chapter end: 2250
bino: [wrn] key: title, value: Chapter 5
bino: [wrn] chapter id: 6
bino: [wrn] chapter start: 2250
bino: [wrn] chapter end: 2625
bino: [wrn] key: title, value: Chapter 6
bino: [wrn] chapter id: 7
bino: [wrn] chapter start: 2625
bino: [wrn] chapter end: 3000
bino: [wrn] key: title, value: Chapter 7
bino: [wrn] chapter id: 8
bino: [wrn] chapter start: 3000
bino: [wrn] chapter end: 3400
bino: [wrn] key: title, value: Chapter 8
bino: [wrn] chapter id: 9
bino: [wrn] chapter start: 3400
bino: [wrn] chapter end: 3401
bino: [wrn] key: title, value: End



reply via email to

[Prev in Thread] Current Thread [Next in Thread]