CasparCG / server

CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
GNU General Public License v3.0
890 stars 271 forks source link

Version 2.2 audio out of sync #1170

Closed Xeing closed 4 years ago

Xeing commented 5 years ago

I have found synchronization failures when trying to play several files with versions 2.2 and 2.3 that however in version 2.1 work correctly.

This file is an example: https://www.dropbox.com/s/uf6d4ld9m1zsbq5/avst.mp4?dl=0

Environment

Server version: 2.2.0 66a9e3e Stable Operating system: Win 10 x64 Graphics driver: Nvidia 417.35 (for GTX1050) Decklink drivers: none

Julusian commented 5 years ago

Is this a problem with all files/sources, or only a couple of files you have?

Xeing commented 5 years ago

I have tried several videos and it seems that:

  1. In all videos the audio and video do not start at the same time and there is a small lag.

  2. If the samplerate of the file is 44100, it plays at 48000, so after a few seconds the sound is completely out of phase.

m0vse commented 5 years ago

I can confirm that I am seeing the same effect, playing a long (90 minute) MP4 file (25fps with 44.1Khz audio) the audio was massively out of sync almost from the start and got progressively worse. This same video played perfectly in 2,07 and 2.1. I used Handbrake to re-encode the audio to 48K and the sync problems are gone, so this is a suitable workaround for now but something has definitely changed.

m0vse commented 5 years ago

This was using a Decklink 4K Extreme with the latest BMD drivers.

WuGGu commented 5 years ago

Hi everyone, same problem also with the file of @Xeing. async playback of mp4 files.

CasparCG 2.2.0 Stable Windows 10 BMD Decklink Duo Decklink Drivers: 11.1 newest

ryci-us commented 5 years ago

looks like a bug is in https://github.com/CasparCG/server/blob/bfe314ea5d09762962690a0e39038d777717e18c/src/modules/ffmpeg/producer/av_producer.cpp#L226-L230

From ffmpeg-filters manual 7.37 asetrate - Set the sample rate without altering the PCM data. This will result in a change of speed and pitch.

ryci-us commented 5 years ago

I have tested with 2.3.0 https://github.com/CasparCG/server/commit/5fadfc858a797a25a1adf502dc8eb23be45372b4 and can confirm that everything is fixed. This issue can be closed.

premultiply commented 5 years ago

https://github.com/CasparCG/server/pull/1215#discussion_r291501178

abmkrishnan commented 4 years ago

It is playing correctly without using SEEK command. But the issue is still there with SEEK command. Is there any workaround without modifying the source file to play correctly?

ryci-us commented 4 years ago

Can you give example to reproduce it?

toresbe commented 4 years ago

This will retain sync (there might be a lip flap issue with the source material, but at least the delay is constant):

PLAY 1-150 "https://upload.frikanalen.no/media/625334/theora/SirKenRobinson_2010.ogv"

Here it will go very badly:

PLAY 1-150 "https://upload.frikanalen.no/media/625334/theora/SirKenRobinson_2010.ogv" SEEK 1500

abmkrishnan commented 4 years ago

any update?

Julusian commented 4 years ago

This is fine when not seeking, the seek portion of this is a duplicate of https://github.com/CasparCG/server/issues/1239