fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.48k stars 790 forks source link

ffmpeg exited with code 1: pipe:0: Invalid data found when processing input #567

Closed Splinteer closed 4 years ago

Splinteer commented 4 years ago

fluent-ffmpeg is no longer working with ytdl-core. My code was working before but now impossible to save as mp3 or even stream audio using ffmpeg. I used both example to try but I've got the same error.

Here is my code:

const opts = {
  filter: 'audioonly',
  quality: 'highestaudio',
  requestOptions: {
    agent: new ProxyAgent('http://myproxt')
  }
}
const audio = ytdl('M2fkC7nnoO0', opts)

res.setHeader('Content-Type', 'audio/mpeg')
res.setHeader('Content-Disposition', 'inline; filename=test.mp3')

ffmpeg(audio)
  .audioCodec('libmp3lame')
  .audioBitrate(128)
  .format('mp3')
  .on('error', (err) => {
    console.log('ffmpeg error', err)
  })
  .on('end', () => console.log('Finished!'))
  .pipe(res, {
    end: true
  })

But always got this error even with the code from both examples

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input

    at ChildProcess.<anonymous> (/var/www/api/node_modules/fluent-ffmpeg/lib/processor.js:182:22)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
Emitted 'error' event at:
    at emitEnd (/var/www/api/node_modules/fluent-ffmpeg/lib/processor.js:424:16)
    at endCB (/var/www/api/node_modules/fluent-ffmpeg/lib/processor.js:544:13)
    at handleExit (/var/www/api/node_modules/fluent-ffmpeg/lib/processor.js:170:11)
    at ChildProcess.<anonymous> (/var/www/api/node_modules/fluent-ffmpeg/lib/processor.js:182:11)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
lucasriondel commented 4 years ago

Same here.

fent commented 4 years ago

it looks like audioonly formats are now encrypted. on the upside, download speed is much faster.

fent commented 4 years ago

hmm, m3u8stream might be parsing the dash mpd file incorrectly. will investigate a bit.

fent commented 4 years ago

fixed in m3u8stream v0.6.5. I'm actually not sure how to update a subdependency in npm. but if npm update doesn't work, try reinstalling ytdl-core