DeadEnded / MotionEyeAudio

Script to add Audio to MotionEye recordings
66 stars 26 forks source link

Audio is ahead of video #7

Open sirhideo opened 3 years ago

sirhideo commented 3 years ago

The script works in my box in terms of generating aac and merging to the recording clip (mp4). However the audio is way ahead of the video after merging into 1 mp4 file. It is like 4 seconds ahead. Could you please help?

DeadEnded commented 3 years ago

if this is always the case, you may have to modify the merge command and offset one of the two streams. Look up the ffmpeg flags to find the correct one to shift one of the streams (can't remember it). That is what I would to if it is always ahead.

DeadEnded commented 3 years ago

Were you able to correct the timing on your recordings? If so, it could be good to share it here for others if they have the same issue.

Cheers! DeadEnd

TSCM-Firestorm commented 3 years ago

Had a similar issue when using it on mine. Offset the audio by +2 seconds with the -itsoffset flag and it worked for a start. The audio was in sync at the beginning but noticed was getting audio drift further in the video. Any ideas what would cause that?

DeadEnded commented 3 years ago

hmm... honestly no - I'm not an FFMPEG expect. Some quick googling points in the direction of audio sample rate being different - since this is (I assume) is audio and video from the camera, it would be odd to have them drift... but that could be the cause. Somehow the rate of the video and the audio are different.

Based on that, I found an example of how to re-sample the rate to adjust it (this would fix a constant drift apart): https://stackoverflow.com/a/37521155

See if that example helps! DeadEnd

zajaaczki commented 2 years ago

I have the same issue. In VLC player: audio and video are synchronised but in motioneye not, 2-4 seconds delay.