Opened 9 years ago

Closed 8 years ago

#5426 closed defect (fixed)

wmavoice: problem with 2 modes

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

Description

attached files doesn't decode corectly (but plays fine with ffplay when I seek in the file)

C:\>ffmpegx -i C:\wmavoice_12kbps_16khz_mono.wma out.wav
ffmpeg version N-79295-g5501f58 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.5.0 (GCC) 20100414 (Fedora MinGW 4.5.0-1.fc14)
  configuration: --prefix=/var/www/users/research/ffmpeg/snapshots/build --arch=
x86 --target-os=mingw32 --cross-prefix=i686-pc-mingw32- --cc='ccache i686-pc-min
gw32-gcc' --enable-pthreads --enable-memalign-hack --enable-runtime-cpudetect --
enable-cross-compile --enable-static --disable-shared --extra-libs='-lws2_32 -lw
inmm -lpthread' --extra-cflags='--static -I/var/www/users/research/ffmpeg/snapsh
ots/build/include' --extra-ldflags='-static -L/var/www/users/research/ffmpeg/sna
pshots/build/lib' --enable-bzlib --enable-zlib --enable-gpl --enable-version3 --
enable-nonfree --enable-libx264 --enable-libspeex --enable-libtheora --enable-li
bvorbis --enable-libfaac --enable-libxvid --enable-libopencore-amrnb --enable-li
bopencore-amrwb --enable-libmp3lame --enable-libfreetype --enable-libvpx --disab
le-decoder=libvpx
  libavutil      55. 20.100 / 55. 20.100
  libavcodec     57. 34.100 / 57. 34.100
  libavformat    57. 32.100 / 57. 32.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 41.100 /  6. 41.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, asf, from 'C:\wmavoice_12kbps_16khz_mono.wma':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: S1
    WMFSDKVersion   : 11.0.5721.5275
    IsVBR           : 0
  Duration: 00:04:41.91, start: 0.000000, bitrate: 13 kb/s
    Stream #0:0(pol): Audio: wmavoice ([10][0][0][0] / 0x000A), 16000 Hz, mono,
flt, 12 kb/s
[wav @ 0x2c403e0] Using AVStream.codec to pass codec parameters to muxers is dep
recated, use AVStream.codecpar instead.
Output #0, wav, to 'out.wav':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: S1
    WMFSDKVersion   : 11.0.5721.5275
    IsVBR           : 0
    ISFT            : Lavf57.32.100
    Stream #0:0(pol): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono,
