Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen recording Audio Sync issue #224

Open
ranwer-dev opened this issue Jan 25, 2023 · 15 comments
Open

Screen recording Audio Sync issue #224

ranwer-dev opened this issue Jan 25, 2023 · 15 comments

Comments

@ranwer-dev
Copy link

ranwer-dev commented Jan 25, 2023

I have tried recording google meet calls with it. In the beginning, audio and video remain in sync but after some time, the audio goes out of sync. Mostly Audio is ahead of the video. In the most recent recording, I did a 20-minute recording. The audio video was fine for the first 3 minutes and then the audio was ahead of the video.

These are the options that I use for recording

RecorderOptions.OutputOptions.RecorderMode = RecorderMode.Video;

RecorderOptions.VideoEncoderOptions.Framerate = 30;
RecorderOptions.VideoEncoderOptions.IsFixedFramerate = true;
RecorderOptions.VideoEncoderOptions.Quality = 80;
RecorderOptions.VideoEncoderOptions.Encoder = new H264VideoEncoder
{
	BitrateMode = H264BitrateControlMode.Quality,
	EncoderProfile = H264Profile.High
};

RecorderOptions.AudioOptions.IsAudioEnabled = true;
RecorderOptions.AudioOptions.IsInputDeviceEnabled = true;
RecorderOptions.AudioOptions.IsOutputDeviceEnabled = true;
RecorderOptions.AudioOptions.AudioInputDevice = (AudioDeviceComboBox.SelectedItem as AudioDevice).DeviceName;
RecorderOptions.AudioOptions.AudioOutputDevice = (SystemAudioDeviceComboBox.SelectedItem as AudioDevice).DeviceName;
RecorderOptions.AudioOptions.InputVolume = 1;
RecorderOptions.AudioOptions.OutputVolume = 1;

RecorderOptions.MouseOptions.IsMousePointerEnabled = true;

RecorderOptions.SourceOptions.RecordingSources = new List<RecordingSourceBase>
	{
		new DisplayRecordingSource(monitor)
		{
			OutputSize = monitor.OutputSize,
			Position = monitor.Position,
			RecorderApi = RecorderApi.WindowsGraphicsCapture,
			IsBorderRequired = false
		}
	};
}
@sskodje
Copy link
Owner

sskodje commented Jan 25, 2023

Was this with one of the releases, or compiled from the main branch? I pushed some fixes for audio drift issues a few days ago, but haven't made a new release yet. If the issues was with an older release, you can try the new changes from one of the automatic builds here if you wish.

@ranwer-dev
Copy link
Author

Yeah, I noticed that recent commit. I was using latest branch code.

@sskodje
Copy link
Owner

sskodje commented Jan 26, 2023

Do you know the sample rate and bit rate of your microphone and output device in windows audio settings? I'm guessing it has to be something about that, as i'm unable to reproduce.

@ranwer-dev
Copy link
Author

I was using a USB mic
image

And Bluetooth headphone
image

But I have experienced this out-of-sync issue with simple wired hands-free too when I was not recording System Audio.

@sskodje
Copy link
Owner

sskodje commented Jan 26, 2023

Thanks, that's very helpful. I can probably guess it's due to mixing input and output with different samle rates, as i've had some bugs with that before. I'll try to reproduce .

@ranwer-dev
Copy link
Author

Were you able to reproduce/fix this?

@sskodje
Copy link
Owner

sskodje commented Mar 1, 2023

Unfortunately i wasn't able to reproduce it on any of my hardware, so the issue is kind of stuck.

@SID9-HoneyBee
Copy link

I have a similar issue. Could this issue have been resolved?
For the first 5 minutes after recording, the video and audio input are in sync.
However, as the recording continues, it is out of sync.
I am using version 3.1.2.

@sskodje
Copy link
Owner

sskodje commented Mar 28, 2023

I fixed some audio drift issues in version 5.2.0. You see if it fixes your issues.

https://github.com/sskodje/ScreenRecorderLib/releases/tag/v5.2.0

@ranwer-dev
Copy link
Author

No, the issue is still there. It goes fine for the first few minutes, but later System's Audio gets delayed from the video.

I fixed some audio drift issues in version 5.2.0. You see if it fixes your issues.

https://github.com/sskodje/ScreenRecorderLib/releases/tag/v5.2.0

@SID9-HoneyBee
Copy link

I fixed some audio drift issues in version 5.2.0. You see if it fixes your issues.

https://github.com/sskodje/ScreenRecorderLib/releases/tag/v5.2.0

I was afraid to migrate to version 5 while using 3.1.2.
But I got it working yesterday.
As a result of testing by applying version 5.2.0, it is confirmed that the audio drift issue has been resolved.
Let's do a little more testing.
Thank you very much.

I would like to ask an additional question regarding WebCam Overlay.

@ranwer-dev
Copy link
Author

As a result of testing by applying version 5.2.0, it is confirmed that the audio drift issue has been resolved.

@SID9-HoneyBee your issue was with microphone audio or System Audio? My System audio issue is still there.

@SID9-HoneyBee
Copy link

As a result of testing by applying version 5.2.0, it is confirmed that the audio drift issue has been resolved.

@SID9-HoneyBee your issue was with microphone audio or System Audio? My System audio issue is still there.

Haven't tested in many environments. However, in testing in four environments, all out-of-sync issues were resolved.

Migrated to version 5.2.0. That's it.

@ranwer-dev
Copy link
Author

I have observed the System Audio recording lag issue happens with Wiresless headphone. With builtin laptop speaker, it works fine.

@ranwer-dev
Copy link
Author

It's still a valid issue. When we are recording both microphone and system audio at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants