matanui159 / ReplaySorcery

An open-source, instant-replay solution for Linux
GNU General Public License v3.0
854 stars 27 forks source link

Audio out of sync #31

Closed bwyan86 closed 3 years ago

bwyan86 commented 4 years ago

Hi there and thanks again for making ReplaySorcery available.

I've noticed that with the new audio recording feature that the audio is often (if not always) slightly out of sync with the video, perhaps by up to a couple of seconds in some instances.

Is this perhaps related to issue 15?

I've made sure that my pulseaudio sample rate is 44.1 kHz to match my config:

offsetX = 1920 width = 2560 height = 1440 framerate = 60 duration = 120 compressQuality = 65 outputFile = ~/Videos/ReplaySorcery/%F_%H-%M-%S.mp4 keyCombo = Ctrl+Shift+S outputX264Preset = ultrafast preOutputCommand = notify-send ReplaySorcery: "Saving replay..." postOutputCommand = notify-send ReplaySorcery: "Replay saved!" audioDeviceName = auto audioChannels = 2 audioSamplerate = 44100 audioBitrate = 96000

matanui159 commented 4 years ago

Probably an issue with the frame timing. I also noticed that sometimes the audio can be out of sync when the full video buffer hasn't been filled up yet. Both of which I need to look into.

Calinou commented 4 years ago

I've had issues with audio being out of sync in recording too, especially when using longer buffer lengths.

pseregiet commented 4 years ago

You have 1440p@60Hz resolution, you most likely are dropping some frames and the audio is not synced with the video yet. It will work fine if you don't get any framedrops. Lower your video settings to check if it helps. Proper sync is gonna be implemented eventually of course.

ROTARTSI82 commented 4 years ago

I had issues with audio being completely out of sync, and when I set the audioSamplerate to 44100 (the correct sample rate of my audio i/o i guess) it became better (For anyone looking for a solution)

However, audio still seems to be out of sync by ~200ms

matanui159 commented 3 years ago

Proper frame timing has been implemented in the FFmpeg rewrite (#37). Let me know if you still experience some timing issues.