Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
ShaharBrandman opened this issue Jun 9, 2021 · 1 comment
Open
3 tasks

Comments

@ShaharBrandman
Copy link

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
@ricfio
Copy link

ricfio commented Jul 23, 2024

The terminateTimeout option (PR #1292) could solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants