[FFmpeg-trac] #3300(avutil:new): Muxing example crashes on avcodec_close when using DIRAC codec

FFmpeg trac at avcodec.org
Mon Jan 13 09:45:21 CET 2014


#3300: Muxing example crashes on avcodec_close when using DIRAC codec
---------------------------------+----------------------------------
             Reporter:  andreiC  |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avutil   |                  Version:  2.1.1
             Keywords:           |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+----------------------------------
 Hello,
 I've build the muxing example as a win32 console application using VS2012.
 The application was run on Windows 8 x64.

 The only changes to the muxing example that I made were enclosing the
 #include directives inside extern "C" { ... }  and adding the following
 line:

 {{{
 fmt->video_codec = AV_CODEC_ID_DIRAC;
 }}}

 before :

 {{{
 if (fmt->video_codec != AV_CODEC_ID_NONE) {
                 video_st = add_stream(oc, &video_codec, fmt->video_codec);
 }
 }}}

 in order to use the DIRAC codec for encoding the video.

 For building the console application I've used the latest windows static
 and dev build packages from zeranoe.

 With any other codec the muxing example works fine, only when using the
 DIRAC codec the application crashes with 0xC0000005 access violation. This
 error occurs when calling
 {{{
 avcodec_close(st->codec);
 }}}
 from
 {{{
 close_video(AVFormatContext *oc, AVStream *st);
 }}}

 I don't have the debug symbols, I've tried building ffmpeg libraries
 myself, but I wasn't able to build them together with libschrodinger
 support using msvc, so the only stack trace that I can provide is this:
 >       ntdll.dll!_RtlReportCriticalFailure at 8
 >       ntdll.dll!_RtlpReportHeapFailure at 4
 >       ntdll.dll!_RtlpLogHeapFailure at 24
 >       ntdll.dll!_RtlFreeHeap at 12
 >       msvcrt.dll!_free
 >       msvcrt.dll!__aligned_free
 >       avutil-52.dll!59ad2ca3()
 >       [Frames below may be incorrect and/or missing, no symbols loaded
 for avutil-52.dll]
 >       avcodec-55.dll!6c3c1c4b()
 >       ConsoleApplication1.exe!close_video(AVFormatContext * oc, AVStream
 * st) Line 441
 >       ConsoleApplication1.exe!main(int argc, char * * argv) Line 555
 >       ConsoleApplication1.exe!__tmainCRTStartup() Line 536    C
 >       ConsoleApplication1.exe!mainCRTStartup() Line 377       C
 > kernel32.dll!@BaseThreadInitThunk at 12
 >       ntdll.dll!___RtlUserThreadStart at 8
 >       ntdll.dll!__RtlUserThreadStart at 8

 I did some investigation and I've managed to narrow where the issue is to:
 {{{
 static int libschroedinger_encode_close(AVCodecContext *avctx)
 }}}
 from libscrhrodingerenc.c, but I wasn't able to dig any deeper.



 The command line that I've used together with the output:

 {{{
 \>ConsoleApplication1.exe outputfile.avi
 [libmp3lame @ 01477be0] Channel layout not specified
 Output #0, avi, to 'outputfile.avi':
     Stream #0:0: Video: dirac (libschroedinger), yuv420p, 352x288, q=2-31,
 400 k
 b/s, 90k tbn, 25 tbc
     Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, 2 channels, fltp, 64
 kb/s
 [avi @ 01476c00] Encoder did not produce proper pts, making some up.

 }}}

 Also, I've played a little with ffmpeg.exe(the windows build from zeranoe)
 and I've noticed that quite often when using ffmpeg.exe to transcode a
 video from ffv1 to dirac would crash right before closing(after printing
 the status of the transcoding operation):

 {{{
 ffmpeg-20140110-git-d9481dc-win32-shared\bin>ffmpeg -i
  myOutputFile15FPS-FFV10.avi -vcodec libschroedinger outputFile.avi
 ffmpeg version N-59742-gd9481dc Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Jan  9 2014 22:04:35 with gcc 4.8.2 (GCC)
   configuration: --disable-static --enable-shared --enable-gpl --enable-
 version3
  --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig
 --ena
 ble-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-
 libbluray --e
 nable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
 --enable-lib
 modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrw
 b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-
 libschroedinge
 r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-
 libtwolame --en
 able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
 libvorbis
  --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs
 --enable-
 libxvid --enable-zlib
   libavutil      52. 62.100 / 52. 62.100
   libavcodec     55. 47.101 / 55. 47.101
   libavformat    55. 22.103 / 55. 22.103
   libavdevice    55.  5.102 / 55.  5.102
   libavfilter     4.  1.100 /  4.  1.100
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 17.104 /  0. 17.104
   libpostproc    52.  3.100 / 52.  3.100
 Input #0, avi, from 'myOutputFile15FPS-FFV10.avi':
   Metadata:
     encoder         : Lavf55.21.102
   Duration: 00:00:20.27, start: 0.000000, bitrate: 2229 kb/s
     Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv420p, 640x480, 15
 tbr, 15 t
 bn, 15 tbc
 File 'outputFile.avi' already exists. Overwrite ? [y/N] y
 Output #0, avi, to 'outputFile.avi':
   Metadata:
     ISFT            : Lavf55.22.103
     Stream #0:0: Video: dirac (libschroedinger) (drac / 0x63617264),
 yuv420p, 64
 0x480, q=2-31, 200 kb/s, 15 tbn, 15 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (ffv1 -> libschroedinger)
 Press [q] to stop, [?] for help
 frame=   38 fps=0.0 q=0.0 size=      39kB time=00:00:01.20 bitrate=
 264.2kbits/s
 frame=   58 fps= 55 q=0.0 size=      74kB time=00:00:02.53 bitrate=
 240.9kbits/s
 frame=   79 fps= 51 q=0.0 size=     110kB time=00:00:03.93 bitrate=
 228.3kbits/s
 frame=  100 fps= 48 q=0.0 size=     141kB time=00:00:05.33 bitrate=
 217.3kbits/s
 frame=  122 fps= 47 q=0.0 size=     179kB time=00:00:06.80 bitrate=
 215.2kbits/s
 frame=  144 fps= 46 q=0.0 size=     214kB time=00:00:08.26 bitrate=
 211.7kbits/s
 frame=  166 fps= 45 q=0.0 size=     252kB time=00:00:09.73 bitrate=
 212.4kbits/s
 frame=  186 fps= 44 q=0.0 size=     286kB time=00:00:11.06 bitrate=
 211.9kbits/s
 frame=  206 fps= 44 q=0.0 size=     318kB time=00:00:12.40 bitrate=
 210.2kbits/s
 frame=  227 fps= 44 q=0.0 size=     351kB time=00:00:13.80 bitrate=
 208.6kbits/s
 frame=  247 fps= 43 q=0.0 size=     385kB time=00:00:15.13 bitrate=
 208.2kbits/s
 frame=  268 fps= 43 q=0.0 size=     416kB time=00:00:16.53 bitrate=
 206.2kbits/s
 frame=  290 fps= 43 q=0.0 size=     453kB time=00:00:18.00 bitrate=
 206.2kbits/s
 frame=  304 fps= 40 q=0.0 Lsize=     518kB time=00:00:20.20 bitrate=
 209.9kbits/
 s
 video:505kB audio:0kB subtitle:0 global headers:0kB muxing overhead
 2.541212%
 }}}

 After some investigation it seems that ffmpeg.exe crashes when calling
 avcodec_close() as in the muxing example, so I think it's the same
 problem.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3300>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list