Jump to content

Creating a website that renders uploaded videos?

Noah0302

Hey guys,

 

Linus videos on LMGs rendering server made me curious if it were possible for the average hobby programmer to create a website that would function similair to his server.

I obviously dont want to take it as far with exporting complex projects like his server does.

I want the user to upload a video, for example a 10sec 1080p clip, and let the website export it in something like 720p and make it downloadable for the user. Being able to choose the exact resolution from a couple of presets would be awesome, but that probably will be ever more work than this wil no doubt already be.

 

The problem is not, that I dont know how to create a website where the user is able to upload files, but I have no fucking idea how it would be possible to promt the machine running the website to start rendering the uploaded video and make it downloadable.

I think it should be similair to something like a youtube to x converter, only that the website uses the uploaded file and not a youtube video.

 

If anyone has an idea, it would be awesome if you could help me with it!

My Gaming PC:
Inno3D iChill Black - RTX 4080 - +500 Memory, undervolted Core, 2xCorsair QX120 (push) + 2xInno3D 120mm (pull)
AMD Ryzen 7 7800X3D - NZXT x72
G.SKILL Trident Z @6000MHz CL30 - 2x16GB
Asus Strix X670E-E Gaming

1x500GB Samsung 960 Pro (Windows 11 + 10)

1x2TB Kingston KC3000 (Games)

1x1TB WD Blue SN550 (Programs)

1x1TB Samsung 870 EVO (Programs)
Corsair RM-850X + native 12VHPWR-Cable

Lian Li O11 Vision
Alienware 360 HZ QD-OLED AW2725DF, MSI Optix MAG274QRFDE-QD, BenQ ZOWIE XL2720

Logitech G Pro Wireless Superlight 2
Wooting 60HE

Audeze LCD2-C + FiiO K3

Klipsch RP600-M + Klipsch R-120 SW

 

My Notebook:

MacBook Pro 16 M1 Pro - 16GB

 

Proxmox-Cluster:

  • Ryzen 9 3950X, Asus Strix X570E F-Gaming, 4x32GB3200MHz ECC, 2x 512GB NVMe ZFS-Mirror (Boot, Testing-VMs + TrueNAS L2ARC), 2x14TB ZFS-Mirror + 1x3TB (TrueNAS-VM), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i7 8700k delidded undervolted, Gigabyte Z390 UD, 4x16GB 3200MHz, 2x 360GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i5 4670, 3x4GB + 1x8GB 1600MHz, 2x 240GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)

Proxmox-Backup-Server:

  • i5 4670, 4x4GB 1600MHz, 2x2TB ZFS-Mirror, 2,5G NIC
Link to comment
Share on other sites

Link to post
Share on other sites

There's probably a way if you know your way around CLI.  Handbrake has a CLI that you can use to interface with the backend of whatever server you set up.  I wouldn't know where to start as Linux isn't exactly a stronghold for me though.  Could probably work in Windows but I don't do web development either :P

QUOTE ME IN A REPLY SO I CAN SEE THE NOTIFICATION!

When there is no danger of failure there is no pleasure in success.

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, Samfisher said:

There's probably a way if you know your way around CLI.  Handbrake has a CLI that you can use to interface with the backend of whatever server you set up.  I wouldn't know where to start as Linux isn't exactly a stronghold for me though.  Could probably work in Windows but I don't do web development either :P

I didnt know that! Thanks for the reply :)

 

Yeah I plan on using Windows on an old Dell mainboard and a Xeon X5660 to run the server, since I literally dont have more experience in Linux than setting up nextcloud on it for testing XD

My Gaming PC:
Inno3D iChill Black - RTX 4080 - +500 Memory, undervolted Core, 2xCorsair QX120 (push) + 2xInno3D 120mm (pull)
AMD Ryzen 7 7800X3D - NZXT x72
G.SKILL Trident Z @6000MHz CL30 - 2x16GB
Asus Strix X670E-E Gaming

1x500GB Samsung 960 Pro (Windows 11 + 10)

1x2TB Kingston KC3000 (Games)

1x1TB WD Blue SN550 (Programs)

1x1TB Samsung 870 EVO (Programs)
Corsair RM-850X + native 12VHPWR-Cable

Lian Li O11 Vision
Alienware 360 HZ QD-OLED AW2725DF, MSI Optix MAG274QRFDE-QD, BenQ ZOWIE XL2720

Logitech G Pro Wireless Superlight 2
Wooting 60HE

Audeze LCD2-C + FiiO K3

Klipsch RP600-M + Klipsch R-120 SW

 

My Notebook:

MacBook Pro 16 M1 Pro - 16GB

 

Proxmox-Cluster:

  • Ryzen 9 3950X, Asus Strix X570E F-Gaming, 4x32GB3200MHz ECC, 2x 512GB NVMe ZFS-Mirror (Boot, Testing-VMs + TrueNAS L2ARC), 2x14TB ZFS-Mirror + 1x3TB (TrueNAS-VM), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i7 8700k delidded undervolted, Gigabyte Z390 UD, 4x16GB 3200MHz, 2x 360GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i5 4670, 3x4GB + 1x8GB 1600MHz, 2x 240GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)

Proxmox-Backup-Server:

  • i5 4670, 4x4GB 1600MHz, 2x2TB ZFS-Mirror, 2,5G NIC
Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Noah0302 said:

I didnt know that! Thanks for the reply :)

 

Yeah I plan on using Windows on an old Dell mainboard and a Xeon X5660 to run the server, since I literally dont have more experience in Linux than setting up nextcloud on it for testing XD

But Handbrake is more compression, and not at all rendering so I guess that wouldn't fit what you want out of it anyway.  You did mention going from 1080p to 720p so I just assumed a video compression service.  There should be a way to set Handbrake to monitor a folder and auto compress any video in it to specific configurations.

QUOTE ME IN A REPLY SO I CAN SEE THE NOTIFICATION!

When there is no danger of failure there is no pleasure in success.

Link to comment
Share on other sites

Link to post
Share on other sites

Personally i had made a similar server using ffmpeg. I send the file to the server, it extract all frames, manipulate the image like i want (resize, saturation, brightness, contrast, subtitles) then it just stitch it all back in a new file. It was running pretty fast.

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, Noah0302 said:

The problem is not, that I dont know how to create a website where the user is able to upload files, but I have no fucking idea how it would be possible to promt the machine running the website to start rendering the uploaded video and make it downloadable.

I think it should be similair to something like a youtube to x converter, only that the website uses the uploaded file and not a youtube video.

 

If anyone has an idea, it would be awesome if you could help me with it!

There's several ways you can do it.

 

The easiest would be to rent a dedicated server, either on Linux or Windows. They cost from as little as 30-50$ a month.

This way, you can install your own applications and programs, unlike a shared hosting environment where you can only use what's supplied by the ISP and you're sharing the resources (cpu, memory, disk space)

 

You can write your own script or batch file or program that periodically checks the database to see if new videos are uploaded and as soon as a new video is detected, your script will convert the uploaded file to the new format using various tools (ffmpeg, x264, neroaac, mp4box or other muxers)... when done you copy the file to where it can be served to users and then your script updates the database information and marks the video as converted.

 

Another option is to not do the processing on the server. You can use your home computer to download the uploaded videos, convert, upload processed files to server...

 

Other options are to use services designed to do the conversion for you... they give you an api through which your site simply sends a message to that service "get video with id 12345 and convert it and let me known when it's done" and that service will convert the video for you and when done, they'll send you a message with the download link to transfer the converted file back to your server....  Such services are usually expensive, something like 10-15 cents per minute of video, plus 5-10 cents per GB of data transfer for example.

 

I assume Floatplane isn't any different, only they have the web servers which only serve static content (html pages, stylesheets, etc maybe process search requests, live chat if any), they don't hold any actual videos and don't do conversions on these servers ...

