Opened 7 years ago

Closed 5 years ago

#6591 closed defect (fixed)

Unable to read mp4/h264 caused by SPS decoding failure

Reported by: Christian Palmhøj Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: h264 regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Attempting to transcode the attached sample file results in an error for both 3.3.2 as well as git version N-86933-g80bc64.

This has been previously been known to work with version n2.7.2-3-gb1863e3.

Example shown for 3.3.2 (git version looks identical)

% ffmpeg -i test.mp4 -c:v libx264 -c:a aac test2.mp4
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'test.mp4'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option 'test2.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input url test.mp4.
Successfully parsed a group of options.
Opening an input file: test.mp4.
[NULL @ 0x7fc902001000] Opening 'test.mp4' for reading
[file @ 0x7fc9016000a0] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] ISO: File Type Major Brand: f4v 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 24.916667 0.010848
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 24.916667 0.010848
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 25.000000 0.000140
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 25.083333 0.007202
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 25.083333 0.007202
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] rfps: 50.000000 0.000558
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] Before avformat_find_stream_info() pos: 887991 bytes read:35746 seeks:1 nb_streams:2
[h264 @ 0x7fc902001600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902001600] Overread VUI by 2 bits
[h264 @ 0x7fc902001600] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fc902001600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902001600] Overread VUI by 2 bits
[h264 @ 0x7fc902001600] Decoding sps 0 from avcC failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] Failed to open codec in avformat_find_stream_info
[h264 @ 0x7fc902001600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902001600] Overread VUI by 2 bits
[h264 @ 0x7fc902001600] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fc902001600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902001600] Overread VUI by 2 bits
[h264 @ 0x7fc902001600] Decoding sps 0 from avcC failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc902001000] After avformat_find_stream_info() pos: 194497 bytes read:232354 seeks:2 frames:27
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: isommp42m4v 
    creation_time   : 2014-10-07T14:35:54.000000Z
  Duration: 00:00:04.12, start: 0.000000, bitrate: 1725 kb/s
    Stream #0:0(eng), 26, 1/90000: Video: h264 (avc1 / 0x31637661), none, 1280x720, 1655 kb/s, 25.01 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2014-10-07T14:35:54.000000Z
      handler_name    : WowzaStreamingEngine
      encoder         : WowzaStreamingEngine
    Stream #0:1(eng), 1, 1/90000: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2014-10-07T14:35:54.000000Z
      handler_name    : WowzaStreamingEngine
Successfully opened the file.
Parsing a group of options: output url test2.mp4.
Applying option c:v (codec name) with argument libx264.
Applying option c:a (codec name) with argument aac.
Successfully parsed a group of options.
Opening an output file: test2.mp4.
[file @ 0x7fc901600ec0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
[h264 @ 0x7fc902802c00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902802c00] Overread VUI by 2 bits
[h264 @ 0x7fc902802c00] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fc902802c00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fc902802c00] Overread VUI by 2 bits
[h264 @ 0x7fc902802c00] Decoding sps 0 from avcC failed
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Error while opening decoder for input stream #0:0 : Invalid data found when processing input
[AVIOContext @ 0x7fc901600f40] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x7fc9016001e0] Statistics: 232354 bytes read, 2 seeks

FFprobe suffers from the same failure:

% ffprobe test.mp4
ffprobe version 3.3.2 Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[NULL @ 0x7fd1be002a00] Opening 'test.mp4' for reading
[file @ 0x7fd1bc402680] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] ISO: File Type Major Brand: f4v 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 24.916667 0.010848
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 24.916667 0.010848
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 25.000000 0.000140
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 25.083333 0.007202
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 25.083333 0.007202
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] rfps: 50.000000 0.000558
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] Before avformat_find_stream_info() pos: 887991 bytes read:35746 seeks:1 nb_streams:2
[h264 @ 0x7fd1be00b600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1be00b600] Overread VUI by 2 bits
[h264 @ 0x7fd1be00b600] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fd1be00b600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1be00b600] Overread VUI by 2 bits
[h264 @ 0x7fd1be00b600] Decoding sps 0 from avcC failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] Failed to open codec in avformat_find_stream_info
[h264 @ 0x7fd1be00b600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1be00b600] Overread VUI by 2 bits
[h264 @ 0x7fd1be00b600] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fd1be00b600] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1be00b600] Overread VUI by 2 bits
[h264 @ 0x7fd1be00b600] Decoding sps 0 from avcC failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd1be002a00] After avformat_find_stream_info() pos: 194497 bytes read:232354 seeks:2 frames:27
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: isommp42m4v 
    creation_time   : 2014-10-07T14:35:54.000000Z
  Duration: 00:00:04.12, start: 0.000000, bitrate: 1725 kb/s
    Stream #0:0(eng), 26, 1/90000: Video: h264 (avc1 / 0x31637661), none, 1280x720, 1655 kb/s, 25.01 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2014-10-07T14:35:54.000000Z
      handler_name    : WowzaStreamingEngine
      encoder         : WowzaStreamingEngine
    Stream #0:1(eng), 1, 1/90000: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2014-10-07T14:35:54.000000Z
      handler_name    : WowzaStreamingEngine