s16, 256 kb/s
    Metadata:
      encoder         : Lavc57.34.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (wmavoice (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[wav @ 0x2c403e0] Non-monotonous DTS in output stream 0:0; previous: 1180816, cu
rrent: 1180688; changing to 1180816. This may result in incorrect timestamps in
the output file.
Error while decoding stream #0:0: Function not implementeded= 123x
size=    8810kB time=00:04:41.91 bitrate= 256.0kbits/s speed= 123x
video:0kB audio:8810kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.000865%

Attachments (14)

wmavoice_12kbps_16khz_mono.wma (448.3 KB ) - added by ami_stuff 9 years ago.
wmavoice_16kbps_16khz_mono.wma (584.7 KB ) - added by ami_stuff 9 years ago.
16khz_16kbps_50.wav (1.7 MB ) - added by ami_stuff 9 years ago.
16khz_16kbps_50.wma (27.7 KB ) - added by ami_stuff 9 years ago.
16khz_16kbps_100.wav (1.7 MB ) - added by ami_stuff 9 years ago.
16khz_16kbps_100.wma (27.7 KB ) - added by ami_stuff 9 years ago.
2_8khz_4bps.wma (282.5 KB ) - added by ami_stuff 9 years ago.
2_8khz_5kbps.wma (352.5 KB ) - added by ami_stuff 9 years ago.
2_8khz_8kbps.wma (532.7 KB ) - added by ami_stuff 9 years ago.
2_11khz_10kbps.wma (636.6 KB ) - added by ami_stuff 9 years ago.
2_16khz_12kbps.wma (771.9 KB ) - added by ami_stuff 9 years ago.
2_16khz_16kbps.wma (1011.1 KB ) - added by ami_stuff 9 years ago.
2_20khz_20kbps.wma (1.2 MB ) - added by ami_stuff 9 years ago.
wmavoice.7z (344.7 KB ) - added by ami_stuff 8 years ago.

Change History (24)

by ami_stuff, 9 years ago

by ami_stuff, 9 years ago

comment:1 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedavcodec
Keywords: wmavoice added
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

by ami_stuff, 9 years ago

Attachment: 16khz_16kbps_50.wav added

by ami_stuff, 9 years ago

Attachment: 16khz_16kbps_50.wma added

by ami_stuff, 9 years ago

Attachment: 16khz_16kbps_100.wav added

by ami_stuff, 9 years ago

Attachment: 16khz_16kbps_100.wma added

comment:2 by ami_stuff, 9 years ago

16khz_16kbps_50.wma (encoded from 16khz_16kbps_50.wav) decodes correctly
16khz_16kbps_100.wma (encoded from 16khz_16bps_100.wav) decodec incorrectly

ffmpeg -i 16khz_16kbps_100.wav -vf volume=0.5 16_khz_16kbps_50.wav

Version 0, edited 9 years ago by ami_stuff (next)

by ami_stuff, 9 years ago

Attachment: 2_8khz_4bps.wma added

by ami_stuff, 9 years ago

Attachment: 2_8khz_5kbps.wma added

by ami_stuff, 9 years ago

Attachment: 2_8khz_8kbps.wma added

by ami_stuff, 9 years ago

Attachment: 2_11khz_10kbps.wma added

by ami_stuff, 9 years ago

Attachment: 2_16khz_12kbps.wma added

by ami_stuff, 9 years ago

Attachment: 2_16khz_16kbps.wma added

by ami_stuff, 9 years ago

Attachment: 2_20khz_20kbps.wma added

comment:3 by ami_stuff, 9 years ago

added one more set of files

it looks like "Function not implemented" happens with other modes as well

C:\>ffmpeg -i 2_8khz_4bps.wma out.wav
ffmpeg version N-79440-g0efafc5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib
modplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enabl
e-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable
-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --ena
ble-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx
264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable
-lzma --enable-decklink --enable-zlib
  libavutil      55. 20.100 / 55. 20.100
  libavcodec     57. 34.100 / 57. 34.100
  libavformat    57. 34.100 / 57. 34.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 41.101 /  6. 41.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, asf, from '2_8khz_4bps.wma':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: S1
    WMFSDKVersion   : 12.0.7601.17514
    IsVBR           : 0
  Duration: 00:08:09.62, start: 0.000000, bitrate: 4 kb/s
    Stream #0:0(pol): Audio: wmavoice ([10][0][0][0] / 0x000A), 8000 Hz, mono, f
lt, 4 kb/s
[wav @ 00000000004c9780] Using AVStream.codec to pass codec parameters to muxers
 is deprecated, use AVStream.codecpar instead.
Output #0, wav, to 'out.wav':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: S1
    WMFSDKVersion   : 12.0.7601.17514
    IsVBR           : 0
    ISFT            : Lavf57.34.100
    Stream #0:0(pol): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, s
16, 128 kb/s
    Metadata:
      encoder         : Lavc57.34.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (wmavoice (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Error while decoding stream #0:0: Function not implemented
    Last message repeated 8 times
[wmavoice @ 00000000004ca860] Superframe encodes >480 samples (2049), not allowe
d
Error while decoding stream #0:0: Invalid data found when processing input
Error while decoding stream #0:0: Function not implemented
    Last message repeated 1 times
Error while decoding stream #0:0: Function not implementeded= 863x
    Last message repeated 12 times
size=    7551kB time=00:08:09.61 bitrate= 126.3kbits/s speed= 854x
video:0kB audio:7551kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.001009%

by ami_stuff, 8 years ago

Attachment: wmavoice.7z added

comment:4 by ami_stuff, 8 years ago

this decoder has problem with some audio tones

4kbps 8khz and 5kbps 8khz modes decodes ok (see attached files)

comment:5 by Elon Musk, 8 years ago

Those are wrapped wmapro in wmavoice.

comment:6 by Ronald S. Bultje, 8 years ago

The issue is in the postfilter. If I disable that:

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 90dfe20..58d8d15 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -391,6 +391,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)

flags = AV_RL32(ctx->extradata + 18);
s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
s->do_apf = flags & 0x1;

+ s->do_apf = 0;

if (s->do_apf) {

ff_rdft_init(&s->rdft, 7, DFT_R2C);
ff_rdft_init(&s->irdft, 7, IDFT_C2R);

the sample decodes audibly OK. It's possible that the post-filter doesn't handle clipped or overflowing samples correctly, which would go along with the fact that halving the volume fixes it...

comment:7 by Ronald S. Bultje, 8 years ago

Some more digging: inside the postfilter, the issue is caused by adaptive gain control. This patch also works around the issue:

@@ -824,8 +825,12 @@ static void postfilter(WMAVoiceContext *s, const float *synth,

wiener_denoise(s, fcb_type, synth_pf, size, lpcs);


+#if 1
+ memcpy(samples, synth_pf, size * sizeof(*synth));
+#else

adaptive_gain_control(samples, synth_pf, synth, size, 0.99,

&s->postfilter_agc);

+#endif

if (s->dc_level > 8) {

/* remove ultra-low frequency DC noise / highpass filter;

comment:8 by Ronald S. Bultje, 8 years ago

http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-December/204698.html

Fixes the problem in the first sample. I didn't test the rest but I'm assuming it may be similar. Can you guys re-test and open new tickets for files that still have issues?

in reply to:  8 comment:9 by ami_stuff, 8 years ago

Replying to rbultje:

http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2016-December/204698.html

Fixes the problem in the first sample. I didn't test the rest but I'm assuming it may be similar. Can you guys re-test and open new tickets for files that still have issues?

Thanks, first sample is fixed, but files from "wmavoice.7z" still decodes incorrectly, so I created #6035 for them as you requested.

comment:10 by Ronald S. Bultje, 8 years ago

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