Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1494 closed defect (duplicate)

Assertion fails when encoding wmav2

Reported by: grolschie Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: wma regression abort crash
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by cehoyos)

System is Windows XP 32bit with Athlon XP2800+ CPU.

Output from ffmpeg:


ffmpeg.exe -i "rtmp://extondemand.livestream.com/ondemand swfUrl=http://cdn.livestream.com/chromelessPlayer/v21/playerapi.swf?autoplay=true playpath=trans/dv15/mogulus-user-files/chepsilon_tv/2011/12/25/4ae0b944-c50f-41e0-8376-cc1f1a91daa3" -y -copyts -c:v wmv2 -b:v 15360k -r 25 -g 15 -c:a
wmav2 -b:a 64k -ar 48000 -ac 2 -map 0:0 -map 0:1 -sn -f asf epsilon_hellas.asf
ffmpeg version N-42016-gc103dc0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 28 2012 20:16:03 with gcc 4.7.1
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass
 --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable
-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 29.101 / 54. 29.101
  libavformat    54. 11.100 / 54. 11.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.100 /  3.  0.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
HandleCtrl: Ignoring SWFVerification request, use --swfVfy!
Metadata:
  metadatacreator       Yet Another Metadata Injector for FLV - Version 1.4
  hasKeyframes          TRUE
  hasVideo              TRUE
  hasAudio              TRUE
  hasMetadata           TRUE
  canSeekToEnd          TRUE
  duration              30.09
  datasize              1978772.00
  videosize             1716367.00
  videocodecid          2.00
  width                 450.00
  height                360.00
  framerate             24.96
  videodatarate         443.44
  audiosize             254789.00
  audiocodecid          2.00
  audiosamplerate       22000.00
  audiosamplesize       16.00
  stereo                TRUE
  audiodatarate         62.85
  filesize              1980591.00
  lasttimestamp         30.09
  lastkeyframetimestamp 30.00
  lastkeyframelocation  1975246.00
keyframes:
filepositions:
times:
Input #0, flv, from 'rtmp://extondemand.livestream.com/ondemand swfUrl=http://cdn.livestream.com/chromelessPlayer/v21/playerapi.swf?autoplay=true playpath=trans/dv15/mogulus-user-files/chepsilon_tv/2011/12/25/4ae0b944-c50f-41e0-8376-cc1f1a91daa3':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
  Duration: 00:00:30.09, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: flv1, yuv420p, 450x360, 454 kb/s, 25 tbr, 1k tbn, 1k tbc

    Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s
[graph 0 input from stream 0:0 @ 02559e20] w:450 h:360 pixfmt:yuv420p tb:1/1000
fr:25/1 sar:0/1 sws_param:flags=2
[output stream 0:0 @ 0254fb00] No opaque field provided
[graph 1 input from stream 0:1 @ 0254a9a0] tb:1/1000 samplefmt:s16 samplerate:22
050 chlayout:0x3
[auto-inserted resampler 0 @ 0254ba60] chl:stereo fmt:s16 r:22050Hz -> chl:stere
o fmt:s16 r:48000Hz
Output #0, asf, to 'epsilon_hellas.asf':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    WM/EncodingSettings: Lavf54.11.100
    Stream #0:0: Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 450x360, q=2-31, 1536
0 kb/s, 1k tbn, 25 tbc
    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, s16, 63 k
b/s
Stream mapping:
  Stream #0:0 -> #0:0 (flv -> wmv2)
  Stream #0:1 -> #0:1 (mp3 -> wmav2)
Press [q] to stop, [?] for help
Assertion i>=0 failed at /home/kyle/software/ffmpeg/source/ffmpeg-git/libavcodec
/wmaenc.c:405

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


Change History (13)

comment:1 Changed 4 years ago by grolschie

The static FFmpeg build was downloaded from here:

http://ffmpeg.zeranoe.com/builds/

comment:2 Changed 4 years ago by cehoyos

  • Component changed from FFmpeg to undetermined
  • Description modified (diff)
  • Keywords wma regression added
  • Priority changed from critical to important
  • Summary changed from Crashes with rtmp stream -> .asf/wmv to Assertion fails when encoding wmav2
  • Version changed from unspecified to git-master

