Opened 12 years ago

Closed 11 years ago

#582 closed defect (fixed)

Assertion failure in rate-control if pass 2 - file is longer

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

Description

I was trying to transcode a movie from h264 to mp4.

command line:

ffmpeg -i Crouching.Tiger.Hidden.Dragon.\(Wo.hu.cang.long\).2000.1080p.Bluray.DTS.x264-SHiTSoNy.mkv -vcodec mpeg4 -pass 2 -threads 2 -acodec ac3 -ab 384000 -b 10000000 -f mp4 Tiger.mp4

error:

ffmpeg: libavcodec/ratecontrol.c:693: ff_rate_estimate_qscale: Assertion `picture_number<rcc->num_entries' failed.
Aborted

output as requested:

$ffmpeg -v 9 -loglevel 99 -i Crouching.Tiger.Hidden.Dragon.\(Wo.hu.cang.long\).2000.1080p.Bluray.DTS.x264-SHiTSoNy.mkv
ffmpeg version 0.8.5, Copyright (c) 2000-2011 the FFmpeg developers

built on Oct 11 2011 23:20:55 with gcc 4.5.2
configuration:
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0

[matroska,webm @ 0x17e6400] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
st:2 removing common factor 1000000 from timebase
st:3 removing common factor 1000000 from timebase
[h264 @ 0x1800320] Unsupported bit depth: 0
[h264 @ 0x1800320] no picture
[dca @ 0x1802220] Stream with high frequencies VQ coding
[h264 @ 0x1800320] no picture
[matroska,webm @ 0x17e6400] max_analyze_duration 5000000 reached at 5002000
[matroska,webm @ 0x17e6400] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (5994/125) -> 23.98 (24000/1001)
Input #0, matroska,webm, from 'Crouching.Tiger.Hidden.Dragon.(Wo.hu.cang.long).2000.1080p.Bluray.DTS.x264-SHiTSoNy.mkv':

Duration: 02:00:14.20, start: 0.000000, bitrate: 1536 kb/s

Chapter #0.0: start 0.000000, end 500.500000
Metadata:

title : 00:00:00.000

Chapter #0.1: start 500.500000, end 922.171000
Metadata:

title : 00:08:20.500

Chapter #0.2: start 922.171000, end 1431.179000
Metadata:

title : 00:15:22.171

Chapter #0.3: start 1431.179000, end 1986.943000
Metadata:

title : 00:23:51.179

Chapter #0.4: start 1986.943000, end 2231.395000
Metadata:

title : 00:33:06.943

Chapter #0.5: start 2231.395000, end 2587.209000
Metadata:

title : 00:37:11.395

Chapter #0.6: start 2587.209000, end 2949.571000
Metadata:

title : 00:43:07.209

Chapter #0.7: start 2949.571000, end 3223.762000
Metadata:

title : 00:49:09.571

Chapter #0.8: start 3223.762000, end 4404.900000
Metadata:

title : 00:53:43.762

Chapter #0.9: start 4404.900000, end 4814.976000
Metadata:

title : 01:13:24.900

Chapter #0.10: start 4814.976000, end 5398.935000
Metadata:

title : 01:20:14.976

Chapter #0.11: start 5398.935000, end 5722.717000
Metadata:

title : 01:29:58.935

Chapter #0.12: start 5722.717000, end 6239.691000
Metadata:

title : 01:35:22.717

Chapter #0.13: start 6239.691000, end 6463.165000
Metadata:

title : 01:43:59.691

Chapter #0.14: start 6463.165000, end 6737.230000
Metadata:

title : 01:47:43.165

Chapter #0.15: start 6737.230000, end 7214.207000
Metadata:

title : 01:52:17.230

Stream #0.0, 124, 1/1000: Video: h264 (High), yuv420p, 1920x800, 125/5994, PAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0.1(chi), 496, 1/1000: Audio: dca (DTS), 48000 Hz, 5.1, s16, 1536 kb/s (default)
Stream #0.2(dut), 0, 1/1000: Subtitle: [0][0][0][0] / 0x0000 (default)
Stream #0.3(eng), 0, 1/1000: Subtitle: [0][0][0][0] / 0x0000

At least one output file must be specified

Change History (16)

comment:1 by Carl Eugen Hoyos, 12 years ago

Please provide a sample.

comment:2 by graylion, 12 years ago

that is a thundering big file and it happened somewhere in the middle. Any good idea on how to get 7.9 GiB of video to you?

comment:3 by Carl Eugen Hoyos, 12 years ago

Is the problem also reproducible with current git head?

Does gdb show a backtrace etc.?

comment:4 by graylion, 12 years ago

running with latest snapshot, we'll see what happens. can you give me an example how I would use gdb here?

comment:5 by graylion, 12 years ago

result with latest snapshot:
frame= 3538 fps= 34 q=2.0 size= 160982kB time=00:02:27.56 bitrate=8936.9kbits/sffmpeg: libavcodec/ratecontrol.c:696: ff_rate_estimate_qscale: Assertion `picture_number<rcc->num_entries' failed.
Aborted

comment:6 by graylion, 12 years ago

OK, have figured out how to gdb, running with gdb and waiting for failure

comment:7 by graylion, 12 years ago

I have installed the debug symbols for libc, but gdb doesn't seem to find them. I'll try again after a reboot:

backtrace:
$sudo gdb /usr/bin/ffmpeg 12593
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/ffmpeg...(no debugging symbols found)...done.
Attaching to program: /usr/bin/ffmpeg, process 12593
Cannot access memory at address 0x40ccb38b2414ff49
Cannot access memory at address 0x40ccb38b2414ff49
Cannot access memory at address 0x40ccb38b2414ff49
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Cannot access memory at address 0x40ccb38b2414ff49
0x000000000069af90 in ?? ()
(gdb) c
Continuing.