[h264 @ 0x7fd1bc800000] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1bc800000] Overread VUI by 2 bits
[h264 @ 0x7fd1bc800000] SPS decoding failure, trying again after escaping the NAL
[h264 @ 0x7fd1bc800000] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x7fd1bc800000] Overread VUI by 2 bits
[h264 @ 0x7fd1bc800000] Decoding sps 0 from avcC failed
Could not open codec for input stream 0

Working version:

% ffmpeg -i test.mp4 -c:v libx264 -c:a libfaac test2.mp4
ffmpeg version n2.7.2-3-gb1863e3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/var/transcoder/dist/package/usr --enable-libspeex --enable-libfaac --enable-libfdk-aac --enable-libx264 --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-pthreads --enable-postproc --enable-nonfree --enable-librtmp --enable-shared --enable-libtheora --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libvpx --disable-demuxer='hls,applehttp' --disable-protocol=hls
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0xba2fe0] Overread VUI by 2 bits
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: isommp42m4v 
    creation_time   : 2014-10-07 14:35:54
  Duration: 00:00:04.12, start: 0.000000, bitrate: 1725 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720, 1655 kb/s, 25.01 fps, 25 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2014-10-07 14:35:54
      handler_name    : WowzaStreamingEngine
      encoder         : WowzaStreamingEngine
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2014-10-07 14:35:54
      handler_name    : WowzaStreamingEngine
File 'test2.mp4' already exists. Overwrite ? [y/N] y
[libx264 @ 0xd59d20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0xd59d20] profile High, level 3.1
[libx264 @ 0xd59d20] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[h264 @ 0x1264ae0] Overread VUI by 2 bits
Output #0, mp4, to 'test2.mp4':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: isommp42m4v 
    encoder         : Lavf56.36.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2014-10-07 14:35:54
      handler_name    : WowzaStreamingEngine
      encoder         : Lavc56.41.100 libx264
    Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2014-10-07 14:35:54
      handler_name    : WowzaStreamingEngine
      encoder         : Lavc56.41.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
Press [q] to stop, [?] for help
[h264 @ 0x13937c0] Overread VUI by 2 bits
[h264 @ 0x1264ae0] Overread VUI by 2 bitsB time=00:00:02.85 bitrate= 502.0kbits/s    
frame=  103 fps= 52 q=-1.0 Lsize=     620kB time=00:00:04.04 bitrate=1256.9kbits/s    
video:577kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.874109%
[libx264 @ 0xd59d20] frame I:2     Avg QP:18.74  size: 19168
[libx264 @ 0xd59d20] frame P:65    Avg QP:20.67  size:  6911
[libx264 @ 0xd59d20] frame B:36    Avg QP:22.38  size:  2860
[libx264 @ 0xd59d20] consecutive B-frames: 46.6% 17.5%  8.7% 27.2%
[libx264 @ 0xd59d20] mb I  I16..4: 35.5% 58.8%  5.7%
[libx264 @ 0xd59d20] mb P  I16..4:  2.2%  3.4%  0.1%  P16..4: 45.0%  5.2%  4.7%  0.0%  0.0%    skip:39.3%
[libx264 @ 0xd59d20] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8: 42.7%  0.8%  0.0%  direct: 2.7%  skip:53.5%  L0:47.6% L1:52.0% BI: 0.4%
[libx264 @ 0xd59d20] 8x8 transform intra:59.1% inter:90.2%
[libx264 @ 0xd59d20] coded y,uvDC,uvAC intra: 31.7% 42.4% 1.6% inter: 8.4% 18.2% 0.0%
[libx264 @ 0xd59d20] i16 v,h,dc,p: 23% 26% 23% 28%
[libx264 @ 0xd59d20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 21% 42%  3%  2%  2%  3%  2%  7%
[libx264 @ 0xd59d20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 27% 19%  5%  6%  6%  4%  3% 10%
[libx264 @ 0xd59d20] i8c dc,h,v,p: 59% 24% 15%  3%
[libx264 @ 0xd59d20] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xd59d20] ref P L0: 75.3%  4.1% 14.8%  5.8%
[libx264 @ 0xd59d20] ref B L0: 89.3%  9.5%  1.1%
[libx264 @ 0xd59d20] ref B L1: 95.3%  4.7%
[libx264 @ 0xd59d20] kb/s:1146.66

Note that because of the older version, libfaac is used instead of aac but the end result is the same (also tried with other output formats, it makes no difference to either the working or non-working versions.

Attachments (1)

test.mp4 (867.2 KB ) - added by Christian Palmhøj 7 years ago.
Sample file (from live recording)

Download all attachments as: .zip

Change History (3)

by Christian Palmhøj, 7 years ago

Attachment: test.mp4 added

Sample file (from live recording)

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: ffmpegavcodec
Keywords: h264 regression added
Priority: normalimportant
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

comment:2 by James, 5 years ago

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