Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Error: Output stream closed when trying to stream an mp3 file with expressΒ #1135

Open
@ShaharBrandman

Description

@ShaharBrandman

Version information

  • fluent-ffmpeg version: 2.1.2
  • ffmpeg version:
  • OS: Windows 10

Code to reproduce

const express = require('express')

const server = express()

const ffmpeg = require('fluent-ffmpeg')
ffmpeg.setFfmpegPath('ffmpeg.exe')

server.get('/', (req, res) => {
    res.set('Content-Type', 'audio/mp3')

    ffmpeg()
        .input('track.mp3')
        .toFormat('mp3')
        .pipe(res, { end: true })
});

Expected results

track.mp3 to be streamed to the express server on root

Observed results

Error: Output stream closed
    at Timeout._onTimeout (C:\Users\Shahar_2\Desktop\Projects\CUNTMUSIC-Server\node_modules\fluent-ffmpeg\lib\processor.js:491:25)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)
Emitted 'error' event on FfmpegCommand instance at:
    at emitEnd (C:\Users\Shahar_2\Desktop\Projects\CUNTMUSIC-Server\node_modules\fluent-ffmpeg\lib\processor.js:424:16)
    at Timeout._onTimeout (C:\Users\Shahar_2\Desktop\Projects\CUNTMUSIC-Server\node_modules\fluent-ffmpeg\lib\processor.js:491:17)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

Checklist

  • I have read the FAQ
  • I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place)
  • I have included full stderr/stdout output from ffmpeg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions