This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Advice/help syncing audio track to video (23/30fps, CFR VFR)

Tags: None
(comma "," separated)
busyearthen
Registered Member
Posts
1
Karma
0
Hi! :) New to Kdenlive.
I have a bunch of pair of videos. I need to merge batch A audio with batch B videos. At first I thought it would be easy. Use ffmpeg to extract audio and copy it (maybe with a delay) to the batch B videos. But noooo.

The sound from batch B appear to be too fast or too slow. The video they were attached to are sometimes 23.975 fps or 30 fps, which is different from video A. They sounds ok but they get out of sync with the video A. If I play 2 videos side by side, most of the time I can get them in sync, but if I only copy the audio, it's out of sync.

I downloaded Kdenlive and imported both videos. I synced up the beginning but noticed after 5 minutes the audio A was out of sync by a couple of seconds.
If I "Align audio to reference" on Audio B (Audio A being the reference), the beginning are aligned properly. Yay.

I have 200+ videos where I need to add an audio track and sync it. Can I use kdenlive to "stretch"/"adjust" this? Can I do this without re-encoding the video? I want to preserve quality as much as possible. I don't mind re-encoding audio track though as I was planning on using ffmpeg "loudnorm" algo on it anyway. I could keep both files but why do that when I can cut 500mb of disk space per video by keeping only the audio? Also it will be easier long term.

File A "Original":

Code: Select all
Video:
Frame rate mode                          : Variable
Frame rate                               : 23.976 (24000/1001) FPS
Minimum frame rate                       : 23.974 FPS
Maximum frame rate                       : 23.981 FPS
Duration                                 : 23 min 54 s

Audio:
Format                                   : AAC LC
Duration                                 : 23 min 41 s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -23 ms


File B:
Code: Select all
Video:
Duration                                 : 23 min 41 s
Frame rate mode                          : Constant
Frame rate                               : 30.000 FPS

Audio:
Format                                   : AAC LC
Duration                                 : 23 min 54 s
Bit rate mode                            : Variable
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Default                                  : Yes
Alternate group                          : 1


The duration is different but I know there are some black screen here and there in file B. I will need to cust and adjust the audio from file A I guess to align them properly.

Now, do you have any tips? I know shirt+R is Cut. Other than that, I'm not sure where do begin. I tried watching some tutorial online about audio syncing but all of them just drag the track around without doing much.
User avatar
bartoloni
Moderator
Posts
1510
Karma
4
OS
Just tried with2 clips of 3minute and 16sec ... one at 25fgps and one a 30fps.. and there are no differences on lenght on timeline...

Started Kdenlive...

first i placed the 30 fps clip on the project bin.. i accepteed the resolution change to 30FPS...
after that i placed the 25fps on project-bin,

next i UNGROUPED the 2 clips (audio/video ungroup) and deleted the audio and video extra track (unnecesary) to have just 2 tracks (1 video and 1 audio) to align on timeline.

i kwow that 20 minutes is a big files but.. can you provide these 2 files? (or 2 other small samples? with the 2 frame rates?)

BTW... this is a video about the "ungroup" menu... https://www.youtube.com/watch?v=4zlzk60piGo (you will able to separate AUDIO from VIDEO)
User avatar
kryxkave
Registered Member
Posts
27
Karma
0
OS
busyearthen wrote:I have 200+ videos where I need to add an audio track and sync it. Can I use kdenlive to "stretch"/"adjust" this? Can I do this without re-encoding the video?


You can synchronize the audio with KDENLive and then export the adjusted (in length and duration) audio only.
Then remux the video with the new audio: no re-enconding needed and no quality loss.

For this to work you have to export an audio that is of the same exact duration of the video source (Video and Audio tracks must start/end in the same precise spot).

So.. to summarize:

1.Import the original video in KDENLive.
2.Put it on a V Track
3.Import the audio you need to sync. Edit/cut/sync the audio. DON'T TOUCH THE ORIGINAL VIDEO AT ALL!
4.Export the audio only.
5.Use a software to do the remux only (if it's a MKV/MP4/H264/H265 you can use the GUI from the superb MKVToolNix.. if it's an AVI it depends on the codec if you can use MKVToolNix or not).

Remember that the Video and Audio tracks must be perfectly aligned in KDENLive, before exporting the audio. I mean ALIGNED, not only in sync: if the audio track is longer/shorter than the video track it won't work out.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]