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:
where the last two P-frames before the second I-frame were removed. This has the effect of "speeding up" the video.Code:... I P P P P P I P P ... ==> ... I P P P I P P ...
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:
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.)Code:... I P P P P P I P P ... ==> ... I P P P P P I I P P ...
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!
+ Reply to Thread
Results 1 to 4 of 4
-
-
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.
-
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.
-
@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!
Similar Threads
-
Target framerate for converting a video from 1080i
By Knocks in forum Video ConversionReplies: 12Last Post: 26th Jan 2015, 10:29 -
Possible to convert PAL framerate to NTSC framerate?
By Xirix in forum EditingReplies: 3Last Post: 10th Jul 2014, 15:01 -
Slow PAL Video to NTSC framerate?
By killerteengohan in forum DVD RippingReplies: 5Last Post: 24th Jun 2014, 02:01 -
How do I find out the framerate of a Quicktime MOV video file?
By Dr.Rock in forum Video ConversionReplies: 3Last Post: 10th Sep 2012, 18:37 -
Get Two AVI Video Framerate's to match
By Simmons in forum Video ConversionReplies: 4Last Post: 15th Aug 2011, 09:02