Opened 5 years ago

Closed 5 years ago

#8031 closed defect (fixed)

ADX encoding missing end of file

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

Description

Summary of the bug:

I'm trying to convert WAV to ADX and the output ADX misses end of file (EOF, for short). Because of this, several games that use ADX can't properly switch music (it can't find EOF of the first music, and silence plays instead of the next music). I've tried to use another converter that outputs ADXv3 without loop points and it plays properly. The difference is that the ffmpeg's adx lacks of the EOF.

Addition of 0x80 01 00 0E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 at the end of adx file fixes the problem (EOF size is 18, 0x8001000E followed by 14 zeroes).

I'll attach the sample file (test.wav), ffmpeg's output (test_ffmpeg.adx), and the output of the converter that works (test_adxencd.adx).

How to reproduce:

ffmpeg -i test.wav test_ffmpeg.adx
D:\>ffmpeg -v 9 -loglevel 99 -i test.wav test_ffmpeg.adx
ffmpeg version N-94335-g9869e21776 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190716
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.102 / 58. 28.102
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.101 /  7. 56.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.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 'test.wav'.
Reading option 'test_ffmpeg.adx' ... 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 test.wav.
Successfully parsed a group of options.
Opening an input file: test.wav.
[NULL @ 000001f2ba999180] Opening 'test.wav' for reading
[file @ 000001f2ba99a280] Setting default whitelist 'file,crypto'
Probing wav score:99 size:46
[wav @ 000001f2ba999180] Format wav probed with size=2048 and score=99
[wav @ 000001f2ba999180] Before avformat_find_stream_info() pos: 44 bytes read:46 seeks:0 nb_streams:1
[wav @ 000001f2ba999180] probing stream 0 pp:32
[wav @ 000001f2ba999180] probing stream 0 pp:31
[wav @ 000001f2ba999180] probed stream 0
[wav @ 000001f2ba999180] parser not found for codec pcm_s16le, packets or times may be invalid.
[wav @ 000001f2ba999180] stream 0: start_time: -209146758205323.719 duration: 0.000
[wav @ 000001f2ba999180] format: start_time: -9223372036854.775 duration: 0.000 bitrate=16000 kb/s
[wav @ 000001f2ba999180] After avformat_find_stream_info() pos: 46 bytes read:46 seeks:0 frames:1
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'test.wav':
  Duration: 00:00:00.00, bitrate: 16000 kb/s
    Stream #0:0, 1, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Successfully opened the file.
Parsing a group of options: output url test_ffmpeg.adx.
Successfully parsed a group of options.
Opening an output file: test_ffmpeg.adx.
[file @ 000001f2ba99de80] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> adpcm_adx (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 2 logical cores
[graph_0_in_0_0 @ 000001f2ba99f580] Setting 'time_base' to value '1/44100'
[graph_0_in_0_0 @ 000001f2ba99f580] Setting 'sample_rate' to value '44100'
[graph_0_in_0_0 @ 000001f2ba99f580] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 000001f2ba99f580] Setting 'channel_layout' to value '0x4'
[graph_0_in_0_0 @ 000001f2ba99f580] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x4
[format_out_0_0 @ 000001f2ba9a0100] Setting 'sample_fmts' to value 's16'
[AVFilterGraph @ 000001f2ba9a2b40] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
Output #0, adx, to 'test_ffmpeg.adx':
  Metadata:
    encoder         : Lavf58.28.102
    Stream #0:0, 0, 1/44100: Audio: adpcm_adx, 44100 Hz, mono, s16, 128 kb/s
    Metadata:
      encoder         : Lavc58.53.101 adpcm_adx
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[out_0_0 @ 000001f2ba99ff40] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
size=       0kB time=00:00:00.00 bitrate= 595.0kbits/s speed=0.0196x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Input file #0 (test.wav):
  Input stream #0:0 (audio): 1 packets read (2 bytes); 1 frames decoded (1 samples);
  Total: 1 packets (2 bytes) demuxed
Output file #0 (test_ffmpeg.adx):
  Output stream #0:0 (audio): 1 frames encoded (1 samples); 1 packets muxed (54 bytes);
  Total: 1 packets (54 bytes) muxed
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 000001f2ba99dfc0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 000001f2ba9a2500] Statistics: 46 bytes read, 0 seeks

Attachments (3)

test.wav (46 bytes ) - added by osa413 5 years ago.
sample wav file
test_ffmpeg.adx (54 bytes ) - added by osa413 5 years ago.
ffmpeg's output of sample file
test_adxencd.adx (72 bytes ) - added by osa413 5 years ago.
another converter's output of sample file

Download all attachments as: .zip

Change History (4)

by osa413, 5 years ago

Attachment: test.wav added

sample wav file

by osa413, 5 years ago

Attachment: test_ffmpeg.adx added

ffmpeg's output of sample file

by osa413, 5 years ago

Attachment: test_adxencd.adx added

another converter's output of sample file

comment:1 by James, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.