VideoHelp Forum




+ Reply to Thread
Results 1 to 22 of 22
  1. I download a lot of FLVs to edit and often the keyframes are 10 to 12 seconds apart, which makes it very difficult to do lossless keyframe editing without losing scenes that I want to keep. Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.

    How can i convert these FLVs to a format where the keyframes are much closer together so that I can edit more precisely? And is there a way to do this losslessly, without degrading the video's quality? Thanks.
    Quote Quote  
  2. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    Originally Posted by gumbygum View Post
    Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.
    That's because key frames(keyframes) have ZERO to do with scene changes. Never have. Never will.
    Quote Quote  
  3. Originally Posted by hech54 View Post
    Originally Posted by gumbygum View Post
    Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.
    That's because key frames(keyframes) have ZERO to do with scene changes. Never have. Never will.
    Actually, it depends on the encoder. For decent modern encoders, keyframes are usually inserted at every scene change



    @gumbygum - there is no way to do this losslessly, without degrading the quality - unless you keep it uncompressed or losslessly compressed (huge filesizes) . e.g you could encode to a lossless intermediate like lagarith, ut video codec, and edit that, but the filesizes will be enormous. If you re-encode to a lossy format again after the edits , you will lose quality
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    The choice of (placement of) keyframes is integral to how it is encoded. You change that placement, you HAVE to reencode.

    Scott
    Quote Quote  
  5. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    Originally Posted by poisondeathray View Post
    Originally Posted by hech54 View Post
    Originally Posted by gumbygum View Post
    Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.
    That's because key frames(keyframes) have ZERO to do with scene changes. Never have. Never will.
    Actually, it depends on the encoder. For decent modern encoders, keyframes are usually inserted at every scene change
    I'd LOVE to see an example of that.....especially with an FLV file.
    Quote Quote  
  6. OK, thanks for the replies. Well, can I achieve this if I re-encode? If I just use a converter to convert it to MP4 or AVI or other format, how can I make the keyframes be closer together? Or will the keyframes still be 10-12 seconds apart in the new format?
    Quote Quote  
  7. Originally Posted by hech54 View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by hech54 View Post
    Originally Posted by gumbygum View Post
    Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.
    That's because key frames(keyframes) have ZERO to do with scene changes. Never have. Never will.
    Actually, it depends on the encoder. For decent modern encoders, keyframes are usually inserted at every scene change
    I'd LOVE to see an example of that.....especially with an FLV file.
    ever hear of something called x264 ? or youtube ?
    Quote Quote  
  8. Originally Posted by gumbygum View Post
    OK, thanks for the replies. Well, can I achieve this if I re-encode? If I just use a converter to convert it to MP4 or AVI or other format, how can I make the keyframes be closer together? Or will the keyframes still be 10-12 seconds apart in the new format?

    When you decode the file , is decoded to uncompressed frames, so it doesn't matter where you cut

    You can edit wherever you want and if you re-encode you can put keyframes whereever you want . Just set a max keyframe interval . Or you want even more precision you can even use a list with x264 , a qp file
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    Originally Posted by gumbygum View Post
    OK, thanks for the replies. Well, can I achieve this if I re-encode? If I just use a converter to convert it to MP4 or AVI or other format, how can I make the keyframes be closer together? Or will the keyframes still be 10-12 seconds apart in the new format?

    When you decode the file , is decoded to uncompressed frames, so it doesn't matter where you cut

    You can edit wherever you want and if you re-encode you can put keyframes whereever you want . Just set a max keyframe interval . Or you want even more precision you can even use a list with x264 , a qp file
    Thanks. I want to keep it as simple as possible because a lot of this technical stuff goes over my head. What freeware program would you recommend to re-encode the file and specify a keyframe interval?

    A lot of these FLVs are H.264s inside. Does that make a difference? Any way a program like FLV Extract can be useful with this problem?
    Quote Quote  
  10. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    I have one question.

    Are you, by any chance, confusing keyframes with I-frames ?
    Quote Quote  
  11. Originally Posted by DB83 View Post
    I have one question.

    Are you, by any chance, confusing keyframes with I-frames ?
    Aren't they the same thing? The menu says "next keyframe" and "previous keyframe." That's all. I assume these must be I-frames. Frames that stand alone and don't need to refer to another frame.
    Quote Quote  
  12. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by gumbygum View Post
    Originally Posted by DB83 View Post
    I have one question.

    Are you, by any chance, confusing keyframes with I-frames ?
    Aren't they the same thing? The menu says "next keyframe" and "previous keyframe." That's all. I assume these must be I-frames. Frames that stand alone and don't need to refer to another frame.
    Nope. What you describe are I-frames. Read the previous replies which actually discus keyframes. There could be several I-frames between two keyframes.

    What software are you using ? Is it possible to upload one of these flv's ?
    Quote Quote  
  13. Originally Posted by gumbygum View Post

    Thanks. I want to keep it as simple as possible because a lot of this technical stuff goes over my head. What freeware program would you recommend to re-encode the file and specify a keyframe interval?
    If you're doing this because of editing, it's still not the optimal way to do it .

    You wouldn't re-encode with short keyframe intevals then make cuts.

    You would edit it first, then encode it, because your cuts will be frame accurate and there will be no problems joining. If you don't need to edit it again later, there is no reason to place keyframes at a certain interval (longer intervals reduce compression efficiency)

    But, basically any GUI for x264 will allow you to place a maximum keyframe interval . e.g. ripbot, megui, xvid4psp, dozens of others... Normally "scenecut" is activated - this it will automatically place an IDR frame during a scenechange, but also abide by that max keyframe interval

    e.g. if the fps is 30 and you want 2 sec intervals you would specify 60 as the max keyframe interval


    A lot of these FLVs are H.264s inside. Does that make a difference? Any way a program like FLV Extract can be useful with this problem?
    No difference, because what I'm suggesting is editing it in the uncompressed domain (making cuts anywhere), then re-encoding it.

    It was already discussed that lossless (keyframe only cuts) editing isn't an option for you. You have to re-encode
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    Originally Posted by gumbygum View Post

    Thanks. I want to keep it as simple as possible because a lot of this technical stuff goes over my head. What freeware program would you recommend to re-encode the file and specify a keyframe interval?
    If you're doing this because of editing, it's still not the optimal way to do it .

    You wouldn't re-encode with short keyframe intevals then make cuts.

    You would edit it first, then encode it, because your cuts will be frame accurate and there will be no problems joining. If you don't need to edit it again later, there is no reason to place keyframes at a certain interval (longer intervals reduce compression efficiency)

    But, basically any GUI for x264 will allow you to place a maximum keyframe interval . e.g. ripbot, megui, xvid4psp, dozens of others... Normally "scenecut" is activated - this it will automatically place an IDR frame during a scenechange, but also abide by that max keyframe interval

    e.g. if the fps is 30 and you want 2 sec intervals you would specify 60 as the max keyframe interval


    A lot of these FLVs are H.264s inside. Does that make a difference? Any way a program like FLV Extract can be useful with this problem?
    No difference, because what I'm suggesting is editing it in the uncompressed domain (making cuts anywhere), then re-encoding it.

    It was already discussed that lossless (keyframe only cuts) editing isn't an option for you. You have to re-encode
    Thanks for this advice. What I was thinking of doing was to re-encode it with keyframes at 1 second intervals, and then use a lossless keyframe editor to do the edit, so there would only be 1 generation of quality loss, not two. But your idea is better, because I could cut precisely where I want, not compromise by cutting at 1 second intervals.

    But what editor can cut FLV files with single frame precision and then re-encode the edited file as an MP4 or whatever? I am not aware of any freeware editor that can do this.
    Quote Quote  
  15. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    Originally Posted by poisondeathray View Post
    Originally Posted by hech54 View Post
    Originally Posted by poisondeathray View Post
    Originally Posted by hech54 View Post
    Originally Posted by gumbygum View Post
    Worse, often the keyframes don't change when the scene changes, they just seem to change every 10 to 12 seconds regardless of whether the scene has changed or not.
    That's because key frames(keyframes) have ZERO to do with scene changes. Never have. Never will.
    Actually, it depends on the encoder. For decent modern encoders, keyframes are usually inserted at every scene change
    I'd LOVE to see an example of that.....especially with an FLV file.
    ever hear of something called x264 ? or youtube ?
    Should I start randomly downloading YouTube videos to see if there is a keyframe on every scene change or do you have a certain FLV vid on YouTube you can point me to?
    Quote Quote  
  16. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Would the OP care to answer the questions I raised in #12 ?
    Quote Quote  
  17. Should I start randomly downloading YouTube videos to see if there is a keyframe on every scene change or do you have a certain FLV vid on YouTube you can point me to?
    just because key-frames get inserted at scene changes doesn't mean you have a key frame on each scene change.

    Normally you specify a min/max key frame distance and a scenecut-threshold, depending on you scene change it might not even quality as a scene change for the encoder.

    Leaving B-Frames and OpenGop out, x264 decides whether to use a P-, I-, IDR- frame this was:
    Code:
    if ((distance from previous keyframe) > keyint) {
         set IDR-frame
     } else if ( [1 -(P-frame size)/(I-frame size)]<[(scenecut-threshold/100)*(distance from previous keyframe)/ keyint]) {
         if ((distance from previous keyframe)>=minkeyint) {
             set IDR-frame
         } else {
             set I-frame
         }
     } else {
         set P-frame #if b-frames exist this is replaced by a P- or B- frame decision
     }
     encode frame for real.
    since YouTube is using x264 as H.264 encoder, any video should do,...

    Frames that stand alone and don't need to refer to another frame.
    I-Frame = Frames that stand alone and don't need to refer to another frame.
    Key-Frame = I-Frame + is the start of a GOP (group of pictures = number of frames that can be decoded without referring to frames outside of the GOP; That's why cutting on Key-Frames is simple.)
    Before H.264, Key- and I-Frames were the same. In H.264 we differentiate between IDR-Frames and I-Frames. -> there can be references to frame before an I-Frame, but there can't be references before an IDR-Frame.
    Last edited by Selur; 15th Jul 2013 at 07:39.
    Quote Quote  
  18. Originally Posted by gumbygum View Post
    But what editor can cut FLV files with single frame precision and then re-encode the edited file as an MP4 or whatever? I am not aware of any freeware editor that can do this.
    The way I would do it is with avisynth + some encoder or some GUI like ripbot, megui etc....

    The cuts are made in avisynth. You can use avspmod or vdub to "see" the cuts

    The problem is there is a bit of a learning curve

    Alternatively, you could encode them to I-frame lossless intermediates, then edit those, then encode those. The avisynth method will be faster (fewer encoding steps), and a lot less temporary HDD space required

    It might be possible with vdub directly (without avisynth) , using the vdub ffinputdriver or directshow input driver, to load the FLV, and using the external encoder feature on experimental builds to access other compressors and containers (normally you can't export in containers other than AVI in vdub). x264vfw can also export mp4 if you use the command line option
    Quote Quote  
  19. BTW, YT doesn't use open GOP (at least it didn't when I tested it a while back ), so all "I" frames are in fact IDR frames .

    (Unless something has changed recently)


    Very old youtube FLV videos didn't use h.264/AVC. They used h.263 or sorensen spark . Those are the ones that had big problems with keyframes
    Quote Quote  
  20. Originally Posted by DB83 View Post
    Originally Posted by gumbygum View Post
    Originally Posted by DB83 View Post
    I have one question.

    Are you, by any chance, confusing keyframes with I-frames ?
    Aren't they the same thing? The menu says "next keyframe" and "previous keyframe." That's all. I assume these must be I-frames. Frames that stand alone and don't need to refer to another frame.
    Nope. What you describe are I-frames. Read the previous replies which actually discus keyframes. There could be several I-frames between two keyframes.

    What software are you using ? Is it possible to upload one of these flv's ?
    I use a couple of different keyframe editors like Free Video Dub. No point uploading a FLV because this is a problem I have with lots of different FLVs that have widely-spaced I-frames.
    Quote Quote  
  21. Originally Posted by poisondeathray View Post
    Originally Posted by gumbygum View Post
    But what editor can cut FLV files with single frame precision and then re-encode the edited file as an MP4 or whatever? I am not aware of any freeware editor that can do this.
    The way I would do it is with avisynth + some encoder or some GUI like ripbot, megui etc....

    The cuts are made in avisynth. You can use avspmod or vdub to "see" the cuts

    The problem is there is a bit of a learning curve

    Alternatively, you could encode them to I-frame lossless intermediates, then edit those, then encode those. The avisynth method will be faster (fewer encoding steps), and a lot less temporary HDD space required

    It might be possible with vdub directly (without avisynth) , using the vdub ffinputdriver or directshow input driver, to load the FLV, and using the external encoder feature on experimental builds to access other compressors and containers (normally you can't export in containers other than AVI in vdub). x264vfw can also export mp4 if you use the command line option
    Well i'd like to avoid a learning curve if possible. Actually after I posted I downloaded the latest Avidemux and was surprised to find that I could edit the FLV precisely and re-encode it with this. Surprised because in the past I've had very little success editing FLVs with Avidemux. I think the result had a few audio glitches, but not the terrible audio sync problems that I almost always had in the past. Thanks much for your advice.
    Quote Quote  
  22. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    The whole point of using your software (which does not appear to be very clever) and an actual video was to replicate your problems.

    I do not think you have really solved the issue since if you cut on a non i-frame you will have issues. The software used, Free Video Dub that is, encourages or maybe insists on cutting on an i-frame so can then create the edited video without re-encoding. But to call it lossless is a mis-nomer in the extreme.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!