I have been recording TV shows on a PC with tuner cards and a software PVR (NextPVR) for some years now.
Recently, after an initial edit with Avidemux, but before converting with FFmpeg, I've been adding chapters (via a mkv chaptermark file or a FFmpeg FMETADATA file) where the commercials were, at the corresponding Keyframes/I-Frames.
The problem is, the timings of these frames are different before and after FFmpeg, and I have to manually go over and correct them one-by-one. If I don't, I run into a different problems during chapter jumps when playing back (depending on the software).
Any ideas on how to accurately chapter-mark a video before converting? Or how to calculate the timing-drifts of the Keyframes/I-Frames?
+ Reply to Thread
Results 1 to 3 of 3
If you are using x264, you use a qp file to specify where IDR frames ("true" keyframes) are placed when encoding, corresponding to your chapters points.
There is a utility called chaptergen that can help with this
One issue with ffmpeg libx264, is it does not support qpfile through -x264opts or -x264params (or at least it did not in the past) . You have to use x264cli
The default settings for libx264 is -g 250 (the max keyframe interval is 250 frames) , but if you have scenecut enabled, it will automatically insert IDR frames as it it appropriate (scenechanges). If you reduce the distance, there is greater likelihood of it getting closer to where you want it (the "penalty" is generally reduced compression efficiency in typical bitrate ranges), but it's "better" to set them exactly and precisely with a qpfile
Last edited by Simon_Haddad; 21st May 2020 at 18:32.