Regression since 0a7bf34
Is this also reproducible with ffmpeg -i ... -vn out.wma ?
Are you able to provide a file to reproduce the problem?

comment:3 Changed 4 years ago by richardpl

This is not really regression since 0a7bf34 because that commit actually revealed how encoder is buggy.
(It probably should be marked experimental long ago...)

comment:4 Changed 4 years ago by grolschie

Is this also reproducible with ffmpeg -i ... -vn out.wma ?

ffmpeg.exe -i input_stream.flv -y -copyts -c:v wmv2 -b:v 15360k -r 25 -g 15 -c:a wmav2 -b:a 64k -ar 48000 -ac 2 -map 0:0 -map 0:1 -sn -f asf -vn out.wma
ffmpeg version N-42016-gc103dc0 Copyright (c) 2000-2012 the FFmpeg developers

built on Jun 28 2012 20:16:03 with gcc 4.7.1
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru

ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass

--enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable

-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libope
njpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libth
eora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --e
nable-zlib

libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 11.100 / 54. 11.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100

Input #0, flv, from 'input_stream.flv':

Metadata:

metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
hasKeyframes : true
hasVideo : true
hasAudio : true
hasMetadata : true
canSeekToEnd : true
datasize : 1978772
videosize : 1716367
audiosize : 254789
lasttimestamp : 30
lastkeyframetimestamp: 30
lastkeyframelocation: 1975246
encoder : Lavf54.11.100

Duration: 00:00:30.27, start: 0.000000, bitrate: 366 kb/s

Stream #0:0: Video: flv1, yuv420p, 450x360, 200 kb/s, 25 tbr, 1k tbn, 1k tbc

Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s

[graph 0 input from stream 0:1 @ 0237f960] tb:1/1000 samplefmt:s16 samplerate:22
050 chlayout:0x3
[auto-inserted resampler 0 @ 02375e80] chl:stereo fmt:s16 r:22050Hz -> chl:stere
o fmt:s16 r:48000Hz
Output #0, asf, to 'out.wma':

Metadata:

metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
hasKeyframes : true
hasVideo : true
hasAudio : true
hasMetadata : true
canSeekToEnd : true
datasize : 1978772
videosize : 1716367
audiosize : 254789
lasttimestamp : 30
lastkeyframetimestamp: 30
lastkeyframelocation: 1975246
WM/EncodingSettings: Lavf54.11.100
Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, s16, 63 k

b/s
Stream mapping:

Stream #0:1 -> #0:0 (mp3 -> wmav2)

Press [q] to stop, ? for help
Assertion i>=0 failed at /home/kyle/software/ffmpeg/source/ffmpeg-git/libavcodec
/wmaenc.c:405

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Are you able to provide a file to reproduce the problem?

https://sites.google.com/site/grolschie/input_stream.flv

Last edited 4 years ago by grolschie (previous) (diff)

comment:5 Changed 4 years ago by grolschie

Using "-ar 44100" also faults.

Dropping the "-ar 48000" works.
Using "-ar 22050" works. Which makes me think that it could be related to this ticket:
https://ffmpeg.org/trac/ffmpeg/ticket/1495
... where audio output is corrupt with 48Khz and 44.1Khz, but not 22.050Khz.

comment:6 Changed 4 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Reproduced by developer set
  • Status changed from new to open

The assert is triggered through the regression described in ticket #1495, I was so far unable to produce an input sample that triggers the assert without -ar 48k.

comment:7 Changed 4 years ago by michael

I could not reproduce it but i found several issues in wmaenc some may have caused this, they are fixed now.
Please retest

comment:8 Changed 4 years ago by cehoyos

Still fails here with current git head:

$ ffmpeg -i input_stream.flv -ar 48k -vn out.wma
ffmpeg version N-42075-g7001eee Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 30 2012 21:09:05 with gcc 4.3.2
  configuration: --cc=/usr/local/gcc-4.3.2/bin/gcc
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 31.100 / 54. 31.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.100 /  3.  0.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
Input #0, flv, from 'input_stream.flv':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    encoder         : Lavf54.11.100
  Duration: 00:00:30.27, start: 0.000000, bitrate: 366 kb/s
    Stream #0:0: Video: flv1, yuv420p, 450x360, 200 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s
