[OT] I-frame cutting in H.264

Marco Leise via Digitalmars-d digitalmars-d at puremagic.com
Tue May 30 04:32:21 PDT 2017


Am Sat, 27 May 2017 22:19:11 +0000
schrieb Era Scarecrow <rtcvb32 at yahoo.com>:

>   Only if you have to recompress it. Some tools like VirutalDub 
> allow you to chop and copy without altering the data stream (it's 
> good for taking out commercials or shortening clips). Although I 
> wouldn't be surprised if you wanted to add a logo, do some fading 
> or some fancy stuff, at which point direct stream copying won't 
> work.

Ok, but even then your source material would ideally have to
be encoded with the same codec and parameters. A different
resolution would not work, while a change in frame rate is
tolerable.

H.264 also makes cutting on I-frames more difficult than
previous codecs as they don't clear the reference frame
buffer. So following frames could still reference frames before
the cut, resulting in artifacts. An actual keyframe for
the start of the video, jumping to chapters or seeking is now
called IDR (Instantaneous Decoder Refresh), which is also an
I-frame, hence why old cutting tools like VirtualDub don't see
the difference.

Another low cost video editor that offers "smart rendering"
without re-encoding is PowerDirector. They provide an option
to use only IDR-frames or any I-frame for cuts (as you would
do in VirtualDub), for cases where in your source material they
are _actually_ proper keyframes with no cross-references. I
tried the latter on footage shot with a Sony digicam and it
resulted in a broken video stream. So unless you know that
every I-frame is an IDR in your sources it is not advisable to
use them as cut points.

-- 
Marco



More information about the Digitalmars-d mailing list