Audio and video get slowly out of sync on captured stream
Posted: 27 Oct 2016 08:48
Hi all,
I am a volunteer at an internet broadcast foundation. We provide a live stream of 2 hours on every saturday. I am trying to archive these streams on my home computer with VLC player version 2.2.4
I use a batch file to start the capture every saturday at 11:00 and I capture every hour as a separate mp4 file
I use the following code:
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --run-time 3600 rtmp://<stream name> --sout="#std{access=file,mux=mp4,dst='E:\firsthour.mp4'}" vlc://quit
This works flawlessly except for 1 thing: The audio and video start in sync but at the end of the hour the audio is about 1 second ahead of the video so far from lip sync.
What I saw is that the original stream uses 25 frames per second but the captured file uses 24 frames per second. When I put the stream down to 24 frames per second the captured file claims to be in 23 frames per second so always 1 frame per second less.
However, the difference in frame rate cannot explain the sync problem because 1 frame difference per second should create 1 second difference in 25 seconds and that is far from the case.
Anybody an idea what causes this problem and how to correct this ?
I tested it also on other rtmp TV streams but the problem is there always.
Thanks in advance,
Ton
I am a volunteer at an internet broadcast foundation. We provide a live stream of 2 hours on every saturday. I am trying to archive these streams on my home computer with VLC player version 2.2.4
I use a batch file to start the capture every saturday at 11:00 and I capture every hour as a separate mp4 file
I use the following code:
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --run-time 3600 rtmp://<stream name> --sout="#std{access=file,mux=mp4,dst='E:\firsthour.mp4'}" vlc://quit
This works flawlessly except for 1 thing: The audio and video start in sync but at the end of the hour the audio is about 1 second ahead of the video so far from lip sync.
What I saw is that the original stream uses 25 frames per second but the captured file uses 24 frames per second. When I put the stream down to 24 frames per second the captured file claims to be in 23 frames per second so always 1 frame per second less.
However, the difference in frame rate cannot explain the sync problem because 1 frame difference per second should create 1 second difference in 25 seconds and that is far from the case.
Anybody an idea what causes this problem and how to correct this ?
I tested it also on other rtmp TV streams but the problem is there always.
Thanks in advance,
Ton