Discussion:
[Libav-user] Issues seeking MKV file.
Bob Kirnum
2018-09-06 15:17:30 UTC
Permalink
We use the libavformat APIs to open and read frames from various
containers. The basics work fine for MKV. However, we have encountered an
issue seeking forward. It seems the index table is populated as the file
is played. As such, the index entries beyond the current frame are not
available. Seeking forward results in seeking to a non-key-frame.

Is there any way to force the index entry table to get completely populated
with all key-frames in the Cues section?

Thanks,
Bob
Carl Eugen Hoyos
2018-09-06 16:17:18 UTC
Permalink
Post by Bob Kirnum
We use the libavformat APIs to open and read frames from various
containers. The basics work fine for MKV. However, we have encountered an
issue seeking forward. It seems the index table is populated as the file
is played. As such, the index entries beyond the current frame are not
available. Seeking forward results in seeking to a non-key-frame.
Is this reproducible with ffmpeg (the application)?
(Why not?)

Carl Eugen
Bob Kirnum
2018-09-06 17:21:27 UTC
Permalink
Hey Carl, thanks for the reply. We have an older version of the library
(with some unrelated changes) and no ffmpeg executable to match it. Is it
possible this was an issue at some point or are we not processing the file
properly? Besides reading frames when playing is there another way of
populating the index table from the Cues on demand (when a seek is
requested) or when opening the file?
Post by Carl Eugen Hoyos
Post by Bob Kirnum
We use the libavformat APIs to open and read frames from various
containers. The basics work fine for MKV. However, we have encountered
an
Post by Bob Kirnum
issue seeking forward. It seems the index table is populated as the file
is played. As such, the index entries beyond the current frame are not
available. Seeking forward results in seeking to a non-key-frame.
Is this reproducible with ffmpeg (the application)?
(Why not?)
Carl Eugen
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Carl Eugen Hoyos
2018-09-06 17:33:57 UTC
Permalink
We have an older version of the library (with some unrelated
changes) and no ffmpeg executable to match it. Is it possible
this was an issue at some point or are we not processing the
file properly?
To find out, you can either compile the ffmpeg executable for
your older library version and a current version and compare
or only compile a current library.

Please do not top-post here, Carl Eugen
Bob Kirnum
2018-09-07 12:25:52 UTC
Permalink
Apologies for top-posting, hopefully this reply is better.

I had a newer version of the FFmpeg source on a CentOS 7 image (we are
currently using libavformat 56.25.101). Added some debug to ffprobe.c and
it still shows the nb_index_entries as empty after the call to
avformat_open_input. MKVToolNix v26.0.0 indicates there are 10 entries in
the Cues section, each corresponding to a key frame as reported by ffprobe.

<<
./ffprobe ./test.mkv
ffprobe version N-85966-g78aa938 Copyright (c) 2007-2017 the FFmpeg
developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --bindir=/root/bin
--pkg-config-flags=--static --enable-gpl --enable-nonfree
--enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265
libavutil 55. 62.100 / 55. 62.100
libavcodec 57. 95.100 / 57. 95.100
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 88.100 / 6. 88.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, matroska,webm, from './test.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2avc1mp41
MAJOR_BRAND : isom
MINOR_VERSION : 512
ENCODER : Lavf57.41.100
Duration: 00:00:40.04, start: 0.000000, bitrate: 1093 kb/s
Stream #0:0: Video: vp8, yuv420p(progressive), 1280x690, SAR 1:1 DAR
128:69, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
Metadata:
HANDLER_NAME : VideoHandler
ENCODER : Lavc57.48.101 libvpx
DURATION : 00:00:40.040000000
Stream #0:1: Audio: amr_nb (8[0][0][0] / 0x0038), 8000 Hz, mono, flt,
12 kb/s (default)
Metadata:
HANDLER_NAME : SoundHandler
DURATION : 00:00:39.160000000
The debug output added.

<<
fmt_ctx(0x4239960)->streams[0](nb_index_entries 1 index_entries(pos 1022
timestamp 0))
fmt_ctx(0x4239960)->streams[1](nb_index_entries 1 index_entries(pos 1022
timestamp 0))
The debug.

