I am very new to video codecs and just trying to figure out what its all about
I compiled ffmpeg library, and made a small C++ program that can extract key frames and save them as images from the videos.
I also noted that distance between keyframes is not even (for most of the videos that I tried divx, xvid mpeg4...)
Distance can vary from 1 to up to 300 frames. As I understand its related to shots encoding, eg new keyframe is inserted only if its very different to previous frame.
(In order to save space)
This is my question: When I convert videos with ffmpeg through console, I can manually specify keyframe distance, default parameter -g and its set to 12.
Is there any way to encode video with FFmpeg so that keframe distance will be variable ? (rather than consistent 12 frames or any other static number)
+ Reply to Thread
Results 1 to 3 of 3
9 years later i'm playing with ffmpeg encoding "compilant dvix home theater" files for i'm not sure yet which reason... but i'm stuck with that defalut -g 12 in there. i can override it by setting manual max keyframe to ...120... but now the keyfamres are every 120 seconds despite scene change. WTF. I change the library to x264 and boom, keyframes are normal, following scene changes... back to mpeg4 or libxvid, it gets back evil. What are we doing wrong? does that -12 flag is burnt into ffmpeg since decades and nobody figured out it would be great to remove it as those libs aren't much used these days?