Opened 13 months ago

Last modified 13 months ago

#5829 new defect

ADPCM SWF wave decode error, but directly decode *.flv right

Reported by: Guiding.Li Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: ADPCM SWF
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

ADPCM SWF wave decode error, but directly decode *.flv right

% ./ffmpeg -i ~/program/swf_adpcm/mono_11k.flv -vn -acodec copy mono_11k_bs.wav
% ./ffmpeg -i mono_11k_bs.wav mono_11k_pcm.wav
Got mono_11k_pcm.wav error.

% ./ffmpeg -i ~/program/swf_adpcm/mono_11k.flv -vn mono_11k_pcm_right.wav
Got mono_11k_pcm_right.wav right.

*.flv ------> right.wav
*.flv --> swf.wav --> error.wav

Also, use SWF ADPCM encode to a wav, then decode it to PCM, meet error.
PCM --> swf.wav --> PCM(error)

Root cause in my opinion:
SWF adpcm take block_align as once decoded frame_size.
When decode *.flv, we can get the right frame_size.
When decode swf.wav get the wrong frame_size.

How to reproduce:

CMD:
% ./ffmpeg -i ~/program/swf_adpcm/mono_11k.flv -vn -acodec copy mono_11k_bs.wav
% ./ffmpeg -i mono_11k_bs.wav mono_11k_pcm.wav
% ./ffmpeg -i ~/program/swf_adpcm/mono_11k.flv -vn mono_11k_pcm_right.wav

Version:
From https://git.ffmpeg.org/ffmpeg
   369ed11..ba7be8c  master     -> origin/master
   8887daf..c32ce24  release/2.8 -> origin/release/2.8
   b62191f..3512ed3  release/3.0 -> origin/release/3.0
   4275b27..677ea4a  release/3.1 -> origin/release/3.1
 * [new tag]         n3.0.3     -> n3.0.3
From https://git.ffmpeg.org/ffmpeg
 * [new tag]         n3.1.3     -> n3.1.3
Updating 369ed11..ba7be8c


Log:

ligd@bjdevel03 ffmpeg $./ffmpeg -i ~/program/swf_adpcm/mono_11k.flv -vn -acodec copy mono_11k_bs.wav
ffmpeg version N-81571-gba7be8c Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/home/ligd/git/
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.102 / 57. 48.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 60.100 /  6. 60.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
[flv @ 0xa48b260] video stream discovered after head already parsed
[flv @ 0xa48b260] audio stream discovered after head already parsed
Input #0, flv, from '/home/ligd/program/swf_adpcm/mono_11k.flv':
  Duration: 00:01:00.46, start: 0.000000, bitrate: 810 kb/s
    Stream #0:0: Video: flv1, yuv420p, 640x352, 12 fps, 12 tbr, 1k tbn
    Stream #0:1: Audio: adpcm_swf, 11025 Hz, mono, s16, 44 kb/s
[wav @ 0xa4e4b00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[wav @ 0xa4e4b00] requested bits_per_coded_sample (16) and actually stored (4) differ
Output #0, wav, to 'mono_11k_bs.wav':
  Metadata:
    ISFT            : Lavf57.48.102
    Stream #0:0: Audio: adpcm_swf (FS[0][0] / 0x5346), 11025 Hz, mono, 44 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=     327kB time=00:01:00.46 bitrate=  44.3kbits/s speed=1.73e+03x
video:0kB audio:327kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.027772%
ligd@bjdevel03 ffmpeg $
ligd@bjdevel03 ffmpeg $
ligd@bjdevel03 ffmpeg $./ffmpeg -i mono_11k_bs.wav mono_11k_pcm.wav
ffmpeg version N-81571-gba7be8c Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.4.5 (Debian 4.4.5-8)
  configuration: --prefix=/home/ligd/git/
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.102 / 57. 48.102
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 60.100 /  6. 60.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'mono_11k_bs.wav':
  Metadata:
    encoder         : Lavf57.48.102
  Duration: 00:01:00.46, bitrate: 44 kb/s
    Stream #0:0: Audio: adpcm_swf (FS[0][0] / 0x5346), 11025 Hz, 1 channels, s16, 44 kb/s
[wav @ 0xb44c400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, wav, to 'mono_11k_pcm.wav':
  Metadata:
    ISFT            : Lavf57.48.102
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 11025 Hz, mono, s16, 176 kb/s
    Metadata:
      encoder         : Lavc57.55.101 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (adpcm_swf (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size=    1904kB time=00:01:28.42 bitrate= 176.4kbits/s speed=2.61e+03x
video:0kB audio:1904kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004001%

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

mono_11k.flv (2.5 MB) - added by Guiding.Li 13 months ago.

Change History (2)

Changed 13 months ago by Guiding.Li

comment:1 Changed 13 months ago by Guiding.Li

  • Component changed from undetermined to avcodec
Note: See TracTickets for help on using tickets.