stream-transcoder.js icon indicating copy to clipboard operation
stream-transcoder.js copied to clipboard

Transcode a Movie on the Fly

Open mshafieluru opened this issue 10 years ago • 3 comments

Hi

I have a webm file in my File System and i am trying to transcode it to MP4 to be played in IE, Safari

the code is as follows:

app.js

var httpServer = require('http'); var Transcoder = require('stream-transcoder');

var server = httpServer.createServer(function(req, resp) { if(req.url == "/transcode") { console.log("Inside Transcode");

resp.setHeader('Access-Control-Allow-Origin', '*');
resp.writeHead(200, {'content-type':'video/mp4'});

new Transcoder("12003.webm")
  .maxSize(320, 240)
  .videoCodec('h264')
  .videoBitrate(800 * 1000)
  .fps(25)
  .audioCodec('libfaac')
  .sampleRate(44100)
  .channels(2)
  .audioBitrate(128 * 1000)
  .format('mp4')
  .on('finish', function() {
      next();
    })
    .stream().pipe(resp);
}

} server.listen(8000);

when i open the url in Browser(s), the HTML5 video is not playing it shows only blank image.

the html code is

index.html

Do i need to set content headers.. How can i render this stream as buffered, partical content or what should i do so that video gets played

regards Shafi

mshafieluru avatar Sep 18 '14 12:09 mshafieluru

The file is in right path where the node.js file is. That is not the problem.

mshafieluru avatar Sep 18 '14 12:09 mshafieluru

any sugestions ?

mshafieluru avatar Sep 25 '14 10:09 mshafieluru

@mshafieluru check this

ripper2hl avatar Nov 04 '15 23:11 ripper2hl