[FFmpeg-trac] #5458(avcodec:new): Race condition in H.264 decoder causes corrupt output with more than one thread

FFmpeg trac at avcodec.org
Thu Apr 21 16:13:10 CEST 2016


#5458: Race condition in H.264 decoder causes corrupt output with more than one
thread
-------------------------------------+-------------------------------------
               Reporter:  dbuitenh   |                  Owner:
                   Type:  defect     |                 Status:  new
               Priority:  normal     |              Component:  avcodec
                Version:  git-       |               Keywords:
  master                             |  multithreading h264
             Blocked By:             |               Blocking:
Reproduced by developer:  0          |  Analyzed by developer:  0
-------------------------------------+-------------------------------------
 Summary of the bug:

 The file located [http://chromashift.org/nondeterministic.mp4 here] has
 non-deterministic and corrupt output when using more than 1 thread to
 decode. This occurs with FFmpeg git master. It seems to only happen with
 frame threading.

 How to reproduce:
 {{{
 ffmpeg -threads N -i nondeterministic.mp4 -f md5 -
 }}}

 where N is greater than 1.

 Example output of three runs with threads=1:
 {{{
 MD5=0dabc8164d94a75c685252bbcdd17e90
 MD5=0dabc8164d94a75c685252bbcdd17e90
 MD5=0dabc8164d94a75c685252bbcdd17e90
 }}}

 Example output of three runs with threads=32:

 {{{
 MD5=4ba1eb94c5dd616a3a9ec23b4e7795d2
 MD5=9fa806851c71df1fe7a32a123288b80d
 MD5=35ae4fc9806cd5cc26042efa4e407692
 }}}

 Visual corruption can be seen.

 For good measure, he is full output of '''ffmpeg -threads 1 -i
 nondeterministic.mp4 -an -f null -''':

 {{{
 daemon404 at bbvm:~/dev/f/ffmpeg$ ./ffmpeg -threads 1 -i nondeterministic.mp4
 -an -f md5 -
 ffmpeg version N-79565-g656b07b Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 5.3.1 (Debian 5.3.1-14) 20160409
   configuration:
   libavutil      55. 22.101 / 55. 22.101
   libavcodec     57. 37.100 / 57. 37.100
   libavformat    57. 34.103 / 57. 34.103
   libavdevice    57.  0.101 / 57.  0.101
   libavfilter     6. 44.100 /  6. 44.100
   libswscale      4.  1.100 /  4.  1.100
   libswresample   2.  0.101 /  2.  0.101
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'nondeterministic.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp41isom
     creation_time   : 2016-03-11 22:42:03
   Duration: 00:10:06.36, start: 0.000000, bitrate: 3678 kb/s
     Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
 0x31637661), yuv420p, 1440x1080 [SAR 1:1 DAR 4:3], 3518 kb/s, 30.30 fps,
 30.30 tbr, 30303 tbn (default)
     Metadata:
       creation_time   : 2016-03-11 22:42:03
       handler_name    : VideoHandler
       encoder         : AVC Coding
     Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
 stereo, fltp, 157 kb/s (default)
     Metadata:
       creation_time   : 2016-03-11 22:42:03
       handler_name    : SoundHandler
 [md5 @ 0x3f3ae40] Using AVStream.codec to pass codec parameters to muxers
 is deprecated, use AVStream.codecpar instead.
 Output #0, md5, to 'pipe:':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: mp41isom
     encoder         : Lavf57.34.103
     Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p,
 1440x1080 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 30.30 fps, 30.30 tbn
 (default)
     Metadata:
       creation_time   : 2016-03-11 22:42:03
       handler_name    : VideoHandler
       encoder         : Lavc57.37.100 rawvideo
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
 Press [q] to stop, [?] for help
 frame=18346 fps=107 q=-0.0 Lsize=       0kB time=00:10:06.34 bitrate=
 0.0kbits/s speed=3.55x
 video:41794481kB audio:0kB subtitle:0kB other streams:0kB global
 headers:0kB muxing overhead: unknown
 }}}

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


More information about the FFmpeg-trac mailing list