fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.81k stars 874 forks source link

Stream mov to flv with ffmpeg #811

Open szbk opened 6 years ago

szbk commented 6 years ago

When I run the following code, the flv file is being created. But it does not play. (File size 0 kB)

var ffmpeg = require('fluent-ffmpeg');
var fs = require('fs');

var write = fs.createWriteStream('output.flv');
var stream = fs.createReadStream('video.mov');

ffmpeg(stream).format('flv').pipe(write, {end: true});

It works when I change the code like this:

var ffmpeg = require('fluent-ffmpeg');
var fs = require('fs');

var write = fs.createWriteStream('output.flv');

ffmpeg('video.mov').format('flv').pipe(write, {end: true});

I'm looking for a way to convert a .mov file to a .flv file using ffmpeg and createReadStream. Support.

Notes: .mov files created with iPhone / iPad

szbk commented 6 years ago

Can anyone hear me?

njoyard commented 6 years ago

Why would you use streams when you just want to read and write files?

In any case, you should avoid using streams for both input and output of a program at the same time. This is known to cause issues (and is not node-specific).

As for the exact issue that leads to an empty file, without further information on the output from ffmpeg there's not a lot we can do to help diagnose.

federicocarboni commented 3 years ago

Same as #932