We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
async start(url, user = null, pass = null) { console.log('Transcoding:', url); const headers = {}; try { if (user && pass) { const encodedCredentials = Buffer.from(`${user}:${pass}`).toString('base64'); headers['Authorization'] = `Basic ${encodedCredentials}`; } // Fetch the video from the URL const response = await fetch(url, { headers, redirect: 'follow' }); if (!response.ok) { throw new Error(`Failed to fetch video: ${response.statusText}`); } // Create a readable stream from the response const videoStream = response.body; // const videoStream = response.body; // const reader = response.body.getReader(); // const videoStream = new ReadableStream(response.body); // Ensure videoStream is a valid readable stream if (!videoStream) { throw new Error('Failed to get video stream from response'); } // Create a pass-through stream to handle ffmpeg output const outputStream = new PassThrough(); // outputStream.writable = true; // Pipe the video stream through ffmpeg to transcode it to mp4 ffmpeg(videoStream) .format('mp4') .output(outputStream) .videoCodec('libx264') .audioCodec('aac') .on('start', (commandLine) => { console.log('Spawned Ffmpeg with command: ' + commandLine); }) .on('error', (err) => { console.error('Error:', err.message); console.error(err); outputStream.destroy(err); // destroy the stream in case of error }) .on('progress', (progress) => { console.log(JSON.stringify(progress, null, 2)); console.log('Processing: ' + progress.percent + '% done'); }) .on('end', () => { console.log('Transcoding finished'); }) // .pipe(outputStream) .run(); return outputStream; } catch (err) { throw err; } }
I get a conversion error ffmpeg 234
The text was updated successfully, but these errors were encountered:
I do not want to have to download the entire file first.
Sorry, something went wrong.
No branches or pull requests
I get a conversion error ffmpeg 234
The text was updated successfully, but these errors were encountered: