Opened 12 years ago

Closed 12 years ago

Last modified 11 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 Carl Eugen Hoyos)

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 by grolschie, 12 years ago

The static FFmpeg build was downloaded from here:

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

comment:2 by Carl Eugen Hoyos, 12 years ago

Component: FFmpegundetermined
Description: modified (diff)
Keywords: wma regression added
Priority: criticalimportant
Summary: Crashes with rtmp stream -> .asf/wmvAssertion fails when encoding wmav2
Version: unspecifiedgit-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 by Elon Musk, 12 years ago

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 by grolschie, 12 years ago

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 12 years ago by grolschie (previous) (diff)

comment:5 by grolschie, 12 years ago

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 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedavcodec
Reproduced by developer: set
Status: newopen

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 by Michael Niedermayer, 12 years ago

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 by Carl Eugen Hoyos, 12 years ago

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 by Carl Eugen Hoyos, 12 years ago

(gdb) b wmaenc.c:389
Breakpoint 1 at 0x85dca96: 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 0xb7ba76c0 (LWP 3586)]
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 @ 0x8f5d000] tb:1/1000 samplefmt:s16 samplerate:22050 chlayout:0x3
[auto-inserted resampler 0 @ 0x8ed6f60] 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 0xb7ba76c0 (LWP 3586)]

Breakpoint 1, encode_superframe (avctx=0x8eccfa0, avpkt=0xbfa19dfc, frame=0x8eee780,
    got_packet_ptr=0xbfa19f40) at libavcodec/wmaenc.c:389
389         av_assert0(i>=0);
(gdb) print i
$1 = -14242
(gdb) bt
#0  encode_superframe (avctx=0x8eccfa0, avpkt=0xbfa19dfc, frame=0x8eee780, got_packet_ptr=0xbfa19f40)
    at libavcodec/wmaenc.c:389
#1  0x0855ae20 in avcodec_encode_audio2 (avctx=0x8eccfa0, avpkt=0xbfa19dfc, frame=0x8eee780,
    got_packet_ptr=0xffff9bec) at libavcodec/utils.c:1128
#2  0x08055beb in poll_filters () at ffmpeg.c:1583
#3  0x080590e3 in main (argc=149737376, argv=0x0) at ffmpeg.c:3656
(gdb) disass $pc-154 $pc+8
Dump of assembler code from 0x85dc9fc to 0x85dca9e:
0x085dc9fc <encode_superframe+1756>:    test   %eax,%eax
0x085dc9fe <encode_superframe+1758>:    js     0x85dcd2e <encode_superframe+2574>
0x085dca04 <encode_superframe+1764>:    mov    %ebp,(%esp)
0x085dca07 <encode_superframe+1767>:    call   0x81a6ca0 <avpriv_align_put_bits>
0x085dca0c <encode_superframe+1772>:    mov    0x3c(%esp),%edx
0x085dca10 <encode_superframe+1776>:    mov    0x3c(%esp),%ecx
0x085dca14 <encode_superframe+1780>:    mov    0x194(%edx),%eax
0x085dca1a <encode_superframe+1786>:    sub    0x190(%edx),%eax
0x085dca20 <encode_superframe+1792>:    lea    0x20(,%eax,8),%eax
0x085dca27 <encode_superframe+1799>:    sub    0x18c(%edx),%eax
0x085dca2d <encode_superframe+1805>:    mov    %eax,%edx
0x085dca2f <encode_superframe+1807>:    sar    $0x1f,%edx
0x085dca32 <encode_superframe+1810>:    shr    $0x1d,%edx
0x085dca35 <encode_superframe+1813>:    add    %eax,%edx
0x085dca37 <encode_superframe+1815>:    sar    $0x3,%edx
0x085dca3a <encode_superframe+1818>:    sub    0x1b0(%ecx),%edx
0x085dca40 <encode_superframe+1824>:    test   %edx,%edx
0x085dca42 <encode_superframe+1826>:    jg     0x85dcd45 <encode_superframe+2597>
0x085dca48 <encode_superframe+1832>:    cmp    $0x80,%ebx
0x085dca4e <encode_superframe+1838>:    jle    0x85dcc60 <encode_superframe+2368>
0x085dca54 <encode_superframe+1844>:    mov    0x3c(%esp),%ebx
0x085dca58 <encode_superframe+1848>:    mov    0x194(%ebx),%edi
0x085dca5e <encode_superframe+1854>:    mov    0x18c(%ebx),%esi
0x085dca64 <encode_superframe+1860>:    mov    %edi,%eax
0x085dca66 <encode_superframe+1862>:    sub    0x190(%ebx),%eax
0x085dca6c <encode_superframe+1868>:    lea    0x20(,%eax,8),%eax
0x085dca73 <encode_superframe+1875>:    sub    %esi,%eax
0x085dca75 <encode_superframe+1877>:    test   $0x7,%al
0x085dca77 <encode_superframe+1879>:    jne    0x85dcde1 <encode_superframe+2753>
0x085dca7d <encode_superframe+1885>:    lea    0x7(%eax),%edx
0x085dca80 <encode_superframe+1888>:    mov    %edx,%eax
0x085dca82 <encode_superframe+1890>:    sar    $0x1f,%eax
0x085dca85 <encode_superframe+1893>:    shr    $0x1d,%eax
0x085dca88 <encode_superframe+1896>:    lea    (%eax,%edx,1),%edx
0x085dca8b <encode_superframe+1899>:    sar    $0x3,%edx
0x085dca8e <encode_superframe+1902>:    neg    %edx
0x085dca90 <encode_superframe+1904>:    add    0x1b0(%ebx),%edx
0x085dca96 <encode_superframe+1910>:    cmp    $0x0,%edx
0x085dca99 <encode_superframe+1913>:    jl     0x85dcdfb <encode_superframe+2779>
End of assembler dump.
(gdb) info register
eax            0x0      0
ecx            0x8ef34e0        149894368
edx            0xffffc85e       -14242
ebx            0x8ef34e0        149894368
esp            0xbfa19890       0xbfa19890
ebp            0x8ef3668        0x8ef3668
esi            0x20     32
edi            0x8f75c8c        150428812
eip            0x85dca96        0x85dca96 <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
Last edited 12 years ago by Carl Eugen Hoyos (previous) (diff)

comment:10 by Carl Eugen Hoyos, 12 years ago

Resolution: duplicate
Status: openclosed

This was fixed / is a duplicate of ticket #1495

Thank you for the reports!

comment:11 by grolschie, 12 years ago

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 by Carl Eugen Hoyos, 11 years ago

Keywords: abort added

comment:13 by Carl Eugen Hoyos, 11 years ago

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