This repository was archived by the owner on May 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 926
Output stream closed when stream passed to aws s3Β #1199
Copy link
Copy link
Open
Description
Version information
- fluent-ffmpeg version: 2.1.2
- ffmpeg version: The lastest
- OS: Linux
Code to reproduce
import { Upload } from '@aws-sdk/lib-storage';
import { PassThrough } from 'node:stream';
import ffmpeg from 'fluent-ffmpeg';
const format = 'webm';
const command = ffmpeg()
.input(fs.createReadStream(data.filePath))
.format(format)
.outputOptions([
'-vf scale=1280x720',
'-b:v 1024k',
'-minrate 512k',
'-maxrate 1485k',
'-tile-columns 2',
'-g 240',
'-threads 8',
'-quality good',
'-crf 32',
'-c:v libvpx-vp9',
'-c:a libopus',
'-speed 4',
])
.pipe()
.on('progress', (progress) => {
console.log(progress);
})
.on('end', function () {
console.log('Video conversion complete');
})
.on('error', function (err) {
console.log('An error occurred: ' + err.message);
});
const folder = path.join(AwsFolder.VIDEOS, data.userId, data.videoId);
const fileName = `${nanoid()}_${data.scale}.${format}`;
const fullPath = path.join(folder, fileName);
const upload = new Upload({
client: this.s3BucketService.client,
params: {
Bucket: 'youtube-nest',
Key: fullPath,
Body: command as PassThrough,
},
});
await upload.done();
When I run this I am getting Error: Output stream closed
(from fluent-ffmpeg
), error occurs after end
event is emitted. Looks like that Passthrough closes stream before is finished (I am using @aws-sdk/client-s3
)
tlvince
Metadata
Metadata
Assignees
Labels
No labels