Opened 4 years ago

Last modified 4 years ago

#3149 new defect

Matroska muxer does not generate cues for audio files

Reported by: spencercw Owned by:
Priority: normal Component: avformat
Version: 2.1 Keywords: mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The Matroska muxer does not generate cue entries for audio-only files, which will create performance problems when seeking on playback, particularly for large files. The relevant code in matroskaenc.c only looks at video and subtitle streams:

    if ((codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe) || codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
        ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, ts, mkv->cluster_pos, relative_packet_pos,
                               codec->codec_type == AVMEDIA_TYPE_SUBTITLE ? duration : -1);
        if (ret < 0) return ret;
    }

How to reproduce:

  1. Mux any audio file to Matroska.
  2. Execute mkvinfo -v test.mka | grep -i cue; nothing is output. This should display |+ Cues (subentries will be skipped) if cues are present.

Sample command line output below:

$ ffmpeg -v 9 -loglevel 99 -i 12\ -\ Yeah.mp3 -codec copy test.mka
ffmpeg version 2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 14 2013 18:11:01 with Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
  configuration: --toolchain=msvc --enable-shared
  libavutil      52. 48.100 / 52. 48.100
  libavcodec     55. 39.100 / 55. 39.100
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument '12 - Yeah.mp3'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option 'test.mka' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file 12 - Yeah.mp3.
Successfully parsed a group of options.
Opening an input file: 12 - Yeah.mp3.
[mp3 @ 038BBD20] Format mp3 probed with size=8192 and score=51
[mp3 @ 038BBD20] id3v2 ver:4 flags:00 len:1095
[mp3 @ 038BBD20] File position before avformat_find_stream_info() is 1105
[mp3 @ 038BBD20] Estimating duration from bitrate, this may be inaccurate
[mp3 @ 038BBD20] File position after avformat_find_stream_info() is 164527
Input #0, mp3, from '12 - Yeah.mp3':
  Metadata:
    artist          : Queen
    album           : Made in Heaven
    date            : 1995
    genre           : Rock
    title           : Yeah
    track           : 12
  Duration: 00:00:04.11, start: 0.000000, bitrate: 320 kb/s
    Stream #0:0, 157, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
