I have a DivX file that contains several TV shows in succession (no commercials.) I wish to split the file into the individual episodes for the show. I am using VirtualDub to do this, by first setting an in point and out point for the episode in question, selecting Direct Stream copy for both audio and video, then saving. However, the encoding used set the keyframes pretty far apart (sometimes 10 seconds apart), and VirtualDub, in direct stream copy mode, will "round" to the nearest keyframe and start copying from there. The boundaries between shows, by Murphy's law of course, never fall anywhere near a keyframe (it seems to setup a keyframe when the fade out starts, then another one the next fade in has completed, so at either keyframe I'd either have a piece of the previous episode, or cut off the first couple seconds of the next.) I can understand why it would do this, but is there a better solution than actually recompressing the entire video stream? Like, recompress but only up to the next keyframe, then direct copy? As we all know, encoding something already encoded is never a good idea, so I'd like to know if anyone has ideas how to accomplish this - preferably using VirtualDub, but if other apps are necessary, let me know that too and how I'd go about it.
Flint
+ Reply to Thread
Results 1 to 4 of 4
-
-
Hi-
However, the encoding used set the keyframes pretty far apart (sometimes 10 seconds apart),
That's the recommended distance, 240 frames for 23.976fps, 300 frames for 29.97fps, and 250 frames for 25fps.
If I have to do something like that, I'll cut out the short section bounded by the 2 keyframes in the middle of which I want to cut, and then reencode just that short portion, making sure to set a keyframe where I want. I'll splice it back in when done, and then do the cut where the new keyframe was set.
Setting a keyframe where you want in the middle of that short section is pretty easy. If XviD, you can use the Zones to set it. If XviD or DivX, you can adjust the max distance between keyframes to make sure one is set where you want.
I'd probably demux the audio before doing this, and I'd probably use VDubMod for the job. This is a lot of additional work, but it will save you from reencoding the whole thing. -
Would it be at all feasible to just cut out the short section and save it uncompressed? That way you'd have no keyframe worries, and then could just splice it back on to the beginning of another encoded file. I still don't know how much I trust setting maximum keyframe distance; unless I wanted to set it to like 5 frames, there's still a good chance I wouldn't hit the exact frame (yes, I'm a perfectionist) and end up with say 20 frames too much or too little. I don't know of any way in Vdub to force a keyframe encoding in the timeline.
Yeah, it's a *lot* of work just to recompress maybe 120 frames and avoid compressing an additional 20,000. :P I guess I hope one day VDub will have the option to do this sort of thing on its own.
If anyone else has other suggestions, fill me in.
Thanks -
Would it be at all feasible to just cut out the short section and save it uncompressed?
No, when you append stuff, they both have to have used the same codec.
In principle it's easy, although some work is involved (all the cutting and splicing back together). You cut out the small part, and then open that in VDubMod. Find where you want to set the new keyframe, and make that the new max keyframe distance. If frame 100 is where you want to cut, set max for 100. By the way, a lot of the settings have to be the same as the original, or you won't be able to rejoin the pieces. I've only ever done this with my own stuff, and I knew what settings were used. At the very least you have to use the same codec and resolution. I'm not real sure about other necessary settings, such as B-Frame settings and the like.
Say there are 3 episodes all run together. You make the first cut at the last keyframe before where you want to cut. The second piece is the short section containing what will become the new keyframe. The 3rd piece is from after the short piece to just before the end of the next episode, and so on. When you've reencoded the 3 short sections, join everything back together again and cut into the 3 episodes.
I guess I hope one day VDub will have the option to do this sort of thing on its own.
I doubt it, since you can only cut on keyframes.
Similar Threads
-
I have an issue with cutting a portion of an avi file.
By darksniper in forum EditingReplies: 4Last Post: 9th Oct 2009, 20:23 -
cutting/joining x264 clips won't reencode with keyframes - a blurry mess!
By forgotpassword in forum EditingReplies: 1Last Post: 13th May 2009, 21:01 -
AVIDemux 2.4.1 cutting audio or maybe video sync issue
By ColdFusion2 in forum LinuxReplies: 9Last Post: 11th Sep 2008, 10:27 -
? Cutting AVI in Bitwise Identical Manner (at non-keyframes)
By Synetech in forum EditingReplies: 14Last Post: 23rd Jan 2008, 00:24 -
Is there not something better than virtualdub for divx cutting?
By pondleaping in forum EditingReplies: 23Last Post: 5th Jun 2007, 11:45