Another audio sync issue ( and my workaround )

Topics about the audio side of Openshot.

Moderators: Andy, Cenwen, beats

Another audio sync issue ( and my workaround )

Postby dankasak » Tue Oct 07, 2014 1:59 am

Greetings. I see from browsing that others are having issues with audio sync. Here is my issue and fix.

I recorded some videos with my phone ( ASUS Padfone 2, Android 4.4.2 ). Here's what mplayer says when playing the file:

Code: Select all
MPlayer SVN-r36370 (Gentoo)-4.7.3 (C) 2000-2013 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing V_20141005_180610.mp4.
libavformat version 54.20.4 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang eng
VIDEO:  [H264]  1920x1080  24bpp   -nan fps  19977.0 kbps (2438.6 kbyte/s)
Clip info:
 major_brand: isom
 minor_version: 0
 compatible_brands: isom3gp4
 creation_time: 2014-10-05 07:06:41
Load subtitles in ./
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.35.0 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 96.0 kbit/3.13% (ratio: 12004->384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 1920x1080 => 1920x1080 Planar YV12
A:   1.5 V:   0.4 A-V:  1.154 ct:   -nan   0/  0 ??% ??% ??,?% 0 0

When I import these files into Openshot, edit, and export, the resulting video is shorter in length than the audio. When the video transitions to the next clip, the audio lags behind for a couple of seconds. Finally, at the end of the clip, the video stays frozen on the last frame while the audio catches up.

I produced this by exporting and selecting the following options in the 'Simple' tab:

Code: Select all
Profile: Web
Target: YouTube-HD
Video Profile: HD 720p 25 fps
Quality: High

To fix the audio sync problem, I used the same settings as above, but then switched to the 'Advanced' tab and selected:

Code: Select all
Audio Settings:
 Sample Rate: 48000

... which incidentally matches the sample rate that mplayer reported when playing the originals.

Considering you could have a project with source files with different sample rates, I think the only real option is for Openshot to detect the sample rate of each source file, and resample it to the target audio sample rate.
New member
Posts: 1
Joined: Tue Oct 07, 2014 1:43 am

Re: Another audio sync issue ( and my workaround )

Postby XXLRay » Wed Oct 08, 2014 1:58 pm

Good catch!
OpenShot Veteran
Posts: 1070
Joined: Fri Jul 06, 2012 4:10 pm

Return to Audio

Who is online

Users browsing this forum: No registered users