#9523: segment_times splits at I-frames that are not keyframes ------------------------------------+----------------------------------- Reporter: TurboLed | Owner: (none) Type: defect | Status: open Priority: normal | Component: avcodec Version: git-master | Resolution: Keywords: h264 | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+----------------------------------- Comment (by Tsuyoshi): I am also facing the same issue. Is this issue will not be fixed? It seems that if stream does not have B-frame, all of I-frame will be marked as Keyframe in container. Here is the procedure to reproduce this issue. 1. encode BBB file first 30sec. ffmpeg -t 30 -i bbb.mp4 -preset ultrafast -profile:v baseline -sc_threshold 50 encoded.mp4 dump all I-frames. frame, key_frame, pts, pict_type, coded_picture_number {{{ frame,1,0.000000,I,0 frame,0,0.100000,I,3 frame,0,0.133333,I,4 frame,0,0.166667,I,5 frame,0,0.200000,I,6 frame,0,0.233333,I,7 frame,1,4.066667,I,122 frame,0,4.200000,I,126 frame,0,4.233333,I,127 frame,0,4.466667,I,134 frame,1,12.400000,I,372 frame,1,16.300000,I,489 frame,1,20.166667,I,605 frame,1,27.466667,I,824 }}} This is stss Box. {{{ [stss] Size=40 Version=0 Flags=0x000000 EntryCount=6 SampleNumber=[1, 123, 373, 490, 606, 825] }}} 2. remux encoded.mp4 file ffmpeg -i encoded.mp4 -c copy remuxed.mp4 dump all I-frames. This is same as encoded.mp4 frame, key_frame, pts, pict_type, coded_picture_number {{{ frame,1,0.000000,I,0 frame,0,0.100000,I,3 frame,0,0.133333,I,4 frame,0,0.166667,I,5 frame,0,0.200000,I,6 frame,0,0.233333,I,7 frame,1,4.066667,I,122 frame,0,4.200000,I,126 frame,0,4.233333,I,127 frame,0,4.466667,I,134 frame,1,12.400000,I,372 frame,1,16.300000,I,489 frame,1,20.166667,I,605 frame,1,27.466667,I,824 }}} All of I-frames are marked as keyframe in stss box. {{{ [stss] Size=72 Version=0 Flags=0x000000 EntryCount=14 SampleNumber=[1, 4, 5, 6, 7, 8, 123, 127, 128, 135, 373, 490, 606, 825] }}} I think that h264_parser.c should not include following code. Because It is just for the specific camera... If we necessary following code, it should be more restricted code. {{{ // heuristic to detect non marked keyframes if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) s->key_frame = 1; }}} -- Ticket URL: <https://trac.ffmpeg.org/ticket/9523#comment:21> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker