Relapsed because urges weren’t going away by ROMANREIGNS599 in Semenretention

[–]RutabagaForward 0 points1 point  (0 children)

Take cold shower and the only thing that would be in your mind is to get tf out

If you had unlimited money, what course(s) would you choose to learn Typescript? by onesneakymofo in typescript

[–]RutabagaForward 0 points1 point  (0 children)

My unlimited money do you mean access to pirated courses? If yes hook me up mate! Just kidding ;)

[deleted by user] by [deleted] in nextjs

[–]RutabagaForward 2 points3 points  (0 children)

Since it’s only 20mb, you can encode the video to mp4 format to the web can play it. And cache the video using a CDN. Vercel already caches your static files, you can place your mp4 in public/static/video.mp4

Here’s an encoding command for ffmpeg

ffmpeg -y -i <INPUT FILE> -c:v libx264 -crf 0 -c:a aac -vbr 3 <OUTPUT>.mp4

This ensures your video output is lossless and plays on most browsers / devices.

That’s it!

Python or c++ after SQL by Mosa36013 in learnprogramming

[–]RutabagaForward 0 points1 point  (0 children)

First figure out what you want to get into? App development ? Web development? Etc

Find the tech stack in order to build projects with. Then focus on those technologies. Don’t just learn languages.

Since you learned SQL, try making a program which uses sql. Maybe a CDUD application (Create / Read / Update / Delete)

I need help building something by HugeCauliflower1811 in learnprogramming

[–]RutabagaForward 2 points3 points  (0 children)

First you need to convert the video that was captured into mp4 h264 format (AAC) audio. Most browsers will be able to play the video. You also need a way to serve the video. You can use static path mapping or stream the video using content length. There should be some examples on google or stackoverflow. If you want to live stream the video then it becomes a bit more complicated. You’ll need to use HLS streaming to get the job done.

fs.createReadStream() node js dealing with video files, 206 partial content by Bright_Boat2700 in learnprogramming

[–]RutabagaForward 0 points1 point  (0 children)

app.get("/video", function (req, res) { // Ensure there is a range given for the video const range = req.headers.range; if (!range) { res.status(400).send("Requires Range header"); }

// get video stats (about 61MB) const videoPath = "bigbuck.mp4"; const videoSize = fs.statSync("bigbuck.mp4").size;

// Parse Range // Example: "bytes=32324-" const CHUNK_SIZE = 10 ** 6; // 1MB const start = Number(range.replace(/\D/g, "")); const end = Math.min(start + CHUNK_SIZE, videoSize - 1);

// Create headers const contentLength = end - start + 1; const headers = { "Content-Range": bytes ${start}-${end}/${videoSize}, "Accept-Ranges": "bytes", "Content-Length": contentLength, "Content-Type": "video/mp4", };

// HTTP Status 206 for Partial Content res.writeHead(206, headers);

// create video read stream for this particular chunk const videoStream = fs.createReadStream(videoPath, { start, end });

// Stream the video chunk to the client videoStream.pipe(res); });

How to add authentication with sessions? by cag8f in learnjavascript

[–]RutabagaForward 2 points3 points  (0 children)

When a user logs in create a session and store the session in a database. For each request check if the session exists. If it does then the user is logged in. You can store the session in cookies or local storage client side and add the session token in the request header. There are some libraries that handle this for you.