Die Web Audio API ist genau das, was Sie wollen. Insbesondere möchten Sie eine MediaElementAudioSourceNode
in eine AnalyserNode
einspeisen. Leider ist die Web Audio API nur in Chrome implementiert (etwas in FF implementiert) und sogar in Chrome doesn't have full support for MediaElementAudioSourceNode
yet.
var context = new webkitAudioContext();
// feed video into a MediaElementSourceNode, and feed that into AnalyserNode
// due to a bug in Chrome, this must run after onload
var videoElement = document.querySelector('myVideo');
var mediaSourceNode = context.createMediaElementSource(videoElement);
var analyserNode = context.createAnalyser();
mediaSourceNode.connect(analyserNode);
analyserNode.connect(context.destination);
videoElement.play();
// run this part on loop to sample the current audio position
sample = new Float32Array(analyser.frequencyBinCount);
analyser.getFloatFrequencyData(sample);
Ich weiß nicht, ob Javascript für solche Aufgaben geeignet ist. Bitte beziehen Sie sich auf dieses Thema: http://stackoverflow.com/questions/11182587/extract-audio-from-video-stream-using-javascript –