From d1dab74d5f9beb87250bde98e990d19038796755 Mon Sep 17 00:00:00 2001 From: Prajjawalk Date: Fri, 5 Apr 2024 00:22:10 +0530 Subject: [PATCH] add: logging --- packages/nextjs/app/slow-fetch/route.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nextjs/app/slow-fetch/route.ts b/packages/nextjs/app/slow-fetch/route.ts index 2e261c6..c4ef6b6 100644 --- a/packages/nextjs/app/slow-fetch/route.ts +++ b/packages/nextjs/app/slow-fetch/route.ts @@ -96,12 +96,13 @@ export async function POST(req: NextRequest) { // fetch the playback info on the server const playbackInfo = await livepeer.playback.get(playbackId); const videoUrl = playbackInfo.playbackInfo?.meta.source[0]?.url; + console.log(videoUrl); // const videoUrl = downloadUrl; // console.log("playback info ", playbackInfo.playbackInfo?.meta.source[0]); // Download MP4 video file - const mp4FilePath = `tmp/video-${playbackId}.mp4`; + const mp4FilePath = `video-${playbackId}.mp4`; const mp4FileStream = fs.createWriteStream(mp4FilePath); const response = await axios.get(String(videoUrl), { responseType: "stream" }); @@ -117,7 +118,7 @@ export async function POST(req: NextRequest) { console.log("mp4 file downloaded..."); // Convert MP4 to GIF using FFmpeg - const gifFilePath = `tmp/output-${playbackId}.gif`; + const gifFilePath = `output-${playbackId}.gif`; await new Promise((resolve, reject) => { exec( `npx ffmpeg -i ${mp4FilePath} -vf "fps=10,scale=320:-1:flags=lanczos" -c:v gif -loop 0 ${gifFilePath}`,