node-ytdl-core
node-ytdl-core copied to clipboard
content length header with ffmpeg doesn't work
I'm trying to add the content length header while converting to mp3 with ffmpeg but this just results in an endless download loop
var audio = ytdl(url, {
format: 'mp3',
filter: 'audioonly',
quality: 'highest'
}).on("response", response => {
res.setHeader("content-length", response.headers["content-length"])
var ffmpegProcess = spawn(ffmpeg,['-i','pipe:0','-acodec','libmp3lame','-b','128k','-f','mp3','-'])
audio.pipe(ffmpegProcess.stdin)
ffmpegProcess.stdout.pipe(res)
})
i would actually expect this to straight up fail
options#formatis not supposed to be a string and should result in the library throwing an error (see here)- you can't set the content-length header before being finished with the ffmpeg reencode... there's just no way of knowing the final size...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.