Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


BOOKS AND ARTICLES
Free library / Directory / video art

Virtual Dub. Joining Multiple AVI Files

video art

Directory / video art

Comments on the article Comments on the article

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.

Virtual Dub. Joining Multiple AVI Files

We attach, to the already open fragment, the following, for this we select the command:

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

In the window that opens, we see the FPS of the current file:

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

Select the item "Change to ...". We enter the average known value, the rest is the default, click OK.

Virtual Dub. Joining Multiple AVI Files

Look again at the duration of your fragment, now it's different:

Virtual Dub. Joining Multiple AVI Files

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.

Virtual Dub. Joining Multiple AVI Files Virtual Dub. Joining Multiple AVI Files

We save.

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

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.

Virtual Dub. Joining Multiple AVI Files

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.

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

Save the sound of the opened AVI to a separate WAV file:

Virtual Dub. Joining Multiple AVI Files

For video, select "Direct stream copy", for sound "No audio":

Virtual Dub. Joining Multiple AVI Files Virtual Dub. Joining Multiple AVI Files

Let's go to the familiar dialog box:

Virtual Dub. Joining Multiple AVI Files

Select the item "Change to ...". We enter the average known value, the rest is the default, click OK.

Virtual Dub. Joining Multiple AVI Files

Go to the end of the fragment to see its duration after changing the FPS.

Virtual Dub. Joining Multiple AVI Files

Write down the value of the time. Save AVI.

Virtual Dub. Joining Multiple AVI Files

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.

Virtual Dub. Joining Multiple AVI Files

To compress / stretch the sound over time, select from the menu:

Virtual Dub. Joining Multiple AVI Files

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:

Virtual Dub. Joining Multiple AVI Files

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. :)

Virtual Dub. Joining Multiple AVI Files

We save.

Virtual Dub. Joining Multiple AVI Files

We start VirtualDub, open our AVI file without sound. Through the menu "Audio" we connect a new sound:

Virtual Dub. Joining Multiple AVI Files

To save AVI with new sound, select "Direct stream copy" for video and audio streams:

Virtual Dub. Joining Multiple AVI Files Virtual Dub. Joining Multiple AVI Files

We save.

Virtual Dub. Joining Multiple AVI Files

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:

▪ Lighting and illumination

▪ Free music for legal use

▪ Rules of conduct on the set

See other articles Section video art.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Artificial leather for touch emulation 15.04.2024

In a modern technology world where distance is becoming increasingly commonplace, maintaining connection and a sense of closeness is important. Recent developments in artificial skin by German scientists from Saarland University represent a new era in virtual interactions. German researchers from Saarland University have developed ultra-thin films that can transmit the sensation of touch over a distance. This cutting-edge technology provides new opportunities for virtual communication, especially for those who find themselves far from their loved ones. The ultra-thin films developed by the researchers, just 50 micrometers thick, can be integrated into textiles and worn like a second skin. These films act as sensors that recognize tactile signals from mom or dad, and as actuators that transmit these movements to the baby. Parents' touch to the fabric activates sensors that react to pressure and deform the ultra-thin film. This ... >>

Petgugu Global cat litter 15.04.2024

Taking care of pets can often be a challenge, especially when it comes to keeping your home clean. A new interesting solution from the Petgugu Global startup has been presented, which will make life easier for cat owners and help them keep their home perfectly clean and tidy. Startup Petgugu Global has unveiled a unique cat toilet that can automatically flush feces, keeping your home clean and fresh. This innovative device is equipped with various smart sensors that monitor your pet's toilet activity and activate to automatically clean after use. The device connects to the sewer system and ensures efficient waste removal without the need for intervention from the owner. Additionally, the toilet has a large flushable storage capacity, making it ideal for multi-cat households. The Petgugu cat litter bowl is designed for use with water-soluble litters and offers a range of additional ... >>

The attractiveness of caring men 14.04.2024

The stereotype that women prefer "bad boys" has long been widespread. However, recent research conducted by British scientists from Monash University offers a new perspective on this issue. They looked at how women responded to men's emotional responsibility and willingness to help others. The study's findings could change our understanding of what makes men attractive to women. A study conducted by scientists from Monash University leads to new findings about men's attractiveness to women. In the experiment, women were shown photographs of men with brief stories about their behavior in various situations, including their reaction to an encounter with a homeless person. Some of the men ignored the homeless man, while others helped him, such as buying him food. A study found that men who showed empathy and kindness were more attractive to women compared to men who showed empathy and kindness. ... >>

Random news from the Archive

Helping color blind people 08.07.2000

According to Deutsche Welle, the American geographer S. Brewer of the University of Pennsylvania has developed a special color scale for colorblind people, on the basis of which a computer can recolor maps, replacing one color with another in accordance with the individual characteristics of the user's color perception.

The novelty should help people suffering from color vision disorders and having difficulty reading maps and atlases.

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

▪ article Fundamentals of biogas technologies. Encyclopedia of radio electronics and electrical engineering

▪ article Radio station with amplitude modulation. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024