[FFmpeg-trac] #7473(avcodec:new): WMA decoder: gapless playback
FFmpeg
trac at avcodec.org
Fri Oct 5 20:35:08 EEST 2018
#7473: WMA decoder: gapless playback
---------------------------------+--------------------------------------
Reporter: bnnm | Type: defect
Status: new | Priority: normal
Component: avcodec | Version: git-master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------+--------------------------------------
FFmpeg's WMA doesn't properly skip encoder delay (as big as 4096 samples),
and is missing last frame samples after EOF, so final output is off.
This can be tested comparing the output of any player or program using
Microsoft's codec API (Windows Media Foundation) vs ffmpeg.exe. With
skip+last frame output is correct compared to those.
Noticeable in old videogames using WMA, that need gapless to loop properly
(ex.- Castlevania: Symphony of the Night Xbox).
Skip value in WMA seems fixed, I don't think it's specified in the
container (ASF/XWMA) or the bitstream.
I'll provide a patch and leave some samples here that show FFmpeg vs
Microsoft decoding.
How to reproduce:
{{{
$ ffmpeg.exe -i wma_2ch_44100_48khz.wma wma_2ch_44100_48khz_ffmpeg.wav
ffmpeg version N-92112-g03123e4053 Copyright (c) 2000-2018 the FFmpeg
developers
built with gcc 8.2.1 (GCC) 20180813
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-
fontconfig --enable-gnutls --enable-iconv --enable-libass --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
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 32.100 / 58. 32.100
libavformat 58. 18.104 / 58. 18.104
libavdevice 58. 4.105 / 58. 4.105
libavfilter 7. 33.100 / 7. 33.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'wma_2ch_44100_48khz.wma':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L2
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
Duration: 00:00:02.04, start: 0.000000, bitrate: 72 kb/s
Stream #0:0(spa): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz,
stereo, fltp, 48 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (wmav2 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'wma_2ch_44100_48khz_ffmpeg.wav':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L2
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
ISFT : Lavf58.18.104
Stream #0:0(spa): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz,
stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc58.32.100 pcm_s16le
size= 360kB time=00:00:02.04 bitrate=1443.7kbits/s speed= 511x
video:0kB audio:360kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.021159%
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7473>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list