Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9198 closed defect (fixed)

Westwood AUD decoding incorrect.

Reported by: Aidan Richmond Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: adpcm
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Decoding IMA ADPCM encoded .aud files from C&C and Red Alert is incorrect.
Sound is distorted compared to game output and has burst of noise at the end.
How to reproduce:

% ffmpeg -i westwood_sample.aud westwood_sample.wav

ffmpeg -v 9 -loglevel 99 -i /d/westwood_sample.aud /d/westwood_sample.wav
ffmpeg version N-102008-gf7c3484b26 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-x86asm --enable-asm --disable-shared --enable-static --enable-sdl2 --prefix=../installed
  libavutil      56. 73.100 / 56. 73.100
  libavcodec     58.136.101 / 58.136.101
  libavformat    58. 78.100 / 58. 78.100
  libavdevice    58. 14.100 / 58. 14.100
  libavfilter     7.111.100 /  7.111.100
  libswscale      5. 10.100 /  5. 10.100
  libswresample   3. 10.100 /  3. 10.100
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 url with argument 'D:/westwood_sample.aud'.
Reading option 'D:/westwood_sample.wav' ... matched as output url.
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 url D:/westwood_sample.aud.
Successfully parsed a group of options.
Opening an input file: D:/westwood_sample.aud.
[NULL @ 00000217ecdf8280] Opening 'D:/westwood_sample.aud' for reading
[file @ 00000217ecdf9940] Setting default whitelist 'file,crypto,data'
Probing wsaud score:50 size:2048
[wsaud @ 00000217ecdf8280] Format wsaud probed with size=2048 and score=50
[wsaud @ 00000217ecdf8280] Before avformat_find_stream_info() pos: 12 bytes read:9668 seeks:0 nb_streams:1
[wsaud @ 00000217ecdf8280] Estimating duration from bitrate, this may be inaccurate
[wsaud @ 00000217ecdf8280] stream 0: start_time: NOPTS duration: 0.875828
[wsaud @ 00000217ecdf8280] format: start_time: NOPTS duration: 0.875828 (estimate from bit rate) bitrate=88 kb/s
[wsaud @ 00000217ecdf8280] After avformat_find_stream_info() pos: 9668 bytes read:9668 seeks:0 frames:19
Input #0, wsaud, from 'D:/westwood_sample.aud':
  Duration: 00:00:00.88, bitrate: 88 kb/s
  Stream #0:0, 19, 1/22050: Audio: adpcm_ima_ws, 22050 Hz, mono, s16, 88 kb/s
Successfully opened the file.
Parsing a group of options: output url D:/westwood_sample.wav.
Successfully parsed a group of options.
Opening an output file: D:/westwood_sample.wav.
File 'D:/westwood_sample.wav' already exists. Overwrite? [y/N] y
[file @ 00000217ecdfafc0] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (adpcm_ima_ws (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
detected 4 logical cores
[graph_0_in_0_0 @ 00000217ecdfd740] Setting 'time_base' to value '1/22050'
[graph_0_in_0_0 @ 00000217ecdfd740] Setting 'sample_rate' to value '22050'
[graph_0_in_0_0 @ 00000217ecdfd740] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 00000217ecdfd740] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 00000217ecdfd740] tb:1/22050 samplefmt:s16 samplerate:22050 chlayout:0x4
[format_out_0_0 @ 00000217ecdfed00] Setting 'sample_fmts' to value 's16'
[AVFilterGraph @ 00000217ece02200] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
Output #0, wav, to 'D:/westwood_sample.wav':
  Metadata:
    ISFT            : Lavf58.78.100
  Stream #0:0, 0, 1/22050: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, mono, s16, 352 kb/s
    Metadata:
      encoder         : Lavc58.136.101 pcm_s16le
D:/westwood_sample.aud: I/O errorbitrate= 366.2kbits/s speed=2.32e+04x
[out_0_0 @ 00000217ecdfeb40] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size=      37kB time=00:00:00.86 bitrate= 353.5kbits/s speed= 253x
video:0kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.205177%
Input file #0 (D:/westwood_sample.aud):
  Input stream #0:0 (audio): 19 packets read (9504 bytes); 19 frames decoded (19008 samples);
  Total: 19 packets (9504 bytes) demuxed
Output file #0 (D:/westwood_sample.wav):
  Output stream #0:0 (audio): 19 frames encoded (19008 samples); 19 packets muxed (38016 bytes);
  Total: 19 packets (38016 bytes) muxed
19 frames successfully decoded, 0 decoding errors
[AVIOContext @ 00000217ece53000] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 00000217ecdf9c40] Statistics: 9668 bytes read, 0 seeks

Attachments (1)

westwood_sample.aud (9.4 KB ) - added by Aidan Richmond 3 years ago.
Sample audio file from the freeware release of C&C Red Alert.

Download all attachments as: .zip

Change History (3)

by Aidan Richmond, 3 years ago

Attachment: westwood_sample.aud added

Sample audio file from the freeware release of C&C Red Alert.

comment:1 by mkver, 3 years ago

Resolution: fixed
Status: newclosed

comment:2 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavcodec
Keywords: adpcm added
Note: See TracTickets for help on using tickets.