zhw2590582 / WFPlayer

:ocean: WFPlayer.js is an audio waveform generator
https://wfplayer.js.org
MIT License
262 stars 32 forks source link

Is there any way to load wave form faster of large video file? #17

Closed salmanAhmad143 closed 3 years ago

salmanAhmad143 commented 3 years ago

Hey @zhw2590582 ,

As per your suggestion i am using web-audio-api and creating PCM file to generate wave. But the problem is PCM file is also taking long time to display wave form. Till the complete PCM file not loaded in browser wave form showing a thin line.

Is there any other fastest way to generate wave form?

Like wfplayer should not wait to load the complete PCM file data and should start to draw wave?

Please suggest. Thanks

zhw2590582 commented 3 years ago

I have updated readme.md, and I recommend using the method of loading mp3 instead of the method of loading pcm.

salmanAhmad143 commented 3 years ago

@zhw2590582 , So in that case if the the mp3 file size is big then it would not take time to load? E.g Suppose if i am creating a MP3 file from a 1 GB MP4 file using ffmpeg then its file size will be high so in this case wfplayer will not took time in loading?

zhw2590582 commented 3 years ago

I just tried it and converted a 1G mp4 video to mp3. The result was only 6M in size. For modern network bandwidth, loading this audio should be fast.

salmanAhmad143 commented 3 years ago

@zhw2590582 , Even i also tried it my side and the output mp3 file size of 1 GB mp4 video is 8.7 MB but this is when i use the same parameters that you have mentioned in your e.g command. Like channel 1 and sample rate 8000. I am not much aware about these two parameter.

  1. What will be the impact of this?
  2. Do i need to change these as per my mp4 video?

ffmpeg -i path/to/video.mp4 -ac 1 -ar 8000 path/to/audio.mp3

zhw2590582 commented 3 years ago

This command is applicable to all mp4 files, all this command needs to do is to compress the mp3 as much as possible, basically no changes are needed