#9523: segment_times splits at I-frames that are not keyframes ------------------------------------+------------------------------------ Reporter: TurboLed | Owner: (none) Type: defect | Status: new Priority: normal | Component: avfilter Version: git-master | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ------------------------------------+------------------------------------ Comment (by TurboLed): Replying to [comment:6 Balling]:
Okay, first of all I cannot reproduce it. Second of all what I can reproduce is that it does not do 3 segments but only two here!
The video is 5 seconds long, the command line (-segment_times 3) asks to split the video at 3 seconds to create 2 segments (first segment: 3 seconds, second segment: 2 seconds)
Also, on your file (remember to use https://temp-mail.org/ to download files from that site)
ffprobe.exe -skip_frame nokey -i sample_48fps_iframes.mp4 -show_frames
prints only two frames, which I suppose is BS:
{{{ media_type=video stream_index=0 key_frame=1 pkt_pts=0 pkt_pts_time=0.000000 pkt_dts=120120 pkt_dts_time=2.502500 }}}
The video is only 5 seconds long, so it contains only 2 IDR keyframes, but contains also several intermediate I-frames every 0.625 seconds or so.
I will aslo point out that in my case the files work. Both of them. :)
Yes, this short sample will work okay in your player. But the problem is that the second segment starts with an I-frame that is not an IDR frame (i.e. the first frame of output001.mp4 is not reported as a key_frame=1 by ffprobe). The consequence is that for another, longer sample, that means that the first frame might be referring to a frame in the previous part of the video which doesn't exist anymore, because only IDR keyframes are complete and fully independent. I can find and upload a much longer sample that illustrates the problem better, but we are talking gigs of video. Believe me this is an issue when splitting and joining segments, where some segments cannot start properly because of missing information from the previous frames. In my case the video can lose track and recover after several seconds (because each IDR is 5 seconds apart). I still believe this is independent from #8820 because it is about the -f segment feature, not about what ffprobe reports. For the sake of this issue, ffprobe reports the correct thing (i.e. there is no keyframe at the start of the second segment, so it should not have accepted to split there.) The segment feature (-f segment) should split only at IDR frames because that's what a real keyframe is, not I-frames. -- Ticket URL: <https://trac.ffmpeg.org/ticket/9523#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker