VideoHelp Forum




+ Reply to Thread
Results 1 to 4 of 4
  1. Member
    Join Date
    Jul 2015
    Location
    New York
    Search Comp PM
    I have a very specific and detailed, but basic, question regarding manipulating H.264 video without re-encoding.

    I have H.264 video in an MOV container. I wish to regulate the frame-rate over time by alternatively removing or duplicating frames. I wish to do so without re-encoding the video. I understand that there are limitations as to what frames can be removed without breaking the video.

    So far I am able to cut out consecutive P-frames prior to an I-frame, using avidemux. Here's a visual example:

    Code:
    ... I P P P P P I P P ... ==> ... I P P P I P P ...
    where the last two P-frames before the second I-frame were removed. This has the effect of "speeding up" the video.

    What I am having trouble doing is adding frames, to have the effect of "slowing down" the video. It is my understanding that it should be possible to duplicate an I-frame without the following P-frames without corrupting the video, as shown here:

    Code:
    ... I P P P P P I P P ... ==> ... I P P P P P I I P P ...
    You see the second I-frame was duplicated. I try to do this in avidemux, but it does not work correctly. (It seems to duplicate the I-frame plus all following P-frames.)

    Can someone please advise me how I might go about delaying the video by duplicating frames? I am OK with duplicating I-frames or P-frames, whatever gets the job done.

    I should add that I plan to write a C++ program to perform this operation programmatically. If I can manually do all the operations in avidemux, then I can use those sections of code from the avidemux source as the basis for my C++ program.

    Thank you for your time!
    Quote Quote  
  2. So your video has no b frames? Open GOPs can lead to b frames from the prior GOP appearing after the I frame of the next GOP. Keep in mind that frames are stored in decoding order, not presentation order.
    Quote Quote  
  3. An alternative option to physically adding or cutting out frames is to use VFR (variable frame rate) timecodes to control the playback speed of the video.
    Quote Quote  
  4. Member
    Join Date
    Jul 2015
    Location
    New York
    Search Comp PM
    @jagabo: Correct, my video contains no B frames, only I and P frames.

    @poisondeathray: Thank you for bringing VFR to my attention. However, my fear with VFR is that my video annotation software may not properly handle the VFR, whereas it works fine with the current, constant frame-rate video. Stitching the frames together manually is dirtier, but more gentle on latter steps in my processing stack.

    Update: I was able to perform the I-frame duplication using Avidemux 2.5.4 on Ubuntu 14.04. (Whereas it did not work properly with v2.6.10 on OSX 10.10). I have added "copy, "paste", and "Delete" functions to the scripting feature and confirm that they work for the intended purpose. Now I just need to integrate this into the rest of my project, involving using OCR to read timecodes burnt into the video and regulating "framerate" based on those timecodes... I'll post an update if anyone is interested in the results.

    Thanks for the tips!
    Quote Quote  



Similar Threads

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