Take the 2-minute tour ×

I want to split a video file into multiple parts and then rejoin some of them to make a new video file.

I am doing it by looping over the packets using xuggle and then writing some of them (after adjusting its timestamps) to the new file, but when I play the file, there is some disturbance in the transition frames. (It might be because the decoding of frame depends upon its preceding frame which has been discarded as part of the program)

How can I get rid of the disturbance?

share|improve this question
add comment

1 Answer

Ideally you split on keyframes, since they usually don't depend on preceding frames. The IPacket class has a isKey function to test for this condition.

I'm not sure what sort of compression format you are working with though. I have tried splitting a mp4 stream with xuggler, and found the results to be quite buggy.

share|improve this answer
Thanks a lot for your suggestion. I think it should work. But, is there a way to make a frame, a keyframe ? –  Aaveg Jan 4 '12 at 13:23
Not without decoding and re-encoding the whole segment I would think –  IJC Jan 4 '12 at 13:36
I tried decoding and then re-encoding the packet from the IVedioPicture, but it did not solve the problem. If anyone could give the solution on how to split a video file on any non-key frame, then I'd be able to solve my problem as well. –  Aaveg Jan 5 '12 at 8:47
add comment

Your Answer