<<
/* bind a decoder to each input stream */
for (i = 0; i < fmt_ctx->nb_streams; i++) {
InputStream *ist = &ifile->streams[i];
AVStream *stream = fmt_ctx->streams[i];
AVCodec *codec;

ist->st = stream;


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (fmt_ctx->streams[i]->nb_index_entries > 0)
{
int j;
for (j = 0; j < fmt_ctx->streams[i]->nb_index_entries; j++)
{
av_log(NULL, AV_LOG_INFO,
"fmt_ctx(%p)->streams[%d](nb_index_entries %d index_entries(pos %jd
timestamp %jd))\n"
, fmt_ctx
, i
, fmt_ctx->streams[i]->nb_index_entries
, fmt_ctx->streams[i]->index_entries[j].pos
, fmt_ctx->streams[i]->index_entries[j].timestamp
);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
Pratap Pulugoru
2018-09-07 13:13:10 UTC
Permalink
Dear Team,

How to build this on the visual studio 2015 environment.

With Regards
Pratap Reddy Pulugoru
Tata Consultancy Services
Ph:- +91 80 67245109
Cell:- +919741622115
Mailto: ***@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Consulting
____________________________________________




From: "Bob Kirnum" <***@gmail.com>
To: "This list is about using libavcodec, libavformat, libavutil,
libavdevice and libavfilter." <libav-***@ffmpeg.org>
Date: 09/07/2018 05:57 PM
Subject: Re: [Libav-user] Issues seeking MKV file.
Sent by: "Libav-user" <libav-user-***@ffmpeg.org>



"External email. Open with Caution"
Apologies for top-posting, hopefully this reply is better.

I had a newer version of the FFmpeg source on a CentOS 7 image (we are
currently using libavformat 56.25.101). Added some debug to ffprobe.c and
it still shows the nb_index_entries as empty after the call to
avformat_open_input. MKVToolNix v26.0.0 indicates there are 10 entries in
the Cues section, each corresponding to a key frame as reported by
ffprobe.

<<
./ffprobe ./test.mkv
ffprobe version N-85966-g78aa938 Copyright (c) 2007-2017 the FFmpeg
developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --bindir=/root/bin
--pkg-config-flags=--static --enable-gpl --enable-nonfree
--enable-libfdk_aac --enable-libfreetype --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265
libavutil 55. 62.100 / 55. 62.100
libavcodec 57. 95.100 / 57. 95.100
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 88.100 / 6. 88.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, matroska,webm, from './test.mkv':
Metadata:
COMPATIBLE_BRANDS: isomiso2avc1mp41
MAJOR_BRAND : isom
MINOR_VERSION : 512
ENCODER : Lavf57.41.100
Duration: 00:00:40.04, start: 0.000000, bitrate: 1093 kb/s
Stream #0:0: Video: vp8, yuv420p(progressive), 1280x690, SAR 1:1 DAR
128:69, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
Metadata:
HANDLER_NAME : VideoHandler
ENCODER : Lavc57.48.101 libvpx
DURATION : 00:00:40.040000000
Stream #0:1: Audio: amr_nb (8[0][0][0] / 0x0038), 8000 Hz, mono, flt,
12 kb/s (default)
Metadata:
HANDLER_NAME : SoundHandler
DURATION : 00:00:39.160000000
The debug output added.

<<
fmt_ctx(0x4239960)->streams[0](nb_index_entries 1 index_entries(pos 1022
timestamp 0))
fmt_ctx(0x4239960)->streams[1](nb_index_entries 1 index_entries(pos 1022
timestamp 0))
The debug.

<<
/* bind a decoder to each input stream */
for (i = 0; i < fmt_ctx->nb_streams; i++) {
InputStream *ist = &ifile->streams[i];
AVStream *stream = fmt_ctx->streams[i];
AVCodec *codec;

ist->st = stream;


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (fmt_ctx->streams[i]->nb_index_entries > 0)
{
int j;
for (j = 0; j < fmt_ctx->streams[i]->nb_index_entries; j++)
{
av_log(NULL, AV_LOG_INFO,
"fmt_ctx(%p)->streams[%d](nb_index_entries %d index_entries(pos %jd
timestamp %jd))\n"
, fmt_ctx
, i
, fmt_ctx->streams[i]->nb_index_entries
, fmt_ctx->streams[i]->index_entries[j].pos
, fmt_ctx->streams[i]->index_entries[j].timestamp
);
}
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

if (stream->codecpar->codec_id == AV_CODEC_ID_PROBE) {
_______________________________________________
Libav-user mailing list
Libav-***@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
Carl Eugen Hoyos
2018-09-07 14:38:55 UTC
Permalink
Post by Bob Kirnum
Apologies for top-posting, hopefully this reply is better.
No, not much.
Post by Bob Kirnum
I had a newer version of the FFmpeg source on a CentOS 7 image (we are
currently using libavformat 56.25.101). Added some debug to ffprobe.c and
it still shows the nb_index_entries as empty after the call to
avformat_open_input. MKVToolNix v26.0.0 indicates there are 10 entries in
the Cues section, each corresponding to a key frame as reported by ffprobe.
./ffprobe ./test.mkv
Iirc, my question was if the issue (a seeking issue if I am not
mistaken) is reproducible with ffmpeg - ffprobe does not seek
by default.
Post by Bob Kirnum
ffprobe version N-85966-g78aa938 Copyright (c) 2007-2017 the FFmpeg
This is old and unsupported.

Carl Eugen

Loading...