Successfully opened the file.
Parsing a group of options: output file test.mka.
Applying option codec (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: test.mka.
Successfully opened the file.
Output #0, matroska, to 'test.mka':
  Metadata:
    artist          : Queen
    album           : Made in Heaven
    date            : 1995
    genre           : Rock
    title           : Yeah
    PART_NUMBER     : 12
    encoder         : Lavf55.19.104
    Stream #0:0, 0, 1/1000: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 320 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 0390FCE0] Writing block at offset 667, size 1044, pts 0, dts 0, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 1718, size 1045, pts 26, dts 26, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 2770, size 1045, pts 52, dts 52, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 3822, size 1045, pts 78, dts 78, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 4874, size 1045, pts 104, dts 104, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 5926, size 1045, pts 131, dts 131, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 6978, size 1045, pts 157, dts 157, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 8030, size 1045, pts 183, dts 183, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 9082, size 1045, pts 209, dts 209, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 10134, size 1045, pts 235, dts 235, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 11186, size 1044, pts 261, dts 261, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 12237, size 1045, pts 287, dts 287, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 13289, size 1045, pts 313, dts 313, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 14341, size 1045, pts 340, dts 340, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 15393, size 1045, pts 366, dts 366, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 16445, size 1045, pts 392, dts 392, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 17497, size 1045, pts 418, dts 418, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 18549, size 1045, pts 444, dts 444, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 19601, size 1045, pts 470, dts 470, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 20653, size 1045, pts 496, dts 496, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 21705, size 1044, pts 522, dts 522, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 22756, size 1045, pts 549, dts 549, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 23808, size 1045, pts 575, dts 575, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 24860, size 1045, pts 601, dts 601, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 25912, size 1045, pts 627, dts 627, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 26964, size 1045, pts 653, dts 653, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 28016, size 1045, pts 679, dts 679, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 29068, size 1045, pts 705, dts 705, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 30120, size 1045, pts 731, dts 731, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 31172, size 1045, pts 758, dts 758, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 32224, size 1044, pts 784, dts 784, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 33275, size 1045, pts 810, dts 810, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 34327, size 1045, pts 836, dts 836, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 35379, size 1045, pts 862, dts 862, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 36431, size 1045, pts 888, dts 888, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 37483, size 1045, pts 914, dts 914, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 38535, size 1045, pts 940, dts 940, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 39587, size 1045, pts 967, dts 967, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 40639, size 1045, pts 993, dts 993, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 41691, size 1045, pts 1019, dts 1019, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 42743, size 1044, pts 1045, dts 1045, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 43794, size 1045, pts 1071, dts 1071, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 44846, size 1045, pts 1097, dts 1097, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 45898, size 1045, pts 1123, dts 1123, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 46950, size 1045, pts 1149, dts 1149, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 48002, size 1045, pts 1176, dts 1176, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 49054, size 1045, pts 1202, dts 1202, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 50106, size 1045, pts 1228, dts 1228, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 51158, size 1045, pts 1254, dts 1254, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 52210, size 1044, pts 1280, dts 1280, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 53261, size 1045, pts 1306, dts 1306, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 54313, size 1045, pts 1332, dts 1332, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 55365, size 1045, pts 1358, dts 1358, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 56417, size 1045, pts 1384, dts 1384, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 57469, size 1045, pts 1411, dts 1411, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 58521, size 1045, pts 1437, dts 1437, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 59573, size 1045, pts 1463, dts 1463, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 60625, size 1045, pts 1489, dts 1489, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 61677, size 1045, pts 1515, dts 1515, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 62729, size 1044, pts 1541, dts 1541, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 63780, size 1045, pts 1567, dts 1567, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 64832, size 1045, pts 1593, dts 1593, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 65884, size 1045, pts 1620, dts 1620, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 66936, size 1045, pts 1646, dts 1646, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 67988, size 1045, pts 1672, dts 1672, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 69040, size 1045, pts 1698, dts 1698, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 70092, size 1045, pts 1724, dts 1724, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 71144, size 1045, pts 1750, dts 1750, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 72196, size 1045, pts 1776, dts 1776, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 73248, size 1044, pts 1802, dts 1802, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 74299, size 1045, pts 1829, dts 1829, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 75351, size 1045, pts 1855, dts 1855, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 76403, size 1045, pts 1881, dts 1881, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 77455, size 1045, pts 1907, dts 1907, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 78507, size 1045, pts 1933, dts 1933, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 79559, size 1045, pts 1959, dts 1959, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 80611, size 1045, pts 1985, dts 1985, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 81663, size 1045, pts 2011, dts 2011, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 82715, size 1045, pts 2038, dts 2038, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 83767, size 1044, pts 2064, dts 2064, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 84818, size 1045, pts 2090, dts 2090, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 85870, size 1045, pts 2116, dts 2116, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 86922, size 1045, pts 2142, dts 2142, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 87974, size 1045, pts 2168, dts 2168, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 89026, size 1045, pts 2194, dts 2194, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 90078, size 1045, pts 2220, dts 2220, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 91130, size 1045, pts 2247, dts 2247, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 92182, size 1045, pts 2273, dts 2273, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 93234, size 1045, pts 2299, dts 2299, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 94286, size 1044, pts 2325, dts 2325, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 95337, size 1045, pts 2351, dts 2351, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 96389, size 1045, pts 2377, dts 2377, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 97441, size 1045, pts 2403, dts 2403, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 98493, size 1045, pts 2429, dts 2429, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 99545, size 1045, pts 2456, dts 2456, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 100597, size 1045, pts 2482, dts 2482, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 101649, size 1045, pts 2508, dts 2508, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 102701, size 1045, pts 2534, dts 2534, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 103753, size 1044, pts 2560, dts 2560, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 104804, size 1045, pts 2586, dts 2586, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 105856, size 1045, pts 2612, dts 2612, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 106908, size 1045, pts 2638, dts 2638, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 107960, size 1045, pts 2664, dts 2664, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 109012, size 1045, pts 2691, dts 2691, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 110064, size 1045, pts 2717, dts 2717, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 111116, size 1045, pts 2743, dts 2743, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 112168, size 1045, pts 2769, dts 2769, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 113220, size 1045, pts 2795, dts 2795, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 114272, size 1044, pts 2821, dts 2821, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 115323, size 1045, pts 2847, dts 2847, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 116375, size 1045, pts 2873, dts 2873, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 117427, size 1045, pts 2900, dts 2900, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 118479, size 1045, pts 2926, dts 2926, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 119531, size 1045, pts 2952, dts 2952, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 120583, size 1045, pts 2978, dts 2978, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 121635, size 1045, pts 3004, dts 3004, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 122687, size 1045, pts 3030, dts 3030, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 123739, size 1045, pts 3056, dts 3056, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 124791, size 1044, pts 3082, dts 3082, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 125842, size 1045, pts 3109, dts 3109, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 126894, size 1045, pts 3135, dts 3135, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 127946, size 1045, pts 3161, dts 3161, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 128998, size 1045, pts 3187, dts 3187, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 130050, size 1045, pts 3213, dts 3213, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 131102, size 1045, pts 3239, dts 3239, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 132154, size 1045, pts 3265, dts 3265, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 133206, size 1045, pts 3291, dts 3291, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 134258, size 1045, pts 3318, dts 3318, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 135310, size 1044, pts 3344, dts 3344, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 136361, size 1045, pts 3370, dts 3370, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 137413, size 1045, pts 3396, dts 3396, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 138465, size 1045, pts 3422, dts 3422, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 139517, size 1045, pts 3448, dts 3448, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 140569, size 1045, pts 3474, dts 3474, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 141621, size 1045, pts 3500, dts 3500, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 142673, size 1045, pts 3527, dts 3527, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 143725, size 1045, pts 3553, dts 3553, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 144777, size 1045, pts 3579, dts 3579, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 145829, size 1044, pts 3605, dts 3605, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 146880, size 1045, pts 3631, dts 3631, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 147932, size 1045, pts 3657, dts 3657, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 148984, size 1045, pts 3683, dts 3683, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 150036, size 1045, pts 3709, dts 3709, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 151088, size 1045, pts 3736, dts 3736, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 152140, size 1045, pts 3762, dts 3762, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 153192, size 1045, pts 3788, dts 3788, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 154244, size 1045, pts 3814, dts 3814, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 155296, size 1044, pts 3840, dts 3840, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 156347, size 1045, pts 3866, dts 3866, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 157399, size 1045, pts 3892, dts 3892, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 158451, size 1045, pts 3918, dts 3918, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 159503, size 1045, pts 3944, dts 3944, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 160555, size 1045, pts 3971, dts 3971, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 161607, size 1045, pts 3997, dts 3997, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 162659, size 1045, pts 4023, dts 4023, duration 26, flags 128
[matroska @ 0390FCE0] Writing block at offset 163711, size 1045, pts 4049, dts 4049, duration 26, flags 128
No more output streams to write to, finishing.
[matroska @ 0390FCE0] Writing block at offset 164763, size 290, pts 4075, dts 4075, duration 26, flags 128
[matroska @ 0390FCE0] end duration = 4101
size=     161kB time=00:00:04.10 bitrate= 322.0kbits/s
video:0kB audio:159kB subtitle:0 global headers:0kB muxing overhead 1.081485%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 038C4780] Statistics: 16 seeks, 169 writeouts
[AVIOContext @ 038C42E0] Statistics: 164527 bytes read, 0 seeks

Change History (2)

comment:1 follow-up: Changed 4 years ago by cehoyos

  • Keywords mkv added; matroska muxer cues removed

Is this also reproducible with current FFmpeg git head?

comment:2 in reply to: ↑ 1 Changed 4 years ago by atgraham

Replying to cehoyos:

Is this also reproducible with current FFmpeg git head?

Yes. Currently it is reproducible with FFmpeg git head, and the offending code snippet listed in the Description is still unchanged.

Note: See TracTickets for help on using tickets.