ffmpeg exited with code 1: Output #0, mp4, to ‘D:billion-viewvideo-compilation-electron-app.billionviewssimple_audioyt-video-best-short-motivational-speech-video-24-hours-1-minute-motivation-2-fLeJJPxua3E-15-30.mp4’:
Output file #0 does not contain any stream
const videoFormats = info.formats.filter(
(format: videoFormat) =>
format.container === "mp4" && format.hasVideo && format.videoCodec && format.videoCodec.includes("avc1")
);
videoFormats.sort((a: videoFormat, b: videoFormat) => (b.height || 0) - (a.height || 0));
const bestVideoFormat =
videoFormats.find((format: videoFormat) => (format.qualityLabel = "1080p")) || videoFormats[0];
const readableVideo = ytdl.downloadFromInfo(info, {
format: bestVideoFormat,
// requestOptions: { agent },
});
const readableAudio = ytdl(media.location, {
quality: "highestaudio", // Ref: https://github.com/fent/node-ytdl-core#ytdlchooseformatformats-options
// requestOptions: { agent },
});
readableVideo.on("progress", (_, downloaded: number, total: number) => {
progressHandler?.({
eventType: MediaProgressEventType.Download,
timeStamp: new Date().toISOString(),
culminationType: MediaProgressCulminationType.Running,
media,
percent: (100 * downloaded) / total,
});
});
readableAudio.on("progress", (_, downloaded: number, total: number) => {
progressHandler?.({
eventType: MediaProgressEventType.Download,
timeStamp: new Date().toISOString(),
culminationType: MediaProgressCulminationType.Running,
media,
percent: (100 * downloaded) / total,
});
});
agent?.destroy(); // Destroy the proxy agent.
const writableVideo = createWriteStream(outputVideoPath);
const writableAudio = createWriteStream(outputAudioPath);
await pipeline(readableVideo, writableVideo);
await pipeline(readableAudio, writableAudio);
readableVideo.on('end', () => console.log('Video stream downloaded successfully.'));
readableAudio.on('end', () => console.log('Audio stream downloaded successfully.'));
writableVideo.on('finish', () => console.log('Video written to file successfully.'));
writableAudio.on('finish', () => console.log('Audio written to file successfully.'));
readableVideo.destroy();
writableVideo.destroy();
readableAudio.destroy();
writableAudio.destroy();`
New contributor
Test Dev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1