Program received signal SIGABRT, Aborted.
0x00007fce1a7a8d05 in ?? ()

(gdb) bt
#0 0x00007fce1a7a8d05 in ?? ()
#1 0x00007fce1a7acab6 in ?? ()
#2 0x00000000000002b8 in ?? ()
#3 0x00007fce1a8c868e in ?? ()
#4 0x0000000000acc700 in ?? ()
#5 0x00007fce1a8c66da in ?? ()
#6 0x00007fffe24641f0 in ?? ()
#7 0x00007fce1a7db862 in ?? ()
#8 0x0000003000000018 in ?? ()
#9 0x00007fffe2464200 in ?? ()
#10 0x00007fffe2464120 in ?? ()
#11 0x00007fce1a7c5d74 in ?? ()
#12 0x0000003000000030 in ?? ()
#13 0x00007fffe2464218 in ?? ()
#14 0x0000000001c51d40 in ?? ()
#15 0x00000000000020e0 in ?? ()
#16 0x0000000001c89730 in ?? ()
#17 0x7265626d756e5f65 in ?? ()
#18 0x00007fffe24673db in ?? ()
#19 0x00007fce1a8c66da in ?? ()
#20 0x0000000000acc1c3 in ?? ()
---Type <return> to continue, or q <return> to quit---
#21 0x00000000000002b8 in ?? ()
#22 0x0000000000000020 in ?? ()
#23 0x0000000000000000 in ?? ()

comment:8 by Carl Eugen Hoyos, 12 years ago

As explained on http://ffmpeg.org/bugreports.html do not run "gdb /usr/bin/ffmpeg", but "gdb ffmpeg_g" from your build directory to get symbols needed for backtrace etc.

comment:9 by reimar, 12 years ago

libavcodec/ratecontrol.c:696: ff_rate_estimate_qscale: Assertion `picture_number<rcc->num_entries' failed.

This means the second pass has been processing more frames than the first pass has recorded in the log file.
Are you sure you did run the first pass with the same options and the 1st-pass logfile has not been corrupted?

comment:10 by graylion, 12 years ago

This is getting even more interesting. Doing this in ffmpeg 0.9.1 on Lucid with kernel 2.6.32-37-server 64 bit leads to spontaneous shutdown of the box. As in the machine simply losing power. Trying on Mint 11 (ie Natty) now.

comment:11 by graylion, 12 years ago

OK, this worked.

I think we can close the bug.

comment:12 by Carl Eugen Hoyos, 12 years ago

What happens if two different files (the longer file for the second pass) are provided as input to ffmpeg -vcodec libx264? Does above crash happen?

comment:13 by graylion, 12 years ago

I am sure that my two files were identical in size - I have reproduced this issue quite a few times with versions between .4 and .8. As a more modern kernel seems to resolve whatever problem there was I am really not interested in testing further.

comment:14 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavcodec
Keywords: crash abort added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master
$ dd if=fate-suite/svq3/Vertical400kbit.sorenson3.mov bs=1M count=2 of=test.mov
$ ./ffmpeg -i test.mov -vcodec mpeg4 -an -pass 1 out.mov
...
$ ./ffmpeg -i fate-suite/svq3/Vertical400kbit.sorenson3.mov -vcodec mpeg4 -an -pass 2 -y out.mov
ffmpeg version N-46875-g0df7d95 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 18 2012 23:31:36 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack --enable-libx264
  libavutil      52.  8.100 / 52.  8.100
  libavcodec     54. 73.100 / 54. 73.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.101 /  3. 23.101
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 16.100 /  0. 16.100
  libpostproc    52.  2.100 / 52.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x34b6240] max_analyze_duration 5000000 reached at 5000998
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'fate-suite/svq3/Vertical400kbit.sorenson3.mov':
  Metadata:
    creation_time   : 2001-03-20 16:17:18
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Sorenson Video 3
    encoder-eng     : Sorenson Video 3
  Duration: 00:00:43.58, start: 0.000000, bitrate: 580 kb/s
    Stream #0:0(eng): Video: svq3 (SVQ3 / 0x33515653), yuvj420p, 320x240, 391 kb/s, 30.02 fps, 30 tbr, 600 tbn, 600 tbc
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, mono, s16p, 176 kb/s
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
Output #0, mov, to 'out.mov':
  Metadata:
    encoder-eng     : Sorenson Video 3
    title           : Vertical Online SV3 Demo
    title-eng       : Vertical Online SV3 Demo
    artist          : Logan Kelsey
    artist-eng      : Logan Kelsey
    copyright       : © Vertical Online 2001
    copyright-eng   : © Vertical Online 2001
    encoder         : Lavf54.37.100
    Stream #0:0(eng): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 320x240, q=2-31, pass 2, 200 kb/s, 15360 tbn, 30 tbc
    Metadata:
      creation_time   : 2001-03-20 16:17:18
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (svq3 -> mpeg4)
Press [q] to stop, [?] for help
ffmpeg: libavcodec/ratecontrol.c:694: ff_rate_estimate_qscale: Assertion `picture_number<rcc->num_entries' failed.
Aborted

comment:15 by Carl Eugen Hoyos, 11 years ago

Summary: error on transcoding from h264 to MP4 with 0.8.5Assertion failure in rate-control if pass 2 - file is longer

comment:16 by Michael Niedermayer, 11 years ago

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