videoshow icon indicating copy to clipboard operation
videoshow copied to clipboard

Make slideshow run based on audio, not audio based on number of images

Open techsin opened this issue 7 years ago • 3 comments

i've 1 image, i want it to remain there until whole audio is done.

right now it's setup so audio is just background music and slides are the main content

techsin avatar Dec 29 '17 01:12 techsin

did you solve this...? I want to also use 1 image and allow the audio length to set the video length to the total length of audio clip.

jremi avatar Feb 23 '18 18:02 jremi

Yes I have! I'm at work atm but ill try to give you an example when I get home tonight. I found a few ways to do it.

On Feb 23, 2018 12:47 PM, "jremi" [email protected] wrote:

did you solve this...? I want to also use 1 image and allow the audio length to set the video length to the total length of audio clip.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/h2non/videoshow/issues/60#issuecomment-368102715, or mute the thread https://github.com/notifications/unsubscribe-auth/AI4VC-EPkSPuJlUnERT_nC4q5Kmhm4Myks5tXwfJgaJpZM4ROy9w .

JMGoebel avatar Feb 23 '18 19:02 JMGoebel

For anyone that may come accross this thread... Here is my solution to being able to use 1 image and have the video the total length of the audio clip duration.

var videoOptions = {
  disableFadeOut : true,
  disableFadeIn : true,
  transition: false
}
var wavFileInfo = require('wav-file-info');
wavFileInfo.infoByFilename(audio, function(err, info){
  if (err){throw err}    
  var wavFileDuration = Math.ceil(info.duration);

  // Each image in video array appears to be equal to 5 seconds
  // Build array length of duplicates to match audio wav duration
  var imageDuplicationSize = Math.ceil(wavFileDuration/5);
  var images = [];
  for(var x=0; x<=imageDuplicationSize; x++){
    images.push(__dirname + '/myImage.jpg');
  }
  videoshow(images, videoOptions)
});

jremi avatar Feb 23 '18 20:02 jremi