BOOKS AND ARTICLES Virtual Dub. Joining Multiple AVI Files Combining several AVI files into one is not as simple as it might seem at first. The fact is that most often individual fragments have different FPS, and it is for this reason that VirtualDub refuses to merge them. Different FPS, in other words, a different number of frames per second, could have happened due to the fact that when capturing video, you linked the video stream to the sound in order to avoid desynchronization of video and sound. What to do now, you ask... The easiest and surest way to avoid such problems is to capture the video not in chunks, but all at once. Moreover, you already know how to create large AVI files (in the "Video Capture" article), and you know that there are no particular problems. The second way to avoid problems when merging files is not to bind the video stream to the sound when capturing. Naturally, in this case, you risk getting out of sync, so this solution is of little use. Now I warned you that it's better not to do this and told you how you can avoid it. :) Therefore, let's go directly to the connection method ... 1. Ideal - AVI files have the same FPS We open the first fragment in VirtualDub, from which the future video will begin in the future. We attach, to the already open fragment, the following, for this we select the command: We select a file. Opened in this way, the file will be attached to the end of the previous one. Subsequent fragments are attached in the same way. As you already understood, the fragments must be attached exactly in the order in which they will then go in the final video. All fragments are open, now, if you wish, you can perform any manipulations before proceeding to save. You can apply filters, cut out unnecessary pieces, etc. You can also save in different ways, it is possible with and without compression of video and audio streams. In general, I will not repeat myself - you all know this from the previous descriptions ... 2. Not ideal - AVI files have different FPS We have a number of video fragments, which in turn have different FPS. We will not succeed in immediately gluing them together using VirtualDub. Therefore, to begin with, all available fragments must be brought to one FPS, and this is not an easy task at all! By changing the frame rate of the AVI, we speed up or slow down the frame rate, hence changing the duration of the AVI. But at the same time, the audio track remains unchanged, VirtualDub does not map it to the video stream! Therefore, the video and audio streams are inevitably out of sync. Let's find out the FPS of the fragments that need to be connected. To do this, one by one, open each file in VirtualDub, in the "Video" menu, select: In the window that opens, we see the FPS of the current file: We remember or better write down the FPS value. Open the next AVI file and find out its FPS in the same way, and so on. If you see that the FPS of all files changes slightly - calculate or approximately estimate their average value. Then the frame rate will lead to this average value. This is important because at the same time, FPS for most fragments will change slightly and, therefore, there will be less desynchronization. If out of all the available fragments only one or a few have a significantly different FPS value, process them separately. Those. do not touch this one or several fragments yet, take those that are similar, calculate and bring them to the average FPS. The rest bring to the same average FPS in a different way, more on that later. If all files have a significant FPS run, they should also be brought to an average value, but in a different way. 2.1. Bringing AVI files to one FPS (minor run-up) Usually, if video fragments were captured from the same source, then their FPS does not change very much. In addition, the fragments are shorter in duration, the run-up, even less. And so we know the average FPS, to which we will bring all the available fragments. Open the first AVI file in VirtualDub: Move the slider to the end of the fragment or click the corresponding button on the panel and see its duration: My fragment has a duration of 0 hours, 08 minutes, 40.369 seconds. Let's move on to the already familiar dialog box: Select the item "Change to ...". We enter the average known value, the rest is the default, click OK. Look again at the duration of your fragment, now it's different: Due to the fact that my fragment is only 8 minutes long and the FPS did not change very much, the change in its duration was only a fraction of a second. This means that at the end of the fragment, the desynchronization of video and sound is just these fractions of a second. Which, in general, is not much at all, and even if you try very hard, you can hardly notice them when viewing. Therefore, I see no reason to correct the synchronization, in this case, let it remain as it is. Save FPS changes. To do this, first make sure that the "Direct stream copy" item is selected for video and audio streams in the corresponding menus. Those. streams will be copied without processing.
We save. Thus, all fragments are processed. If they all have such a slight desync as in the example, then we can say that you are lucky. After processing all the fragments, you can proceed directly to the connection of AVIs. This is done, now, in exactly the same way as in the ideal option, point 1. For those who were less fortunate, and the desynchronization turned out to be noticeable, a further description is dedicated to ... The desynchronization within 0.5 seconds, by the end of the fragment, can be corrected to some extent with the means available to VirtualDub. To do this, you need to go: Here select "Preload" and "Interleave.." = 1000ms ... 1500ms. By changing the value of "Delay audio track by" you can slightly shift the audio, relative to the video stream. Use a positive value if the audio is ahead of the video. Use negative values if, on the contrary, the sound lags behind the video. In general, of course, in our case, the desynchronization has an increasing character, so it cannot be corrected by simply shifting the audio stream relative to the video stream. But it can be compensated to some extent or made less noticeable. For example, initially you have, at the beginning, full synchronization, and by the end, the drift of one thread relative to the other is 0.5 seconds. Make it so that there is already a 0.25 second desync at the beginning, so somewhere in the middle there will be synchronism, and at the end again a 0.25 second drift. Just do not think that 0.5 seconds is some kind of limitation, I just think that a large desynchronization cannot be corrected and compensated for by such a flow shift, it will still remain noticeable. To save changes to AVI, after changing the "Delay audio track by" parameter, it is also enough to select "Direct stream copy" for video and audio streams, and then save. Those who are not satisfied with the elimination of desynchronization due to the flow shift, as well as those who are not lucky at all and the existing desynchronization is significant - read the next paragraph. 2.2. Bringing AVI files to one FPS (large run-up) VirtualDub is a good program - that's for sure. However, there are no options in it that could eliminate significant video and audio desynchronization with a large change in frame rate. Therefore, the method described below involves processing audio separately from video... Open the first AVI file in VirtualDub: Save the sound of the opened AVI to a separate WAV file: For video, select "Direct stream copy", for sound "No audio":
Let's go to the familiar dialog box: Select the item "Change to ...". We enter the average known value, the rest is the default, click OK. Go to the end of the fragment to see its duration after changing the FPS. Write down the value of the time. Save AVI. Thus, we have a separate sound in a WAV file, and we have an AVI file with a modified FPS without sound. Now we need a sound editor like SonicFoundry Sound Forge or Syntrillium Cool Edit (of course there are others). I had the Cool Edit program at hand, so I will tell and show it using its example. Run Cool Edit, open WAV file. To compress / stretch the sound over time, select from the menu: In the dialog box, in the "Length" field, you must enter the new length of the WAV file, i.e. the value that we rewrote the FPS change field in VirtualDub. The value must be entered in seconds (for example, I have the value 0:07:13.595, in seconds it is 7*60+13.595=433.595). Enter, press OK: At the end of the treatment, make sure that the duration corresponds to the required one. For me, it differs by 1 thousandth of a second, I think this is within the acceptable range. :) We save. We start VirtualDub, open our AVI file without sound. Through the menu "Audio" we connect a new sound: To save AVI with new sound, select "Direct stream copy" for video and audio streams:
We save. This is how we process all AVI files. Well, after everything is ready, the files can be connected as it is done in the ideal case, point 1 (see above). Author: Dmitry Kornev; Publication: pctuner.ru We recommend interesting articles Section video art: See other articles Section video art. Read and write useful comments on this article. Latest news of science and technology, new electronics: Artificial leather for touch emulation
15.04.2024 Petgugu Global cat litter
15.04.2024 The attractiveness of caring men
14.04.2024
Other interesting news: ▪ Mice against explosives and drugs ▪ Quantum teleportation over urban fiber ▪ New helmets of the Swiss Guards are printed on 3D printers ▪ Container for carrying computers ▪ Service to protect gadgets from water News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ site section Batteries, chargers. Article selection ▪ article Master Lomamaster. Popular expression ▪ How long have lunar eclipses been observed? Detailed answer ▪ article Accountant for accounting of cash transactions. Job description
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |