Reply to topic

Rendered file audio and video out of sync

gibbs
Registered Member
Posts
4
Karma
0
When I render my project into any of the codecs I've tried, the resulting file has audio that gets ahead of the video. It starts in sync, and by 26:55 the audio is about two seconds ahead of the video. This didn't happen in the past, but I might be on a different version of Fedora this time. Here's my workflow

Start with a/v file created on a Canon PowerShot A495, with these specs for the file:
- makes .AVI files (details via mediainfo)
- video
- apx. 15 Mbps (14.6-15.2)
- 640*480 (4:3)
- 29.970 fps
- JPEG
- audio
- PCM (unsigned)
- 96 Kbps
- 12 KHz
- 8 bits
- 1 channel

I take those files and split the audio from them using a shell script I wrote. I do this to avoid a bug in KDE where audio and video get out of sync in the editor if the original audio is used. The command to split the audio is:
[code]ffmpeg -i "$line" -vn -acodec copy "$wav_name"[/code]

Then I open Kdenlive and as I place each clip in the timeline, I split the audio, delete it, and put in the audio file that created with ffmpeg.

Then I render, using these settings (for putting on Vimeo):
- H.264 (also tried WebM and MP4+MP3)
- Export audio (automatic) (also tried "Export audio" with no "(automatic)" label)
- 2 pass (also tried 1 pass)
- video bitrate 2000 (because this is SD video)
- audio bitrate 96 (because this is the same as the original file from the camera)

In the past, this worked, and now it makes files with a/v at different speeds, so it drifts out of sync.

The differences I see in the rendered files, from mediainfo reports, are (functional is first, current malfunctioning is second):
Writing application : Lavf52.64.2 --> Lavf54.63.104
Format settings, ReFrames : 1 frame --> 4 frames
Format settings, GOP : M=1, N=12 --> not listed
Audio bit rate mode : variable --> constant

the one that works:
Writing library : x264 core 106 Ubuntu_2:0.106.1741-3
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0 / me=dia / subme=7 / psy=0 / mixed_ref=0 / me_range=4 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=7 / scenecut=0 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=2000 / ratetol=2.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.25 / aq=1:1.00

non-functioning video:
Writing library : x264 core 130 r2282 1db4621
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=1 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00

What's different between when it worked and now? I used Ubuntu Studio 11.04 on my laptop in the past, and this is a clean install of Fedora 19 on a desktop. Both are 64-bit OS/software. Obviously something else is different, and making this malfunction... any idea what? Or how to get a good render of my project?

END OF QUESTION

In case you want to see them, here are the full mediainfo reports:

Here's the mediainfo report for a file that worked:

General
Complete name : thisworksgreat.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 45.4 MiB
Duration : 3mn 4s
Overall bit rate mode : Variable
Overall bit rate : 2 065 Kbps
Writing application : Lavf52.64.2

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=12
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3mn 4s
Bit rate : 2 000 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 29.970 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.217
Stream size : 43.9 MiB (97%)
Writing library : x264 core 106 Ubuntu_2:0.106.1741-3
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0 / me=dia / subme=7 / psy=0 / mixed_ref=0 / me_range=4 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=7 / scenecut=0 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=2000 / ratetol=2.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.25 / aq=1:1.00

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 3mn 4s
Bit rate mode : Variable
Bit rate : 64.8 Kbps
Channel count : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 1.43 MiB (3%)

And here's the mediainfo for this current malfunctioning render:

General
Complete name : outofsyncdrifting.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 410 MiB
Duration : 27mn 16s
Overall bit rate : 2 103 Kbps
Writing application : Lavf54.63.104

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 27mn 16s
Bit rate : 2 000 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 29.970 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.217
Stream size : 390 MiB (95%)
Writing library : x264 core 130 r2282 1db4621
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=1 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 27mn 16s
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel count : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Delay relative to video : 67ms
Stream size : 18.7 MiB (5%)
gibbs
Registered Member
Posts
4
Karma
0
Here's the info on what version of Kdenlive I'm using now:

Name : kdenlive
Arch : x86_64
Version : 0.9.6
Release : 2.fc19
From repo : rpmfusion-free

and in case it matters:

Name : ffmpeg
Arch : x86_64
Version : 1.2.4
Release : 2.fc19
From repo : rpmfusion-free-updates

Name : mlt
Arch : x86_64
Version : 0.8.8
Release : 5.fc19
From repo : rpmfusion-free
gibbs
Registered Member
Posts
4
Karma
0
Since there haven't been any suggestions, and Ubuntu Studio worked last time, I'm installing Ubuntu Studio to see if Kdenlive will render the project correctly on there.
gibbs
Registered Member
Posts
4
Karma
0
I didn't make it work on Fedora, so I can't tell what malfunctioned.

Installed Ubuntu Studio 12.04, did apt-get upgrade, then added sunab's PPA and installed Kdenlive from there, then (just in case) added gstreamer bad, bad-multiverse, and ugly plugins. And Kdenlive rendered the project correctly, with audio and video in sync. Here's the mediainfo report on the rendered file, with the items mentioned in previous posts in bold.

General
Complete name : insync.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 421 MiB
Duration : 28mn 13s
Overall bit rate mode : Variable
Overall bit rate : 2 085 Kbps
Writing application : Lavf53.21.1

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 28mn 13s
Bit rate : 2 000 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 29.970 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.217
Stream size : 404 MiB (96%)
Writing library : x264 core 120 r2151 a3f4407
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=0 / mixed_ref=0 / me_range=16 / chroma_me=0 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=0 / open_gop=1 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.25 / pb_ratio=1.25 / aq=1:1.00


Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 28mn 13s
Bit rate mode : Variable
Bit rate : 79.1 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 16.0 MiB (4%)
User avatar Ubu the Tech Guru
Registered Member
Posts
22
Karma
0
i'm guessing it's an issue with the ffmpeg version you're using in each instance. sometime the ffmpeg developers have regression whereas even though they intended for an update to occur to add or fix functionality, they accidentally break or incorporate a bug within the update.


Check out my YouTube Channel http://www.youtube.com/ubuntuaddicted
Follow me on Twitter http://www.twitter.com/ubuntuaddicted
Check out my Google+ Profile https://plus.google.com/+UbutheTechGuru

 
Reply to topic

Bookmarks



Who is online

Registered users: Alexa [Bot], Artmessiah, Baidu [Spider], barrypicker, Bing [Bot], eagleton, Exabot [Bot], garthecho, ggael, ghevan, Google [Bot], google01103, Hans, jsirek, ken300, koriun, Majestic-12 [Bot], mcaceres, mutlu, nezumi, pinguin74, private_lock, samuelig, scummos, Tepee, TheraHedwig, tparrott, Yahoo [Bot], zabastodwa