Opened 7 years ago

Closed 8 months ago

Last modified 8 months ago

#6396 closed defect (fixed)

Wrong timestamps for raw flac streams

Reported by: Carl Eugen Hoyos Owned by:
Priority: important Component: avformat
Version: git-master Keywords: flac regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Raw flac streams show wrong timestamps since e1fcd3a007591193891df1095f5263e9e5e71958

$ ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -write_header 0 out.flac
ffmpeg version N-86090-g376247a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration:
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.100 / 57. 96.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 89.101 /  6. 89.101
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
  Metadata:
    creation_time   : 2001-03-20T16:17:18.000000Z
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Sorenson Video 3
    encoder-eng     : Sorenson Video 3
  Duration: 00:00:43.58, start: 0.000000, bitrate: 580 kb/s
    Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p(pc), 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc (default)
    Metadata:
      creation_time   : 2001-03-20T16:17:18.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Sorenson Video 3
    Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, mono, s16p, 176 kb/s (default)
    Metadata:
      creation_time   : 2001-03-20T16:17:18.000000Z
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:1 -> #0:0 (adpcm_ima_qt (native) -> flac (native))
Press [q] to stop, [?] for help
[adpcm_ima_qt @ 0x33416c0] Multiple frames in a packet.
Output #0, flac, to 'out.flac':
  Metadata:
    encoder         : Lavf57.72.101
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    Stream #0:0(eng): Audio: flac, 44100 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2001-03-20T16:17:18.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Lavc57.96.100 flac
size=    2143kB time=00:00:43.57 bitrate= 403.0kbits/s speed= 301x
video:0kB audio:2143kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
$ ffmpeg -f flac -i out.flac -f null -
ffmpeg version N-86090-g376247a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration:
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.100 / 57. 96.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 89.101 /  6. 89.101
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
Input #0, flac, from 'out.flac':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: flac, 44100 Hz, mono, s16
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
    Metadata:
      encoder         : Lavc57.96.100 pcm_s16le
size=N/A time=00:00:21.40 bitrate=N/A speed=1.93e+03x
video:0kB audio:3753kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Change History (6)

comment:1 by Uwe Klotz, 7 years ago

I might have stumbled over this bug when trying to decode the following file:

https://github.com/mixxxdj/mixxx/blob/master/src/test/id3-test-data/cover-test.flac

[flac @ 0x2ef2060] read_timestamp() failed in the middle
av_seek_frame(): Operation not permitted

Out tests for sample accurate decoding fail when using FFmpeg for FLAC files.

Last edited 7 years ago by Uwe Klotz (previous) (diff)

in reply to:  1 comment:2 by Carl Eugen Hoyos, 7 years ago

Replying to uklotzde:

I might have stumbled over this bug when trying to decode the following file:

https://github.com/mixxxdj/mixxx/blob/master/src/test/id3-test-data/cover-test.flac

This is not a raw flac file, it did not change behaviour with e1fcd3a0 and it decodes bit-exact, so I don't think you have stumbled over this bug with this file.

Please consider posting on the user mailing list if you see issues with FFmpeg.

comment:3 by mkver, 5 years ago

The reason is a wrong timebase: The pts the parser returns are in 44100 Hz, but the timebase is 90 kHz. The duration gets scaled in parse_packet() in libavformat/utils.c, but the timestamps don't.

comment:4 by Balling, 14 months ago

Yes, it appears the problem is still there, though ffplay works good, no? Anyway.

Also why even use raw flac??

[flac @ 0x2ef2060] read_timestamp() failed in the middle
av_seek_frame(): Operation not permitted

That only happens when ffplay.exe -i https://github.com/mixxxdj/mixxx/raw/main/src/test/id3-test-data/cover-test.flac seek and then press Esc. The problem is github does not support seeking. It is a different problem.

Last edited 8 months ago by Balling (previous) (diff)

comment:5 by Elon Musk, 8 months ago

Resolution: fixed
Status: newclosed

in reply to:  5 comment:6 by Balling, 8 months ago

Replying to Elon Musk:

Fixed in 5f8c113b75de9c2a7f49e337cd332abbf8adbb6e

Now do the same for .THD.

Fixed indeed after -write_header 0: time=00:00:14.74 now prints time=00:00:29.98 (same as cover-test.flac).

seek and then press Esc

That still happens.

Last edited 8 months ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.