Wednesday, 28 August 2013

converting a static file to a h264/mp4 stream produces sped up video

converting a static file to a h264/mp4 stream produces sped up video

I'm building a NodeJS application that converts a static videofile to a
streamable video which is being sent to a client (iPad or browser) on the
fly (using the fluent-ffmpeg module).
Everything is set and all I need now is to configure ffmpeg correctly. But
I'm having a lot of problems with ffmpeg.
With my current settings, I hear audio right away, but the picture starts
a couple of seconds later. Then, my 30 second test file has been
compressed to 3 seconds of high speed imagery.
How can I configure my ffmpeg so it will stream the mp4 correctly (in one
pass through of course). It seems it is streaming raw h264, if that is the
case how can I force the mp4 container. I thought I was doing that by
using '-f mp4'
my correct settings are:
'-crf 22','-c:v libx264','-f mp4','-movflags','faststart+frag_keyframe'
I've also tried:
'-r 30','-crf 30','-analyzeduration 0','-probesize 1000','-rc_lookahead
0','-fflags nobuffer','-g 75','-ss 0','-threads 0','-vcodec
libx264','-qcomp 0.6','-qmin 10','-qmax 51','-qdiff 4','-b:v
400k','-maxrate 400k','-bufsize 800k','-acodec mp3','-ab 192k','-ar
44100','-tune zerolatency','-f mp4','-movflags','faststart+frag_keyframe'
As you can see by the amount of options I've tried, I'm getting pretty
desperate. I'm basically just running around in the dark.
I don't think it matters much but these are my request headers:
res.writeHead(200, { // NOTE: a partial http response
'Content-Type':'video/mp4',
'Content-Length':stat.size,
'Content-Range':'bytes '+start+'-'+end+'/'+stat.size,
'Transfer-Encoding':'chunked'
});

No comments:

Post a Comment