PDA

View Full Version : Frame accurate cutting with x264-encoded files


Bulletproof
6th September 2007, 20:14
The problem: You've encoded a file that has unnecessary parts. It took you 30 hours. You try to cut out the parts using MP4Box w/ a GUI and find out that cuts must be made at keyframes. Some seconds of unnecessary video are still there because the closest keyframe was in that part of the video.

The solution (that I know of): Cut at the closest keyframe that cuts off some of the video you want, re-encode the portion that you wanted that was cut off, and rejoin it with the cut off video. There might be a problem to this solution, however. I'm not sure if the endpoint of a cut has to be at a keyframe as well. If it does, MP4Box does not tell you where it decides to stop. This could be a major pain trying to sync another cut with the endpoint.

What I'm asking is if anyone out there wants to make a GUI for assisting with this sort of task. It would basically let you choose the start and end point of the video, let you choose the first closest keyframe it makes the cut at, and then let you choose the actual start frame you wanted, and then it reencodes your actual start frame to the beginning of the keyframe cut-off video and joins the two. Of course, if anyone knows a better way to do this, please let me know :confused:

akupenguin
6th September 2007, 21:06
The end point can be any frame, but you get slightly strange results if it's a B-frame.

bitstream order:
in: IPBBPBBPBBPBBPBBPBB
cut: IPBBPBBPBBPB

display order:
in: IBBPBBPBBPBBPBBPBBP
cut: IBBPBBPBBPB P

bond
7th September 2007, 19:36
theoretically you can also cut at non-keyframes with mp4, because the specs support hiding frames that should not be shown

either way, i dont know of a tool that supports writing such frames :D

Bulletproof
7th September 2007, 21:43
theoretically you can also cut at non-keyframes with mp4, because the specs support hiding frames that should not be shown

either way, i dont know of a tool that supports writing such frames :D

I was going to ask about this, but I thought the standard did not support it, and that the decoders would have to be changed as well. But if the current decoders have this already written into them, or are going to eventually, then that would be great if there was a tool that lets you do this.