fluent-ffmpeg / node-fluent-ffmpeg

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

HLS: export both .ts and .m3u8 files in writeToStream #1031

Open negnatz opened 4 years ago

negnatz commented 4 years ago

Version information

Code to reproduce

//Input stream is .mp4
ffmpeg(inputStream).addOptions([
    '-profile:v main',
    '-c:a aac',
    '-ar 48000',
    '-b:a 192k',
    '-c:v h264',
    '-crf 20',
    '-g 48',
    '-keyint_min 48',
    '-sc_threshold 0',
    '-b:v 5300k',
    '-maxrate 5300k',
    '-bufsize 7500k',
    '-hls_time 4', 
    `-hls_segment_filename %04d.ts`,
    '-hls_playlist_type vod',
    '-f hls'
]).writeToStream(outputStream, { end: true });

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

I am looking to get both the hls_segments and the .m3u8 to export to the stream output.

Observed results

Only the .m3u8 gets sent properly to the stream output and the .ts files appear locally. When I try to have two .writeToStreams(), I get an error. Is this possible?

Checklist

robizzt commented 4 years ago

Did you find solution?

I need same thing for converting and uploading .m3u8, .ts and .m3u8 playlist files on firebase storage. I only managed to upload .m3u8 files, can't find solution to upload .ts files, too.

negnatz commented 4 years ago

Did you find solution?

I need same thing for converting and uploading .m3u8, .ts and .m3u8 playlist files on firebase storage. I only managed to upload .m3u8 files, can't find solution to upload .ts files, too.

I did not find a solution to upload both to a stream (I'm not sure it's possible here). I ended up downloading everything to a folder and then uploading everything together without a stream, and then deleting the temp files in the folder. I am also working with Firebase storage for my case.

Hwan-seok commented 3 years ago

Did you find solution? I need same thing for converting and uploading .m3u8, .ts and .m3u8 playlist files on firebase storage. I only managed to upload .m3u8 files, can't find solution to upload .ts files, too.

I did not find a solution to upload both to a stream (I'm not sure it's possible here). I ended up downloading everything to a folder and then uploading everything together without a stream, and then deleting the temp files in the folder. I am also working with Firebase storage for my case.

This solution is great but does not work with AWS Lambda & Large file because lambda only provide about 500MB tmp storage.

Is anyone know about solving this specific case(without tmp storage)?