Chapter-indexing can be expensive since chapters may be interspersed throughout the entire file and may require many seeks - especially costly when consuming a video over a remote protocol like http. Furthermore it is often unnecessary, especially when only trying to get video info (e.g. via ffprobe). --- libavformat/isom.h | 1 + libavformat/mov.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/libavformat/isom.h b/libavformat/isom.h index dba30a2..a082e40 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -190,6 +190,7 @@ typedef struct MOVContext { int chapter_track; int use_absolute_path; int ignore_editlist; + int ignore_chapters; int seek_individually; int64_t next_root_atom; ///< offset of the next root atom int export_all; diff --git a/libavformat/mov.c b/libavformat/mov.c index 11c8358..9ed1cb0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -454,6 +454,9 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) char str[256+1]; int ret; + if (c->ignore_chapters) + return 0; + if ((atom.size -= 5) < 0) return 0; @@ -4627,7 +4630,7 @@ static int mov_read_header(AVFormatContext *s) av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); if (pb->seekable) { - if (mov->chapter_track > 0) + if (mov->chapter_track > 0 && !mov->ignore_chapters) mov_read_chapters(s); for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->codec->codec_tag == AV_RL32("tmcd")) @@ -5038,6 +5041,8 @@ static const AVOption mov_options[] = { 0, 1, FLAGS}, {"ignore_editlist", "", OFFSET(ignore_editlist), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, + {"ignore_chapters", "", OFFSET(ignore_chapters), AV_OPT_TYPE_BOOL, {.i64 = 0}, + 0, 1, FLAGS}, {"use_mfra_for", "use mfra for fragment timestamps", OFFSET(use_mfra_for), AV_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO}, -- 1.7.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel