Difference between revisions of "Splitting / Appending"

From SDA Knowledge Base

Jump to: navigation, search
(Appending: Aliens infected us, it's about time we infected them.)
m (Appending)
Line 83: Line 83:
 
*Compress the wav file to mp3 or aac with MeGUI, or an audio encoder of your choice.
 
*Compress the wav file to mp3 or aac with MeGUI, or an audio encoder of your choice.
  
Now, follow the VirtualDubMod section if you're joining avi files, or the YAMB section if you're joining mp4 files.
 
  
 +
Now that that's done, you can forget about using anymore AviSynth. Follow the VirtualDubMod section if you're joining avi files, or the YAMB section if you're joining mp4 files.
  
*under construction*
+
 
 +
-under construction-

Revision as of 13:22, 6 June 2007

Introduction

The goal of this guide is to show ways to split or append videos without having to re-encode. There are inherent drawbacks which will be explained, as well as solutions to get around most of them.


Tools


Splitting

The act of taking a video and creating smaller, separate videos.


With VirtualDubMod

VirtualDubModCut.png

  • Use the slider and the two arrow buttons next to the frame number to make your selection.
  • Video -> Direct Stream Copy.
  • File -> Save As.


The drawback: You can only start a cut on an I frame. In VirtualDub(Mod) this is labeled with the letter K which can be seen at the bottom center of the interface. This has to do with how videos are compressed.

Without going too in depth... you start with a full I frame followed by a sequence of P or B frames. Those P and B frames are based off that previous I frame. They ABSOLUTELY NEED that I frame or they won't display correctly, so you wouldn't want to cut out that I frame, would you? What this means is that in VirtualDub(Mod), it doesn't matter where you make your starting selection, it will search backwards until it finds that K frame. So while you may think you're starting a cut on frame 3080, which happens to be a P frame, the cut may actually start on frame 2994, a K frame. The problem is that the spacing between K frames can be very far. The video I'm looking at while writing this guide has them spaced out every 10 seconds. This does not allow me to make a precise cut. The good thing is that this drawback doesn't apply to the end of your selection.

Summary: The start of your cut will not be precise (unless you knowlingly start off a K frame), but the end of your cut will be.

Tip: You can navigate through keyframe placements by pressing the button with an arrow and a yellow key under it.


With YAMB 1.6

YAMB 1.6 is limited in that you can't see the video, so you have to pick out where you want to make your cuts beforehand. It also only accepts input in time format, not by frames. You have the option of splitting by duration, by range and by size.

Splitting is simple enough:

  • Click the Splitting & Joining tab
  • Load your video.
  • Input the values.
  • Split it!


The drawback: Same as with VirtualDub(Mod), unfortunately.


Appending

The act of joining multiple videos together to create one video.

I'll start by explaining the the drawback because it applies to both VirtualDub(Mod) and YAMB. First you should read Part 4 of the AviSynth guide which is quoted here:

One of the best features of AviSynth is its ability to do an aligned splice when appending video. There is usually a mismatch between the length of the video and the length of the audio, typically ranging from -50 ms to +50 ms. This means that appending files in VirtualDub(Mod) will in almost all cases cause a desync because the audio of clip2 will be appended right after clip1. VirtualDub(Mod) is unable to do an aligned splice. Here is an illustration:

Append.png

If you still don't understand, I'll explain again but with a larger mismatch. Let's say you have two videos, each 10 seconds long, and the first video has audio that only lasts 5 seconds. By appending directly in VirtualDubMod or YAMB, you will start hearing the audio of clip 2 halfway during clip 1. If you were to look at the file details of this appended video, you'd see that the video duration is 20 seconds, while the audio duration is only 15 seconds. That's not good.


A solution: AviSynth!

Of course, even this "solution" has its own drawback, you'll have to re-compress the audio. However, for most people this is acceptable.

I'm not going to go into the AviSynth syntax since you can learn all of that by reading the AviSynth guide. What you need to learn is how to import the video files, and how to append. So, the basic idea is that we will use AviSynth's alignedsplice() command to get the correct audio stream and reinsert it into the appended video. Follow these steps:

Editor's note: Include guide to enabling VFW H.264 decoding in FFDShow.

  • Get any video codecs you may need, including FFDShow if you want to import mp4 files.
  • Create the AviSynth script, making sure to use AlignedSplice when appending.
  • Import the script into VirtualDubMod.
  • Go to Streams -> Streams List.
  • Right click the audio stream and set it to full processing.
  • Click on Save Wav button.
  • Close VirtualDubMod.
  • Compress the wav file to mp3 or aac with MeGUI, or an audio encoder of your choice.


Now that that's done, you can forget about using anymore AviSynth. Follow the VirtualDubMod section if you're joining avi files, or the YAMB section if you're joining mp4 files.


-under construction-

Personal tools