VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 3 of 3
  1. HI All,

    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)

    Quote Quote  
  2. Member
    Join Date
    Apr 2020
    Search Comp PM
    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?
    Quote Quote  
  3. Member
    Join Date
    Aug 2013
    Central Germany
    Search PM
    Scene change detection and variable GOP length will be a matter of the specific encoder, not ffmpeg as a whole. You may have to check the codec specific flags for fine tuning this behaviour.
    Quote Quote  

Similar Threads