[graph 0 input from stream 0:1 @ 0x8f60f80] tb:1/1000 samplefmt:s16 samplerate:22050 chlayout:0x3
[auto-inserted resampler 0 @ 0x8f62240] chl:stereo fmt:s16 r:22050Hz -> chl:stereo fmt:s16 r:48000Hz
Output #0, asf, to 'out.wma':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    WM/EncodingSettings: Lavf54.14.100
    Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, s16, 127 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mp3 -> wmav2)
Press [q] to stop, [?] for help
Assertion i>=0 failed at libavcodec/wmaenc.c:389

comment:9 Changed 4 years ago by cehoyos

(gdb) b wmaenc.c:389
Breakpoint 1 at 0x8622106: file libavcodec/wmaenc.c, line 389.
(gdb) r -i input_stream.flv -ar 48k -vn -acodec wmav2 -f null -
Starting program: ffmpeg_g -i input_stream.flv -ar 48k -vn -acodec wmav2 -f null -
[Thread debugging using libthread_db enabled]
[New Thread 0xb77ea9c0 (LWP 2617)]
ffmpeg version N-42075-g7001eee Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 30 2012 21:05:39 with gcc 4.3.2
  configuration: --cc=/usr/local/gcc-4.3.2/bin/gcc --enable-gpl --enable-libopenjpeg --enable-libvorbis --enable-libspeex --enable-libmp3lame --enable-libtheora --extra-ldflags=-lm --enable-libvpx --enable-libxavs --enable-libfaac --enable-nonfree
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 31.100 / 54. 31.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.100 /  3.  0.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, flv, from 'input_stream.flv':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    encoder         : Lavf54.11.100
  Duration: 00:00:30.27, start: 0.000000, bitrate: 366 kb/s
    Stream #0:0: Video: flv1, yuv420p, 450x360, 200 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16, 64 kb/s
[graph 0 input from stream 0:1 @ 0x90c8000] tb:1/1000 samplefmt:s16 samplerate:22050 chlayout:0x3
[auto-inserted resampler 0 @ 0x9041f60] chl:stereo fmt:s16 r:22050Hz -> chl:stereo fmt:s16 r:48000Hz
Output #0, null, to 'pipe:':
  Metadata:
    metadatacreator : Yet Another Metadata Injector for FLV - Version 1.4
    hasKeyframes    : true
    hasVideo        : true
    hasAudio        : true
    hasMetadata     : true
    canSeekToEnd    : true
    datasize        : 1978772
    videosize       : 1716367
    audiosize       : 254789
    lasttimestamp   : 30
    lastkeyframetimestamp: 30
    lastkeyframelocation: 1975246
    encoder         : Lavf54.14.100
    Stream #0:0: Audio: wmav2, 48000 Hz, stereo, s16, 127 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mp3 -> wmav2)
Press [q] to stop, [?] for help
[Switching to Thread 0xb77ea9c0 (LWP 2617)]

Breakpoint 1, encode_superframe (avctx=0x9037fa0, avpkt=0xbffd209c, frame=0x9059780,
    got_packet_ptr=0xbffd21e0) at libavcodec/wmaenc.c:389
389         av_assert0(i>=0);
(gdb) print i
$2 = -14242
(gdb) bt
#0  encode_superframe (avctx=0x9037fa0, avpkt=0xbffd209c, frame=0x9059780, got_packet_ptr=0xbffd21e0)
    at libavcodec/wmaenc.c:389
#1  0x085a0490 in avcodec_encode_audio2 (avctx=0x9037fa0, avpkt=0xbffd209c, frame=0x9059780,
    got_packet_ptr=0xffff9bec) at libavcodec/utils.c:1128
