In the previous tutorial we saw how configure Cinelerra GG as a Video Multitrack Mixer and how to work with it with perfectly synchronized clips from the start. In this chapter we will see how to work with Cinelerra as multitracks starting from clips that are part of the same event, in which we have used the time code technique to later synchronize them.
A little theory
Roughly we can say that there are three systems to synchronize the videos and audios recorded with multiple devices (cameras and audio recorders) of the same event simultaneously.
- Simultaneous recording start systems of all multitrack video and audio recording equipment or systems. We obtain clips that when we place them at the beginning of the timeline, they are already synchronized. We saw this situation in the previous tutorial.
- Time code systems. We will cover it in this chapter. These systems basically what they do is record a very precise time stamp, in the form of metadata, in the video and audio files, of the exact moment in which recording has begun, with frame precision. In film or video, hundredths of a second are replaced by frames. Then from this time data Cinelerra GG will adjust the clips with total precision. Obviously all these devices are precisely adjusted from the same clock.
- Clapperboard. Undoubtedly the most laborious, but a very effective classic if we do not have any of the other two, which are essential in professional production companies, but which usually escape the budget of an amateur person.
The first technique was covered in the previous article. In this tutorial we will see how Cinelerra can help us if we have used Time Code (TC) synchronization devices and in the next chapter we will see how to sync clips manually in Cinelerra GG.
Time Code Synchronization
Basically and in a colloquial way, synchronizing by time code consists in that all the devices that participate in the recording of the same event, will have fully synchronized time information from a single device, which is known as “Generator of Master Time Code ”(Master TimeCode).
A “Time Code” generator is a stopwatch adapted to the audiovisual world, where the seconds are not divided into thousandths, but into frames.
This is a topic that can be used for many tutorial pages, since there are many techniques to carry out this synchronization. This is essential in professional production companies, but it usually escapes the budget of an amateur person since they are expensive equipment. So I will omit here the extensive theory and possibilities of this technique and will only make a note.
There are basically two ways to achieve this precise timing:
- All the equipment is connected to the same Time Code Generator, via Cable, Wifi, Bluetooth, IP, etc… In this way we ensure the synchronization of all of them, by means of this precise clock. In this way, each camera or audio recorder will mark the file it generates with the exact moment of its recording with frame accuracy.
- All devices synchronize their internal clocks from the same Time Code Generator. In this way we depend on the internal clock of each computer. Normally in professional equipment the internal clock has a precision that guarantees a few hours of synchrony. When this technique is used, usually after a few hours, during breaks and of course before starting a recording, all devices participating in the recording are verified and reset.
And also two ways to manage this time code:
- Free Run: The time code does not stop even when recording is stopped. In this way, if a camera stops recording momentarily, resuming it does not lose synchrony. It is the most used, since as I have mentioned, the synchrony is maintained regardless of the stops and starts in recording that a camera can make during the event.
- Rec Run: The time code starts counting when recording starts and ends when recording stops. This system is NOT used to synchronize clips of the same event.
Good to know
Low-end cameras, amateur video cameras, mobile phones, etc … usually do not have the ability to synchronize by SMPTE Time Code, which converts milliseconds into frames. Normally they only have a clock that does not give this precision in frames, not even in milliseconds, it only reaches seconds. Its display, apart from the date, only shows hours, minutes and seconds, (00:00:00). Not like a SMPTE counter (00: 00: 00: 00) HH: MM: SS: FF, which shows hours, minutes, seconds, and frame rate.
If we use this type of low-end cameras, when uploading the files to Cinelerra GG at most we can count on the information of the start time of the recording with a precision of seconds, but in visual audio the seconds are divided into frames. On Cinelerra GG When using the command to synchronize these video clips based on the time code, the adjustment error can be one second or more in inaccurate devices, even if we have adjusted the camera clocks the same, (remember , the clock only goes to seconds and it is very difficult to adjust it accurately on different cameras by hand). So this time data can help us to approximate the clips, but then we will have to review and readjust by hand. Not like in professional systems where we have frame accuracy and the adjustment will be perfect automatically.
I want to know more about this topic
In the network there is a lot of information regarding the synchronization making use of the time code.
In the following video, perfectly subtitled in Spanish, this subject of synchronization is explained in a very pleasant and comprehensive way.
The following video is from the web Tentacle Sync, which manufactures devices for synchronization. These products even allow us to use the Time Code on devices that do not have this feature, through the audio inputs. But they are expensive options. The purpose of sharing it is for how didactic it is to help you understand how time code works. Also to synchronize it depends on your application that does not have a version for Linux.
In the next Web page there are good tutorials and articles on this topic and on the audiovisual world in general, even very advanced photography topics. The following link is a good article and video to start with if one wants to know more about the topic of time codes, “Tone bars and time code“.
Synchronizing clips in Cinelerra GG
As we are going to work with precision, a recommended step is to clear the cache of Cinelerra GG to avoid any possible problems. This I indicate is mandatory if we have already synchronized certain clips and then we have decided to make a change, such as changing the audio track keeping the same name. The cache in Cinelerra GG is deleted from Settings → Preferences → Interface and click on “Delete existing indexes”
I have already mentioned that if the clips are already synchronized from the beginning (either because the recording was started simultaneously or because they are synchronized), in Cinelerra all we have to do is follow the tutorial from the previous chapter.
Synchronize with Timecode in Cinelerra GG
Important: We must not edit or transcode or convert these clips with the TC information to other formats until we have synchronized them, since with the editions and especially the conversion or transcoding in all likelihood causes the original timecode information to be lost.
Indicate that if we make a mistake in something during this simple process, it is best to start over: we close Cinelerra GG, clear the cache, reload the files and synchronize again, as we will see below.
Synchronizing with Time Code in Cinelerra GG is super simple. In case of having tracks loaded as Mixer tracks, we must unlock these (put the lock in green) so that they can be adjusted as we will see below.
It is recommended to adjust clips from the Time Code, is to create a new project, in principle with a single video track and two audio tracks, for stereo audio (this step is optional, the tracks can be created once the mixer is assembled ). It is important to put the other settings, highlighted in green, that coincide with those used in the recording.
In this example, a FullHD video at 25 frames per second (FPS) and with a resolution of audio samples at 48KHz, which are the settings that are being used in this project.
Now we load all the clips with the option “Add to a new track”,
this will automatically create and stack the tracks for us.
We note that the clips have different lengths. This is because the start of the recording was not simultaneous, but having used a time code synchronization system Cinelerra GG will do the rest of the work for us.
In the Tracks menu there is an option called “Align Timecodes”. For this step we must have the tracks unlocked. By default they are already if we have followed these steps.
Click on this option and wait a few moments and Cinelerra GG will perfectly synchronize the clips based on the time code data present in them. After this it is normal that we see a staggered start.
I place the playhead at the beginning of the clip furthest to the right. In this example, the audio track.
Now I split all the clips at this cursor position (I can do it from the edit menu or with its shortcut, which is by pressing “x”).
Once this division is done, I select this fragment from the beginning. To define the selection I double click on the clip that has not moved from the beginning, if there is a gap, I select from the cut to the beginning.
And I erase this section, in this way the clips are perfectly aligned at the beginning.
Now if we wish we can adjust the endings (this step is optional): for this we have to put the cursor at the end of the track whose end is furthest to the left, divide, select until the end and delete. We can do this in a simple way by placing the cursor at the end of the aforementioned clip and pressing the key combination “Shift + Alt + Right Arrow →” until reaching the end of the clip and deleting what is contained in this selection.
If when making the video we need images of these queues that have been erased, we simply unlock the mixer tracks and stretch them to recover this footage.
Ok, now that we have the clips perfectly in sync, let’s set up the mixer. We already saw how to do this in the previous tutorial, but I repeat it in an abbreviated way.
The first step is to block the tracks that we do not want to be part of the mixer and leave active those that we do want to be part of the mixer.
I’m not going to use the audio as a mixer track, but rather as the final audio for editing. We see that these tracks are locked, along with the video track, which is the one that will contain the final montage and I do not want any of them to be part of the mixer.
Now in this arrangement we open the Mixers menu and use the option “Master mixer”(In the new translation it will come as“Create Mixer from Active Tracks“)
And that’s it, the mixer is created and the viewers open.
Now I simply unlock the video track where I do the montage from the mixer tracks.
Remember, advance the playhead to the point where we want to insert our first clip
and double click on the viewer that contains the fragment that we want to insert into this fragment.
We repeat these steps until finished. In the previous tutorial I already explained everything related to this topic of mixers.
As we saw in the previous tutorial and we have just seen, when we have a synchronization method this task becomes very simple.
In the next chapter I will deal with the laborious subject of manual synchronization, when we have not had the expensive and professional synchronization systems.
If we have recorded the audio in a camera together with the video, this audio will be synchronized with the video itself, it is not necessary to extract it, it is better to first synchronize the clips from time code, adjust the tracks at the beginning and then export the audio track from Cinelerra to deliver it to the sound technician, who if for whatever reason makes any cut at the beginning of the track, he will re-insert the time code in an appropriate and precise way. Although the normal and recommended to avoid problems, is that the duration does not vary and less from the beginning.
We’ll take a closer look at audio in the next chapter, where we’ll see how to manually sync clips.
View the Timecode of the clips
* This information is extracted from the Cinelerra GG manual.
We have several ways to see the time code in the files, both video and audio.
From a terminal with the following commands:
For video files:
$ ffprobe NombreVídeo.mp4 Y buscamos en la salida:
Metadata: handler_name : TimeCodeHandler
timecode : 00:00:38:07
Or with MediaInfo:
$ mediainfo NombreVídeo.mp4
Y buscamos en la salida:
Time code of first frame: 00:00:38:07
Time code, striped: Yes
For audio files, which usually comes as a metadata tag, although there are other systems, here we will only see the metadata tag because I have tested it and I am sure it works perfectly in Cinelerra.
$ ffprobe Audio.mp3 Y buscamos en la salida: Metadata: timecode : 00:00:42:23
$ mediainfo Audio.mp3 Y buscamos en la salida: timecode: 00:00:42:23
But we can also make use of the MediaInfo user interface. We find it in Synaptic as mediainfo-gui.
On Debian-based systems we can install media info from the terminal:
sudo apt install mediainfo mediainfo-gui
We open the file that we want to consult with this application.
Once open we go to the View menu and choose the HTML option.
In an audio file with time metadata we will see it as follows.
Insert the Timecode Metadata to a file
* Information also extracted from the Cinelerra GG manual.
We can also insert this metadata manually, both in audio and video files.
This is useful if we have seen the need to transcode a clip for whatever situation, once we have seen the time code in the original we insert it into the file using the following command.
ffmpeg -i originalfile.mp4 -metadata timecode="14:36:08:21" -c copy newfile.mp4 # donde "-i" va seguido del nombre del archivo de entrada. # donde "-metadata timecode" va seguido del código de tiempo "HH:MM:SS:FF" # donde "-c copy" hace una copia del video/audio al nombre de archivo dado con la etiqueta del código de tiempo insertada.
Video files at different frame rates
This doesn’t have to happen, but it can happen. What happens if we are going to work with the PAL (European System) frame rate, which is 25 and due to an oversight, a camera had it set to another frame rate, or vice versa. Well, in this case we will have to perform the following calculation to obtain the correct time code to insert into the new file already converted at the correct frame rate. The hours, minutes and seconds remain the same, the only thing to correct is the value of the frames.
- 1000 / FPSe = ms_e (where FPSe is the wrong frame rate and ms_e how many milliseconds each frame lasts at this wrong rate).
- ms_e x F_TC = ms_TC (where F_TC is the frame indicated in the Time Code and ms_TC the resulting milliseconds).
- 1000 / FPSc = ms_c (where FPSc is the correct frame rate and ms_c the milliseconds that each frame of this correct value lasts).
- ms_TC / ms_c = NF_TC (where NF_TC is the new frame value that we must indicate in the time code. These must be rounded to eliminate the decimals, for example, if we obtain 16.67, 17 will be considered and 16.44 will be 16).
In these frame rate change conversions we will almost always have a margin of error of a few thousandths of a second, but the human eye is not that precise to notice these small mismatches, so the result of the synchronization will be good.