Opened 11 years ago

Closed 11 years ago

#2117 closed defect (fixed)

Ogg demuxer producing corrupted Vorbis stream

Reported by: Hendrik Owned by:
Priority: important Component: avformat
Version: git-master Keywords: ogg vorbis regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

The avformat Ogg demuxer produces a corrupted Vorbis stream, which when decoded results in only broken audio in a specific sample.

How to reproduce:

Easily reproducable with ffplay/ffmpeg and the attached sample.
The resulting playback/output file only contains corrupted audio.

% ffmpeg -v 9 -logleve 99 -i skyplus_hi.ogg out.wav
ffmpeg version N-48515-g2713e43 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  6 2013 22:43:40 with gcc 4.7.2 (GCC)
  configuration: 
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument '../skyplus_hi.ogg'.
Reading option 'bug.wav' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file ../skyplus_hi.ogg.
Successfully parsed a group of options.
Opening an input file: ../skyplus_hi.ogg.
[ogg @ 0182BC00] Format ogg probed with size=2048 and score=100
[ogg @ 0182BC00] File position before avformat_find_stream_info() is 4519
[ogg @ 0182BC00] All info found
[ogg @ 0182BC00] File position after avformat_find_stream_info() is 4519
Input #0, ogg, from '../skyplus_hi.ogg':
  Duration: 00:02:04.60, start: 0.000000, bitrate: 31 kb/s
    Stream #0:0, 1, 1/44100: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      GENRE           : Other
      ENCODEDBY       : Free Mp3 Wma Converter
      DATE            : 2011
      track           : 1
Successfully openened the file.
Parsing a group of options: output file bug.wav.
Successfully parsed a group of options.
Opening an output file: bug.wav.
Successfully openened the file.
[abuffer @ 0182F0E0] Setting entry with key 'time_base' to value '1/44100'
[abuffer @ 0182F0E0] Setting entry with key 'sample_rate' to value '44100'
[abuffer @ 0182F0E0] Setting entry with key 'sample_fmt' to value 'fltp'
[abuffer @ 0182F0E0] Setting entry with key 'channel_layout' to value '0x3'
[graph 0 input from stream 0:0 @ 014D75C0] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3
[aformat @ 01500B40] Setting entry with key 'sample_fmts' to value 's16'
[audio format for output stream 0:0 @ 0182F3C0] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:0'
[auto-inserted resampler 0 @ 0182F6C0] chl:stereo fmt:fltp r:44100Hz -> chl:stereo fmt:s16 r:44100Hz
Output #0, wav, to 'bug.wav':
  Metadata:
    ISFT            : Lavf54.59.106
    Stream #0:0, 0, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      GENRE           : Other
      ENCODEDBY       : Free Mp3 Wma Converter
      DATE            : 2011
      track           : 1
Stream mapping:
  Stream #0:0 -> #0:0 (vorbis -> pcm_s16le)
Press [q] to stop, [?] for help
[output stream 0:0 @ 0182F2A0] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
size=    5375kB time=00:02:04.59 bitrate= 353.4kbits/s    

video:0kB audio:5375kB subtitle:0 global headers:0kB muxing overhead 0.001453%
[AVIOContext @ 0182C1C0] Statistics: 592033 bytes read, 3 seeks

This problem was actually fixed in f63412f by Justin, however a follow up change by Michael in ca4a3f4 (and following changes to oggparsevorbis.c) broke it again. Reverting the changes in ca4a3f4 on top of master does no longer fix the problem, however performing a checkout of ca4a3f4 and then reverting the commit in that tree does solve it, which shows that Justings original fix worked, and suggests the changes after ca4a3f4 broke it in other ways even more.

Attachments (1)

skyplus_hi.ogg (486.7 KB ) - added by Hendrik 11 years ago.
Sample file with corrupted decoding

Download all attachments as: .zip

Change History (8)

by Hendrik, 11 years ago

Attachment: skyplus_hi.ogg added

Sample file with corrupted decoding

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen

comment:2 by Michael Niedermayer, 11 years ago

Analyzed by developer: set

The file contains 2 concatenated ogg vorbis streams, the first is very short. The difference between the "working" and not working revissions is purely how many packets they read before initing the decoder. If its inited during the first stream it can decode the first but not the second, as the first is very short this makes it appear as if its not working, if its inited during the second it can decode the second stream.
That it works with some revissions is thus purely random luck ...

comment:3 by Michael Niedermayer, 11 years ago

posted a patch that fixes this file.
Do you have more files like this ?
if yes do they contain longer initial streams?
(depending on if its always such a short stream or not the patch may or may not be an acceptable solution)
If its not enough then we have to reinit the decoder properly on stream changes ...

comment:4 by Hendrik, 11 years ago

The file was recorded from an online streaming service, here is the streaming URLs:
http://stream05.akaver.com/skyplus_hi.ogg or
http://stream05.akaver.com/skyplus_low.ogg

Both of the live streams seem to exhibit the same issue.
Your patch does seem to fix decoding.

Only remaining issue after the patch is that the stream start_time is not set properly (start_time is set to 0, but the stream starts with a huge timestamp after the patch).

comment:6 by Michael Niedermayer, 11 years ago

more generic solution posted to ML

comment:7 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed by Michael.

Note: See TracTickets for help on using tickets.