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

Ubuntu 15.10 Audio - Video Not In Sync

Tags: None
(comma "," separated)
Ron Piggott
Registered Member
Posts
5
Karma
0
My audio - video is out of sync when I render videos.

I had already upgraded to Ubuntu 15.10 before I installed and began to use Kdenlive. I just saw in a Google search only up to Ubuntu version 15.04 was "approved" for installation. I am wondering if it even possible to get this corrected in Ubuntu 15.10?

This problem exists outside of Kdenlive. When making videos using "Cheese" the audio lags by about 1/4 second. This morning I split the audio from the video, lined it up correctly. But when it rendered it was off. (I am referring to this video: https://www.youtube.com/watch?v=UmrE3F9X8jw )

This morning I originally tried making this video using VLC Media Center. The audio was off by about 4 seconds. Yet when I used VLC Media Center yesterday it was in perfect sync when recording the video.

I don't know if "Cheese" and "VLC Media Center" are symptoms of this issue or separate issues.

I am using Kdenlive on my laptop:
It is an HP G61.
- The processor is 2.0 htz. I have researched and mail ordered a 2.4 htz processor (the fastest processor this computer is able to handle). It hasn't arrived yet.
- A few years ago I updated the memory. When I do 'free -m' the "Total" is 3697

If you give me steps to try for diagnostics I need detailed instructions. I am still getting use to Kdenlive. I have several years of experience with Linux.

Ron
User avatar
qubodup
Registered Member
Posts
142
Karma
0
Hello,

I have experienced this kind of issue multiple times in the past.

I believe splitting the audio (right click on video track in the timeline option) did unfortunately not solve it for me.

My workaround was:
1. Extract the audio from the video using
Code: Select all
ffmpeg -i video.mp4 -vn audio.wav
(you might have to use avconv command instead).
2. Import both video and audio.
3. Place both video and audio in the timeline.
4. Right click the video track and split audio.
5. Right click the group of video+split audio and select ungroup.
6. Select and delete the split audio.
7. Align start/end of audio-less video track and single audio track in the timeline.
8. Select both video and audio.
9. Right-click and select group.

And then you can cut them as if they are one.

Actually I think this might affect many people so I made a quick video tutorial:
https://youtu.be/1POj0zoSA_0
Ron Piggott
Registered Member
Posts
5
Karma
0
I am starting to wonder if this has something to do with the available system resources when it was rendering. The lag isn't consistent throughout the video. Have you heard of this? Ron
smokel
Registered Member
Posts
1
Karma
0
In general, most of the audio sync problem arises from the time axis damage. Try to transcode to another format and try again.
Ron Piggott
Registered Member
Posts
5
Karma
0
smokel wrote:In general, most of the audio sync problem arises from the time axis damage. Try to transcode to another format and try again.


I ran a command line updating supporting software dependencies. It listed off numerous dependencies. I was surprised when some of them did indeed need to be updated and "sudo apt-get upgrade" hadn't updated them.

Then I rendered the video. I discovered the audo was in sync. Then it wasn't by about 1/8 second. Then it was in sync again. Then it wasn't. This reminded me if when I was watching the video I was rendering within Kdenlive. I have about 8 video tracks because of adding teaching captions to the video I am creating. It was playing the video in 1/4 second segments. I thought to myself "Kdenlive live must need *all* the available CPU power".

I rebooted the computer. I disconnected the second monitor and rendered it again with only Kdenlive running. This time the audio and video are in sync.

My computer is an HP G61 with 4 gig of RAM and a 2.0 hertz processor. This model of the HP G61 is only able to support a maximum of 4 gig. I read in the manual it could handle a 2.4 hertz CPU. This just arrived in the mail. I will install this in my computer shortly. I know how.

The long and short of it is I will need to have videos render when I am in bed for night.

Thank you for your suggestions everyone. I wanted to post a follow up comment to let the community know my resolution. When I checked a few days ago Kdenlive wasn't officially supported in Ubuntu 15.10. It does work with all the correct dependencies installed. The dependencies didn't all install when I installed Kdenlive through the Ubuntu software center.
TheDiveO
Registered Member
Posts
595
Karma
3
OS
Ron Piggott wrote:This reminded me if when I was watching the video I was rendering within Kdenlive. [...] It was playing the video in 1/4 second segments.

This is getting right at the core of the issue; everything else is just distracting, please put it aside. Now, Kdenlive actually uses MLT both as...
  • (1) its on-demand highly interactive live rendering engine,
  • as well as (2) for rendering the final export video.

The key here is to understand that MLT in case (2) just pulls one frame after another for the exported video, thus operating in continuous play (or "tractor") mode. It tucks along the timeline constantly. In consequence, any messed up time marks for audio will slowly add up. That is, when the individual audio segments inside your source footage container don't add up with the video frames. As others have pointed out, the audio desync you are experiencing may very well be an encoding problem of your source footage material. You'll probably need to dig into your source footage, especially when you are experiencing significant desynchronization. So, this most probably has nothing to do with available computer resources or other kind of "magic".

In contrast, in (1) MLT is getting constantly started, stopped, et cetera, all the time. I'm unsure but continous play in Kdenklive may actually a series of short block plays. Anyway, MLT thus also needs to often (re-) seek in order to restart at a particular demanded frame. Depending on your source footage you can notice that from the exact frames around cuts may differ between final rendering and in-Kdenlive rendering; the cause for this is that MLT sometimes prefers speed when searching for a frame over the precise frame time-wise. And this depends strongly on the source format, MP4 is much worse than DNxHD that only has stand-alone I frames. However, reseeking may actually keep audio much better in sync with video frames, as tiny audio frame length errors don't add up as much as before.

At least this is what I understand from various discussions. Of course I may be horribly wrong here.

But I doubt in magic and changing resource levels. Unless my stomach is directly affected.
vpinon
KDE Developer
Posts
708
Karma
6
OS
TheDiveO: your right, MLT has 2 operating modes: realtime>0 (allows dropping frames) realtime<0 (frame by frame rendering)
Ron Piggott: your system load has no impact on final render result (realtime<0)
ffmpeg has always warned about audio seek problems with VBR codecs ("estimating time from bitrate, may be wrong"), and offsets are then almost random along the cuts. Only solution I know is to transcode these audio sources to WAV (suggested several times, please test!)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot]