[FFmpeg-trac] #6699(avformat:new): MP4 with HEVC keyint=2 not decoded properly due to edit list (first frames are missing)

FFmpeg trac at avcodec.org
Tue Sep 26 16:26:30 EEST 2017


#6699: MP4 with HEVC keyint=2 not decoded properly due to edit list (first frames
are missing)
-------------------------------------+-------------------------------------
             Reporter:  tospi        |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avformat     |                  Version:  git-
             Keywords:  mov hevc     |  master
  edts                               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Problem: HEVC streams encoded with short key intervals (2,4,...) inside
 MP4 cannot be decoded properly.

 Description: The first few frames (probably the first GOP) are missing and
 not decoded (not reaching the decoder). In earlier versions of FFmpeg
 (e.g. FFmpeg 2.8.11), decoding of the same file works without problems. In
 the current version, decoding only works if "-ignore_editlist 1" is
 specified, so apparently the edit list feature is somehow not working
 correctly in this case.

 Command to produce the MP4 file (file is also attached):
 {{{
 % ./ffmpeg -f lavfi -i testsrc=duration=1 -c:v libx265 -x265-params
 keyint=2 hevc_keyint2.mp4
 ffmpeg version N-87394-g89a2472ec5-static http://johnvansickle.com/ffmpeg/
 Copyright (c) 2000-2017 the FFmpeg developers
   built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
   configuration: --enable-gpl --enable-version3 --enable-static --disable-
 debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
 --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
 gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-
 libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-
 librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-
 libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxvid --enable-libzimg
   libavutil      55. 76.100 / 55. 76.100
   libavcodec     57.106.101 / 57.106.101
   libavformat    57. 82.101 / 57. 82.101
   libavdevice    57.  8.101 / 57.  8.101
   libavfilter     6.106.100 /  6.106.100
   libswscale      4.  7.103 /  4.  7.103
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, lavfi, from 'testsrc=duration=1':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240
 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
 File 'hevc_keyint2.mp4' already exists. Overwrite ? [y/N] y^C
 thomas at thomas-desktop:~/Downloads/ffmpeg-git-20170926-64bit-static$
 ./ffmpeg -f lavfi -i testsrc=duration=1 -c:v libx265 -x265-params keyint=2
 hevc_keyint2.mp4
 ffmpeg version N-87394-g89a2472ec5-static http://johnvansickle.com/ffmpeg/
 Copyright (c) 2000-2017 the FFmpeg developers
   built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
   configuration: --enable-gpl --enable-version3 --enable-static --disable-
 debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
 --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
 gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-
 libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-
 librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-
 libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxvid --enable-libzimg
   libavutil      55. 76.100 / 55. 76.100
   libavcodec     57.106.101 / 57.106.101
   libavformat    57. 82.101 / 57. 82.101
   libavdevice    57.  8.101 / 57.  8.101
   libavfilter     6.106.100 /  6.106.100
   libswscale      4.  7.103 /  4.  7.103
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, lavfi, from 'testsrc=duration=1':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240
 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
 File 'hevc_keyint2.mp4' already exists. Overwrite ? [y/N] y
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> hevc (libx265))
 Press [q] to stop, [?] for help
 x265 [info]: HEVC encoder version 2.5+17-f8ae7afc1f61
 x265 [info]: build info [Linux][GCC 6.4.0][64 bit] 8bit+10bit+12bit
 x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX
 FMA3 BMI2 AVX2
 x265 [info]: Main 4:4:4 profile, Level-2 (Main tier)
 x265 [info]: Thread pool created using 16 threads
 x265 [info]: Slices                              : 1
 x265 [info]: frame threads / pool features       : 4 / wpp(4 rows)
 x265 [warning]: Source height < 720p; disabling lookahead-slices
 x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
 x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
 x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
 x265 [info]: Keyframe min / max / scenecut / bias: 1 / 2 / 40 / 5.00
 x265 [info]: Cb/Cr QP Offset                     : 6 / 6
 x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
 x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
 x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
 x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
 x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
 x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-
 smoothing
 x265 [info]: tools: deblock sao
 Output #0, mp4, to 'hevc_keyint2.mp4':
   Metadata:
     encoder         : Lavf57.82.101
     Stream #0:0: Video: hevc (libx265) (hev1 / 0x31766568), gbrp, 320x240
 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 12800 tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.106.101 libx265
 [Parsed_testsrc_0 @ 0x3ff8800] EOF timestamp not reliable
 frame=   25 fps=0.0 q=-0.0 Lsize=      35kB time=00:00:00.88 bitrate=
 321.2kbits/s speed=1.84x
 video:31kB audio:0kB subtitle:0kB other streams:0kB global headers:2kB
 muxing overhead: 9.688936%
 x265 [info]: frame I:     13, Avg QP:30.75  kb/s: 486.43
 x265 [info]: frame P:      1, Avg QP:32.27  kb/s: 34.20
 x265 [info]: frame B:     11, Avg QP:39.00  kb/s: 5.87
 x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
 x265 [info]: consecutive B-frames: 21.4% 78.6% 0.0% 0.0% 0.0%

 encoded 25 frames in 0.46s (54.66 fps), 256.90 kb/s, Avg QP:34.44
 }}}


 Decoding command with current version that is missing frames (22 frames):

 {{{
 % ./ffmpeg -i hevc_keyint2.mp4 -f null -
 ffmpeg version N-87394-g89a2472ec5-static http://johnvansickle.com/ffmpeg/
 Copyright (c) 2000-2017 the FFmpeg developers
   built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
   configuration: --enable-gpl --enable-version3 --enable-static --disable-
 debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
 --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
 gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-
 libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-
 librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-
 libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxvid --enable-libzimg
   libavutil      55. 76.100 / 55. 76.100
   libavcodec     57.106.101 / 57.106.101
   libavformat    57. 82.101 / 57. 82.101
   libavdevice    57.  8.101 / 57.  8.101
   libavfilter     6.106.100 /  6.106.100
   libswscale      4.  7.103 /  4.  7.103
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hevc_keyint2.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf57.82.101
   Duration: 00:00:01.00, start: 0.040000, bitrate: 282 kb/s
     Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), gbrp(tv,
 gbr/unknown/unknown, progressive), 320x240 [SAR 1:1 DAR 4:3], 257 kb/s, 25
 fps, 25 tbr, 12800 tbn, 25 tbc (default)
     Metadata:
       handler_name    : VideoHandler
 Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
 Press [q] to stop, [?] for help
 Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf57.82.101
     Stream #0:0(und): Video: wrapped_avframe, gbrp, 320x240 [SAR 1:1 DAR
 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
     Metadata:
       handler_name    : VideoHandler
       encoder         : Lavc57.106.101 wrapped_avframe
 frame=   22 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.92 bitrate=N/A speed=
 75x
 video:11kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 }}}


 Extended decoding command with current version that is working (25
 frames):

 {{{
 % ./ffmpeg -ignore_editlist 1 -i hevc_keyint2.mp4 -f null -
 ffmpeg version N-87394-g89a2472ec5-static http://johnvansickle.com/ffmpeg/
 Copyright (c) 2000-2017 the FFmpeg developers
   built with gcc 6.4.0 (Debian 6.4.0-5) 20170906
   configuration: --enable-gpl --enable-version3 --enable-static --disable-
 debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio
 --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-
 gray --enable-libfribidi --enable-libass --enable-libvmaf --enable-
 libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-
 librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-
 libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxvid --enable-libzimg
   libavutil      55. 76.100 / 55. 76.100
   libavcodec     57.106.101 / 57.106.101
   libavformat    57. 82.101 / 57. 82.101
   libavdevice    57.  8.101 / 57.  8.101
   libavfilter     6.106.100 /  6.106.100
   libswscale      4.  7.103 /  4.  7.103
   libswresample   2.  8.100 /  2.  8.100
   libpostproc    54.  6.100 / 54.  6.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hevc_keyint2.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf57.82.101
   Duration: 00:00:01.00, start: 0.080000, bitrate: 282 kb/s
     Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), gbrp(tv,
 gbr/unknown/unknown, progressive), 320x240 [SAR 1:1 DAR 4:3], 257 kb/s, 25
 fps, 25 tbr, 12800 tbn, 25 tbc (default)
     Metadata:
       handler_name    : VideoHandler
 Stream mapping:
   Stream #0:0 -> #0:0 (hevc (native) -> wrapped_avframe (native))
 Press [q] to stop, [?] for help
 Output #0, null, to 'pipe:':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2mp41
     encoder         : Lavf57.82.101
     Stream #0:0(und): Video: wrapped_avframe, gbrp, 320x240 [SAR 1:1 DAR
 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
     Metadata:
       handler_name    : VideoHandler
       encoder         : Lavc57.106.101 wrapped_avframe
 frame=   25 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A
 speed=81.6x
 video:13kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 }}}

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


More information about the FFmpeg-trac mailing list