Opened 6 years ago
Closed 6 years ago
#7332 closed defect (worksforme)
ffmpeg hangs when converting some crafted MP4 videos to MOV/MP4
Reported by: | HongxuChen | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | hongxuchen@outlook.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When ffmpeg converts some crafted MP4 videos, it may hang for quite a long time.
How to reproduce:
% ffmpeg -i ./hang_1.mp4 -filter:v scale=360:-1 -c:a copy -f mp4 -y /dev/null ffmpeg version: N-91528-ged647ab79f built on clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Attachments (2)
Change History (7)
by , 6 years ago
Attachment: | hang_2.mp4 added |
---|
by , 6 years ago
Attachment: | hang_1.mp4 added |
---|
comment:1 by , 6 years ago
Version: | unspecified → git-master |
---|
comment:2 by , 6 years ago
Cc: | added |
---|---|
Component: | undetermined → ffmpeg |
comment:4 by , 6 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Can you please check the command I used (ffmpeg -i ./hang_1.mp4 -filter:v scale=360:-1 -c:a copy -f mp4 -y /dev/null
)? It seems that when converting to avi
there is no such a problem; however quite bad when converting to MOV/MP4. I also found several others that have this issue (see https://github.com/ntu-sec/pocs/tree/master/ffmpeg-5aeb3b0080/hangs). All of them took more than 120s to finish.
ffmpeg version N-91559-g5aeb3b0080 Copyright (c) 2000-2018 the FFmpeg developers
built with clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
configuration: --prefix=/home/exp/FOT/ffmpeg-noasan/install --cc=clang --cxx=clang++ --enable-debug=2 --extra-cflags=-g --extra-cxxflags=-g
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 22.100 / 58. 22.100
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
Hyper fast Audio and Video encoder
comment:5 by , 6 years ago
Component: | ffmpeg → undetermined |
---|---|
Resolution: | → worksforme |
Status: | reopened → closed |
$ ffmpeg -i ./hang_1.mp4 -filter:v scale=360:-1 -c:a copy -f mp4 -y /dev/null ffmpeg version N-91571-gaa8e5ee Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.4.0 (GCC) configuration: --enable-gpl --enable-gnutls --enable-libxml2 libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 22.100 / 58. 22.100 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x4034680] overread end of atom 'stsd' by 16121600 bytes [mov,mp4,m4a,3gp,3g2,mj2 @ 0x4034680] Found duplicated MOOV Atom. Skipped it [mov,mp4,m4a,3gp,3g2,mj2 @ 0x4034680] wrong sample count [h264 @ 0x4036100] error while decoding MB 0 3, bytestream 98 [h264 @ 0x4036100] concealing 9 DC, 9 AC, 9 MV errors in I frame [h264 @ 0x4036100] error while decoding MB 0 3, bytestream -36 [h264 @ 0x4036100] concealing 9 DC, 9 AC, 9 MV errors in P frame [h264 @ 0x4036100] error while decoding MB 0 3, bytestream -47 [h264 @ 0x4036100] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x4036100] error while decoding MB 0 3, bytestream -47 [h264 @ 0x4036100] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x4036100] no frame! [h264 @ 0x4036100] Invalid NAL unit size (4194306 > 21). [h264 @ 0x4036100] Error splitting the input into NAL units. [h264 @ 0x4036100] Invalid NAL unit 9, skipping. [h264 @ 0x4036100] no frame! Truncating packet of size 268435461 to 61161 [h264 @ 0x4036100] Invalid NAL unit size (1718909296 > 61150). [h264 @ 0x4036100] Error splitting the input into NAL units. Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './hang_1.mp4': Metadata: major_brand : mp42 minor_version : 19529854 compatible_brands: mp42isom Duration: 11:32:50.48, start: 0.083333, bitrate: 0 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv422p(tv, GBR), 16x144 [SAR 1:1 DAR 1:9], SAR 1:32 DAR 1:288, 12 tbn, 24 tbc (default) Metadata: rotate : 0 creation_time : 2014-11-14T07:34:24.000000Z handler_name : dia?Handler encoder : AVC Coding Side data: displaymatrix: rotation of -0.00 degrees Stream #0:1(eng): Data: none, SAR 1:32 DAR 0:0 (default) Metadata: rotate : 0 creation_time : 2014-11-14T05:09:20.000000Z handler_name : dia Handler Stream #0:2(eng): Data: none, SAR 1:32 DAR 0:0 (default) Metadata: rotate : 0 creation_time : 2014-11-14T05:09:20.000000Z handler_name : dia Handler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [h264 @ 0x406f5c0] error while decoding MB 0 3, bytestream 98 [h264 @ 0x406f5c0] concealing 9 DC, 9 AC, 9 MV errors in I frame [h264 @ 0x406fe00] error while decoding MB 0 3, bytestream -36 [h264 @ 0x406fe00] concealing 9 DC, 9 AC, 9 MV errors in P frame [h264 @ 0x40aa100] error while decoding MB 0 3, bytestream -47 [h264 @ 0x40aa100] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x40ad0c0] error while decoding MB 0 3, bytestream -47 [h264 @ 0x40ad0c0] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x406db80] no frame! [h264 @ 0x41ab800] Invalid NAL unit size (4194306 > 21). [h264 @ 0x41ab800] Error splitting the input into NAL units. [h264 @ 0x406f5c0] Invalid NAL unit 5, skipping. [h264 @ 0x406f5c0] no frame! Output #0, mp4, to '/dev/null': Metadata: major_brand : mp42 minor_version : 19529854 compatible_brands: mp42isom encoder : Lavf58.17.101 Stream #0:0(eng): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 360x3240 [SAR 1:32 DAR 1:288], q=2-31, 200 kb/s, 12288 tbn, 12 tbc (default) Metadata: encoder : Lavc58.22.100 mpeg4 creation_time : 2014-11-14T07:34:24.000000Z handler_name : dia?Handler Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 displaymatrix: rotation of -0.00 degrees [h264 @ 0x406fe00] Invalid NAL unit size (1718909296 > 61150). [h264 @ 0x406fe00] Error splitting the input into NAL units. Error while decoding stream #0:0: Invalid data found when processing input More than 1000 frames duplicated Error while decoding stream #0:0: Invalid data found when processing input Error while decoding stream #0:0: Invalid data found when processing inputbits/s dup=65530 drop=2 speed=67.8x Last message repeated 1 times frame=65534 fps=813 q=1.6 Lsize= 106203kB time=01:31:01.08 bitrate= 159.3kbits/s dup=65530 drop=3 speed=67.8x video:105923kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.264165%
$ ffmpeg -i ./hang_2.mp4 -filter:v scale=360:-1 -c:a copy -f mp4 -y /dev/null ffmpeg version N-91571-gaa8e5ee Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.4.0 (GCC) configuration: --enable-gpl --enable-gnutls --enable-libxml2 libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 22.100 / 58. 22.100 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x409c680] stream 1, timescale not set [mov,mp4,m4a,3gp,3g2,mj2 @ 0x409c680] overread end of atom 'stsd' by 16121600 bytes [mov,mp4,m4a,3gp,3g2,mj2 @ 0x409c680] Found duplicated MOOV Atom. Skipped it [mov,mp4,m4a,3gp,3g2,mj2 @ 0x409c680] wrong sample count [mov,mp4,m4a,3gp,3g2,mj2 @ 0x409c680] stream 2, timescale not set Truncating packet of size 268435461 to 5699 [h264 @ 0x409e100] error while decoding MB 0 3, bytestream 98 [h264 @ 0x409e100] concealing 9 DC, 9 AC, 9 MV errors in I frame [h264 @ 0x409e100] error while decoding MB 0 3, bytestream -36 [h264 @ 0x409e100] concealing 9 DC, 9 AC, 9 MV errors in P frame [h264 @ 0x409e100] error while decoding MB 0 3, bytestream -47 [h264 @ 0x409e100] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x409e100] error while decoding MB 0 3, bytestream -47 [h264 @ 0x409e100] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x409e100] no frame! [h264 @ 0x409e100] error while decoding MB 0 8, bytestream -21 [h264 @ 0x409e100] concealing 9 DC, 9 AC, 9 MV errors in P frame Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './hang_2.mp4': Metadata: major_brand : mp42 minor_version : 19529854 compatible_brands: mp42isom Duration: 11:32:50.48, start: 0.083333, bitrate: 0 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv422p(tv, GBR), 16x144 [SAR 1:1 DAR 1:9], SAR 1:32 DAR 1:288, 12 tbn, 24 tbc (default) Metadata: rotate : 0 creation_time : 2014-11-14T07:34:24.000000Z handler_name : dia?Handler encoder : AVC Coding Side data: displaymatrix: rotation of -0.00 degrees Stream #0:1: Data: none (default) Metadata: rotate : 0 Stream #0:2: Data: none (default) Metadata: rotate : 0 Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native)) Press [q] to stop, [?] for help [h264 @ 0x40aacc0] error while decoding MB 0 3, bytestream 98 [h264 @ 0x40aacc0] concealing 9 DC, 9 AC, 9 MV errors in I frame [h264 @ 0x40fb3c0] error while decoding MB 0 3, bytestream -36 [h264 @ 0x40fb3c0] concealing 9 DC, 9 AC, 9 MV errors in P frame [h264 @ 0x4101dc0] error while decoding MB 0 3, bytestream -47 [h264 @ 0x4101dc0] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x4177400] error while decoding MB 0 3, bytestream -47 [h264 @ 0x4177400] concealing 9 DC, 9 AC, 9 MV errors in B frame [h264 @ 0x41aff00] no frame! [h264 @ 0x4205540] error while decoding MB 0 8, bytestream -21 [h264 @ 0x4205540] concealing 9 DC, 9 AC, 9 MV errors in P frame [h264 @ 0x40aacc0] Invalid NAL unit 5, skipping. [h264 @ 0x40aacc0] no frame! Output #0, mp4, to '/dev/null': Metadata: major_brand : mp42 minor_version : 19529854 compatible_brands: mp42isom encoder : Lavf58.17.101 Stream #0:0(eng): Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 360x3240 [SAR 1:32 DAR 1:288], q=2-31, 200 kb/s, 12288 tbn, 12 tbc (default) Metadata: encoder : Lavc58.22.100 mpeg4 creation_time : 2014-11-14T07:34:24.000000Z handler_name : dia?Handler Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 displaymatrix: rotation of -0.00 degrees [h264 @ 0x40fb3c0] Invalid NAL unit size (1718909296 > 5688). [h264 @ 0x40fb3c0] Error splitting the input into NAL units. Error while decoding stream #0:0: Invalid data found when processing input More than 1000 frames duplicated Error while decoding stream #0:0: Invalid data found when processing input8kbits/s dup=1114107 drop=2 speed=68.3x Last message repeated 1 times frame=1114112 fps=820 q=2.0 Lsize= 1805127kB time=25:47:22.58 bitrate= 159.3kbits/s dup=1114107 drop=3 speed=68.3x video:1800384kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.263452%