how to transcode from video to audio with pure JavaScript? (for example, mp4 to wav)
PS: my goal is to grab the sound of the video from the web page into audio, and then recognize the text through platforms such as iFLYTEK.
how to transcode from video to audio with pure JavaScript? (for example, mp4 to wav)
PS: my goal is to grab the sound of the video from the web page into audio, and then recognize the text through platforms such as iFLYTEK.
what the front end cannot do, if you really want to do it with js, you cannot do it in the browser with this https://www.npmjs.com/package.
under
nodejs. You can use nodejs to deal with
this is done in the background, whether it is audio or video, it belongs to streaming and needs to be converted to format in the background
. Use ffpmeg
refer to the following code stackoverflow from-a-video-file/49182456-sharp49182456" rel=" nofollow noreferrer "> https://stackoverflow.com/que.
to extract audio, but the problem that the audio volume is larger than the source video has not been solved.
someone mentioned the method of offlineAudioContext.startRendering (), which can solve the volume problem?
var videoSrc = 'http://otof18y9e.bkt.clouddn.com/frag_bunny.mp4'
function startSelect(){
var audioContext = new OfflineAudioContext(2, 44100 * 100, 44100);
// var audioContext = new window.AudioContext()
var videoFileAsBuffer = new Promise(requestVideo)
videoFileAsBuffer.then(function (data) {
console.log(data)
audioContext.decodeAudioData(data).then(function (decodedAudioData) {
mySoundBuffer = decodedAudioData
soundSource = audioContext.createBufferSource()
soundSource.buffer = mySoundBuffer
soundSource.connect(audioContext.destination)
// soundSource.start()
console.log(mySoundBuffer.length)
});
})
}
function requestVideo(resolve){
var xhr = new XMLHttpRequest()
xhr.open('GET', videoSrc, true)
xhr.responseType = 'arraybuffer' // 'blob'
xhr.onload = function(e) {
var binaryData = this.response
// console.log(binaryData)
resolve(binaryData)
}
xhr.send()
}
Previous: VFF = ".of." in Vue And vMuthofo = ".in." What's the difference
Next: With the experience of java, what is the general learning route and time of learning unity?