3

Opus audio codec format [and OGG as its container] started to gain traction, which is great. However it also means that everyday problems surface. Mine today is a corrupted file, and the question is whether there are tools to repair the stream.

The actual stream is possibly created by a broken encoder, namely:

  Encoded with Gagravarr.org Java Vorbis Tools v0.8 20160217

and opusinfo correctly complains:

**WARNING: Invalid header page in stream 1, contains multiple packets**
New logical stream (#1, serial: 000052c9): type opus
**WARNING: Implausibly low preskip in Opus stream (1)**
Encoded with Gagravarr.org Java Vorbis Tools v0.8 20160217
Opus stream 1:
        Pre-skip: 0
        Playback gain: 0 dB
        Channels: 1
        Original sample rate: 16000Hz
        Packet duration:   60.0ms (max),   60.0ms (avg),   60.0ms (min)
        Page duration:     60.0ms (max),   60.0ms (avg),   60.0ms (min)
        Total data length: 12231171 bytes (overhead: 13.9%)
        Playback length: 60m:49.920s
        Average bitrate: 26.81 kb/s, w/o overhead: 23.08 kb/s
Logical stream 1 ended

which is fine. But while the data is visibly there, opusdec decides to force correctness:

Decoding to 48000 Hz (1 channel)
Extra packets on initial header page. Invalid stream.

and absolutely reject to process the file, which isn't very helpful.

My question is: how the user is supposed to salvage/repair/fix a broken, but salvageable file? Is there a (FOSS) code for that? Is there some hidden functionality in xiph stuff?

grin
  • 315
  • 4
  • 12
  • To be honest, I _can_ do it with _mplayer_ and some separate tools, but it's ugly and not specifically created to repair the file. – grin Nov 29 '17 at 14:42

1 Answers1

3

Please report the warnings and error to encoder's upstream. The point of opusinfo and opusdec complaining to get people to fix their software and stop making broken files. In addition to the extra packets and unset pre-skip value, 60 ms packet durations probably aren't what you want.

There's no fixup program in xiph's opus-tools package. You could try remuxing it with something like ffmpeg in.opus -acodec copy out.opus which might correct the incorrect paging. There's no good way to correct the missing pre-skip value.

Ralph Giles
  • 427
  • 2
  • 8
  • ffmpeg (program) is not even able to open it. mplayer seems to try it harder: ```Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders libavcodec version 57.89.100 (internal) [opus @ 0x55c2d74fa700]Error parsing the packet header. [opus @ 0x55c2d74fa700]Error parsing the packet header. AUDIO: 48000 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->384000) Selected audio codec: [ffopus] afm: ffmpeg (FFmpeg opus)``` – grin Dec 05 '17 at 15:26