3 ms·
i understand that this is the fastest way to extract frames, but it is limited by key frame availability in the original file (i.e.) you can only start the out
by vigneshv_psg 4y ago
i understand that this is the fastest way to extract frames, but it is limited by key frame availability in the original file (i.e.) you can only start the output from a keyframe.
in this case, it is important to be aware that the times you specify may not be extracted exactly. it will be off by a few frames based on keyframe availability. the only way to extract exact frames is to re-encode. :)
- scottlamb 4y agoFundamentally (ignoring ffmpeg incantations), I think there are four options: 1. re-encode the whole thing 2. re-encode just the first GOP 3. start a bit early or late 4. include the full first GOP but use an edit list to instruct the player to skip to the timestamp of interest
- vigneshv_psg 4y agoyeah these are pretty much the options. i believe the ffmpeg command that OP suggested would do option 3.
- nickjj 4y agoThis is true. Do you have a use case where being off by a few frames might be a deal breaker? Personally I've created dozens of clips using this method and it always turns out ok. It gives you about ~1 second precision on where you want to make your cuts. After I create the clips I can play things back normally, complete with an ability to seek to specific points successfully.
- vigneshv_psg 4y agoyeah it probably doesn't matter in practice. you may run into some audio sync issues. but the ~1 second precision that you see is by accident where the source file happens to have a keyframe every 1 second. that may not be the case always. :)
- angrais 4y ago>> Do you have a use case where being off by a few frames might be a deal breaker? Yes, in action recognition tasks (machine learning), e.g., if you have a large video with temporal annotations (start/end times where an action occurs) you may want to extract clips to sense-check the annotations. Being exact is important.