then they have streaming/download servers at various datacenters around the world, close to people watching the videos, so that those people will get consistent and high speeds (so videos won't stutter, hiccup, pause to buffer etc) ... these don't necessarily need hard drives, the storage could be a NAS server shared by 10-20 or even more "streaming/download servers" in that datacenter 

and they probably have separate conversion servers which will pick videos queued for conversion and convert them and then broadcast to all the streaming servers that it's done and for each to make a local copy of the videos.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

That'd be pretty easy with a wrapper to ffmpeg.

 

Do a post request with your file, call ffmpeg through your wrapper, return the file that ffmpeg spits out.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

Well. If you're willing to spend a bit of money, AWS Elastic Encode should work fine with many input and output formats.

I once used it in one of my projects and it works good. You'll have to upload your input to S3 and get your output off of S3 as well though.

It's pretty expensive for hobby projects I guess but I used it for my work and my company didn't mind paying for it.

It's far easier than fiddling with ffmpeg manually.

Link to comment
Share on other sites

Link to post
Share on other sites

I do not play on spending any money as I dont actually need it.

 

Its just supposed to be a fun project :)

My Gaming PC:
Inno3D iChill Black - RTX 4080 - +500 Memory, undervolted Core, 2xCorsair QX120 (push) + 2xInno3D 120mm (pull)
AMD Ryzen 7 7800X3D - NZXT x72
G.SKILL Trident Z @6000MHz CL30 - 2x16GB
Asus Strix X670E-E Gaming

1x500GB Samsung 960 Pro (Windows 11 + 10)

1x2TB Kingston KC3000 (Games)

1x1TB WD Blue SN550 (Programs)

1x1TB Samsung 870 EVO (Programs)
Corsair RM-850X + native 12VHPWR-Cable

Lian Li O11 Vision
Alienware 360 HZ QD-OLED AW2725DF, MSI Optix MAG274QRFDE-QD, BenQ ZOWIE XL2720

Logitech G Pro Wireless Superlight 2
Wooting 60HE

Audeze LCD2-C + FiiO K3

Klipsch RP600-M + Klipsch R-120 SW

 

My Notebook:

MacBook Pro 16 M1 Pro - 16GB

 

Proxmox-Cluster:

  • Ryzen 9 3950X, Asus Strix X570E F-Gaming, 4x32GB3200MHz ECC, 2x 512GB NVMe ZFS-Mirror (Boot, Testing-VMs + TrueNAS L2ARC), 2x14TB ZFS-Mirror + 1x3TB (TrueNAS-VM), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i7 8700k delidded undervolted, Gigabyte Z390 UD, 4x16GB 3200MHz, 2x 360GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)
  • i5 4670, 3x4GB + 1x8GB 1600MHz, 2x 240GB HDD ZFS-Mirror (Boot), 1x 1TB Samsung 980 Pro NVMe (Ceph-OSD), Dual 10G NIC (Ceph), 2.5G NIC (VMs), 1G NIC (Cluster)

Proxmox-Backup-Server:

  • i5 4670, 4x4GB 1600MHz, 2x2TB ZFS-Mirror, 2,5G NIC
Link to comment
Share on other sites

Link to post
Share on other sites

I mean this is how floaplane started, with a shoddy ffmpeg driver written in Node.JS that would fire off transcoding jobs after file uploads to a CMS. Eventually the CMS just sent items into a work queue and render nodes picked jobs off the queue to process them.

Link to comment
Share on other sites

Link to post
Share on other sites

On 1/17/2020 at 9:02 AM, Noah0302 said:

The problem is not, that I dont know how to create a website where the user is able to upload files, but I have no fucking idea how it would be possible to promt the machine running the website to start rendering the uploaded video and make it downloadable.

There are queue system - when file is uploaded you send a message to the queue, then a worker gets it, the message can contain like file location and config - what processing to do. The queue workers are asynchronous so user on the website isn't waiting for page to load or what not. And when the worker is done it saves data in a database, like the location of processed file. The worker can be written in one of many languages that have libraries for video processing, like for example but not limited to Python.

 

Some time ago I was working on an audiobook website. I've designed and implemented a system that managed those files. For one it had to download new audiobook files from providers, then prepare for watermarking them and save. When a customer would buy an audiobook the files would go through watermarking software imprinting the transaction ID in them. Then expose those files for download. That was done with Celery tasks, Fraunhoffer software for watermarking and some more stuff.

Link to comment
Share on other sites

Link to post
Share on other sites

Guest
This topic is now closed to further replies.

×