Quantcast

Unsynced audio while recording from several sources

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unsynced audio while recording from several sources

Valeriy Shevchuk
Hello, everyone.
I'm trying to use FFmpeg to record video and 3 audio sources and use it to
generate 3 different video files - each file should contain the same video
stream but the different audio stream. The problem is that I got audio sync
issues. The first audio stream is synced perfectly, but the second one has
1 sec lag, and the third one has like 2 sec lag.

I've made a few tests so far and it seems that root cause of the issue is
initialization time of video/audio devices. So, one device is already
recording something but the second is still being opened and so on. I've
tried to change input devices order and after that audio streams still have
the same issue BUT if before 2nd and 3rd audio streams were some time ahead
of video, after reordering they became to lag after the audio (audio for
the same event appears with some delay). So this test confirms my version
about device initialization times.

But the question still, why the first audio stream is synchronized
properly, while other 2 are not. and also, how could I overcome this
issues? Any workarounds and ideas are highly appreciated.

Here is FFmpeg command I'm using and it's output.

ffmpeg.exe -f dshow -video_size 1920x1080 -i video="Logitech HD Webcam
> C615"  -f dshow -i audio="Microphone (HD Webcam C615)" -f dshow -i
> audio="Microphone Array (Realtek High Definition Audio)"
> -filter_complex "[1:a]volume=1[a1];[2:a]volume=1[a2]" -vf
> scale=h=1080:force_original_aspect_ratio=decrease -vcodec libx264
> -pix_fmt yuv420p -crf 23 -preset ultrafast -acodec aac -vbr 5 -threads 0
> -map v:0 -map [a1] -map [a2] -f tee
> "[select=\'v,a:0\']C:/Users/vshevchu/Desktop/123/111/111_jjj1.avi|
> [select=\'v,a:1\']C:/Users/vshevchu/Desktop/123/111/111_jjj2.avi"


Here is the output:
https://pastebin.com/A3FL05My

PS. Actually, the issue is exactly the same when I'm not using "tee" muxer
but writing all the audio streams to one container. So, "tee" isn't a
suspect.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unsynced audio while recording from several sources

rogerdpack2
does async or vsync options help?

On 4/4/17, Valeriy Shevchuk <[hidden email]> wrote:

> Hello, everyone.
> I'm trying to use FFmpeg to record video and 3 audio sources and use it to
> generate 3 different video files - each file should contain the same video
> stream but the different audio stream. The problem is that I got audio sync
> issues. The first audio stream is synced perfectly, but the second one has
> 1 sec lag, and the third one has like 2 sec lag.
>
> I've made a few tests so far and it seems that root cause of the issue is
> initialization time of video/audio devices. So, one device is already
> recording something but the second is still being opened and so on. I've
> tried to change input devices order and after that audio streams still have
> the same issue BUT if before 2nd and 3rd audio streams were some time ahead
> of video, after reordering they became to lag after the audio (audio for
> the same event appears with some delay). So this test confirms my version
> about device initialization times.
>
> But the question still, why the first audio stream is synchronized
> properly, while other 2 are not. and also, how could I overcome this
> issues? Any workarounds and ideas are highly appreciated.
>
> Here is FFmpeg command I'm using and it's output.
>
> ffmpeg.exe -f dshow -video_size 1920x1080 -i video="Logitech HD Webcam
>> C615"  -f dshow -i audio="Microphone (HD Webcam C615)" -f dshow -i
>> audio="Microphone Array (Realtek High Definition Audio)"
>> -filter_complex "[1:a]volume=1[a1];[2:a]volume=1[a2]" -vf
>> scale=h=1080:force_original_aspect_ratio=decrease -vcodec libx264
>> -pix_fmt yuv420p -crf 23 -preset ultrafast -acodec aac -vbr 5 -threads 0
>> -map v:0 -map [a1] -map [a2] -f tee
>> "[select=\'v,a:0\']C:/Users/vshevchu/Desktop/123/111/111_jjj1.avi|
>> [select=\'v,a:1\']C:/Users/vshevchu/Desktop/123/111/111_jjj2.avi"
>
>
> Here is the output:
> https://pastebin.com/A3FL05My
>
> PS. Actually, the issue is exactly the same when I'm not using "tee" muxer
> but writing all the audio streams to one container. So, "tee" isn't a
> suspect.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Loading...