About Store Forum Documentation Contact



Post Reply 
Video and Sound desync
Author Message
Pherael Offline
Member

Post: #1
Video and Sound desync
I using this simple code to play video with sound

PHP Code:
bool InitCredit()
{
   
partTime 0;
   
sound.del();
   
sound.create(UID(1156849801130493836917073251162047150946), true).play();
   
video.del();
   
video.create(UID(1156849801130493836917073251162047150946), true);
   
   
windowCreditsVideo.create();
   
windowCreditsVideo.show();
   return 
true;
}

void ShutCredit()
{
   
video.del();
   
sound.del();
   
windowCreditsVideo.hide();
   
}

bool UpdateCredit()
{
  
windowCreditsVideo.update();
  
Gui.update();
  
partTime += Time.rd();
  
video.update(partTime);
  if(
Kb.k.any() || Ms.bp(0) || Ms.bp(1))
  {
     
StateMenu.set();
     
  }
  return 
true;
   
}

void DrawCredit()
{
   
video.drawFs(FIT_FULL);
   
Gui.draw();
   


But on different computers time and sound play with different speed, on some units plays correctly, on others no. I'm using vp9 codecs and video is converted to 30fps. In other place in game I'm using theora codec and 25 fps video and this problem occurs too.
(This post was last modified: 10-16-2019 08:57 AM by Pherael.)
10-16-2019 08:54 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Video and Sound desync
you could try:

calling sound.play at the end of InitCredit

also XX.del; XX.create // <- del is useless because create already does the job

also: you could try
video.update(partTime) replace with video.update(sound.time())
10-17-2019 03:58 AM
Find all posts by this user Quote this message in a reply
Pherael Offline
Member

Post: #3
RE: Video and Sound desync
Thanks, video.update(sound.time()) sound like good idea, I will try it.
Problem with video and sounds is more about speed of each other, so calling sound.play at the end of InitCredit wouldn't do much. With time difference is bigger and bigger.
10-17-2019 10:14 AM
Find all posts by this user Quote this message in a reply
Post Reply