Reputation: 112
I have a HTML page which has two audio files ABC.mp3 of 30 sec and XYZ.mp3 of 15 sec. I need to combine these two files in such a manner that I get a new file PQR.mp3 of 30 sec (AND NOT 45 sec) which has one file overlapped/merged over the other. Any kind of plug-ins, javascript etc. will be helpful, keeping HTML and HTML5 under consideration.
Upvotes: 2
Views: 5043
Reputation: 5410
Simple answer: No. Neither Javascript nor HTML5 have the power to do this. You will need server side tools to do this. For example ffmpeg and LAME in case of MP3.
If you really need to do such manipulations on a HTML basis, the only way is to bind these programms to a php script or NodeJS server that then starts a job to do what you want to do. Nevertheless you would have to write bash script or cronejobs to do so.
edit
For nodeJS you will need to write your own node server application. The application then should be using socketIO and node-fluent-ffmpg which also has lame with it. The app could look like this
server:
var io = require('socket.io').listen(80);
var exec = require('child_process').exec;
io.sockets.on('connection', function (socket) {
socket.on('mergeFiles', function (data) {
var firstFile = data.firstFile;
var secondFile = data.secondFile;
//do ffmpg stuff by executing a shell script
execString = "./yourscript.sh " + firstFile + " " + secondFile
function puts(error, stdout, stderr) { sys.puts(stdout) }
exec(execString , puts);
});
client:
<script src="/socket.io/socket.io.js"></script>
<script>
var firstFile = ABC.mp3;
var secondFile = XYZ.mp3;
var socket = io.connect('http://localhost');
socket.emit('mergeFiles', { firstFile: firstFile, secondFile: secondFile });
</script>
Upvotes: 1