#2  0x08057deb in poll_filters () at ffmpeg.c:1583
#3  0x0805b2e3 in main (argc=151224224, argv=0x0) at ffmpeg.c:3656
(gdb) disass $pc-128 $pc+8
Dump of assembler code from 0x8622086 to 0x862210e:
0x08622086 <encode_superframe+1782>:    xchg   %eax,%esp
0x08622087 <encode_superframe+1783>:    add    %eax,(%eax)
0x08622089 <encode_superframe+1785>:    add    %ch,(%ebx)
0x0862208b <encode_superframe+1787>:    (bad)
0x0862208c <encode_superframe+1788>:    nop
0x0862208d <encode_superframe+1789>:    add    %eax,(%eax)
0x0862208f <encode_superframe+1791>:    add    %cl,0x20c504(%ebp)
0x08622095 <encode_superframe+1797>:    add    %al,(%eax)
0x08622097 <encode_superframe+1799>:    sub    0x18c(%edx),%eax
0x0862209d <encode_superframe+1805>:    mov    %eax,%edx
0x0862209f <encode_superframe+1807>:    sar    $0x1f,%edx
0x086220a2 <encode_superframe+1810>:    shr    $0x1d,%edx
0x086220a5 <encode_superframe+1813>:    add    %eax,%edx
0x086220a7 <encode_superframe+1815>:    sar    $0x3,%edx
0x086220aa <encode_superframe+1818>:    sub    0x1b0(%ecx),%edx
0x086220b0 <encode_superframe+1824>:    test   %edx,%edx
0x086220b2 <encode_superframe+1826>:    jg     0x86223b5 <encode_superframe+2597>
0x086220b8 <encode_superframe+1832>:    cmp    $0x80,%ebx
0x086220be <encode_superframe+1838>:    jle    0x86222d0 <encode_superframe+2368>
0x086220c4 <encode_superframe+1844>:    mov    0x3c(%esp),%ebx
0x086220c8 <encode_superframe+1848>:    mov    0x194(%ebx),%edi
0x086220ce <encode_superframe+1854>:    mov    0x18c(%ebx),%esi
0x086220d4 <encode_superframe+1860>:    mov    %edi,%eax
0x086220d6 <encode_superframe+1862>:    sub    0x190(%ebx),%eax
0x086220dc <encode_superframe+1868>:    lea    0x20(,%eax,8),%eax
0x086220e3 <encode_superframe+1875>:    sub    %esi,%eax
0x086220e5 <encode_superframe+1877>:    test   $0x7,%al
0x086220e7 <encode_superframe+1879>:    jne    0x8622451 <encode_superframe+2753>
0x086220ed <encode_superframe+1885>:    lea    0x7(%eax),%edx
0x086220f0 <encode_superframe+1888>:    mov    %edx,%eax
0x086220f2 <encode_superframe+1890>:    sar    $0x1f,%eax
0x086220f5 <encode_superframe+1893>:    shr    $0x1d,%eax
0x086220f8 <encode_superframe+1896>:    lea    (%eax,%edx,1),%edx
0x086220fb <encode_superframe+1899>:    sar    $0x3,%edx
0x086220fe <encode_superframe+1902>:    neg    %edx
0x08622100 <encode_superframe+1904>:    add    0x1b0(%ebx),%edx
0x08622106 <encode_superframe+1910>:    cmp    $0x0,%edx
0x08622109 <encode_superframe+1913>:    jl     0x862246b <encode_superframe+2779>
End of assembler dump.
(gdb) info register
eax            0x0      0
ecx            0x905e4e0        151381216
edx            0xffffc85e       -14242
ebx            0x905e4e0        151381216
esp            0xbffd1b30       0xbffd1b30
ebp            0x905e668        0x905e668
esi            0x20     32
edi            0x90e0c8c        151915660
eip            0x8622106        0x8622106 <encode_superframe+1910>
eflags         0x282    [ SF IF ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
Version 0, edited 4 years ago by cehoyos (next)

comment:10 Changed 4 years ago by cehoyos

  • Resolution set to duplicate
  • Status changed from open to closed

This was fixed / is a duplicate of ticket #1495

Thank you for the reports!

comment:11 Changed 4 years ago by grolschie

I have tested it on my system this with this binary:
http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20120706-git-8293a21-win32-static.7z

It's fixed! Thank you so much!

comment:12 Changed 4 years ago by cehoyos

  • Keywords abort added

comment:13 Changed 4 years ago by cehoyos

  • Keywords crash added
Note: See TracTickets for help on using tickets.