I could work with that. Set a max file size on the relay so photos work fine, maybe short clips, but full length videos have to be embedded from somewhere. Either a service I offer at some extra cost, serving from an S3 through a CDN, or they can upload and paste in a URL to post to NostrFans themselves at no extra cost on my end.
Discussion
Images are adopted to a client by CDN too! Have you seen picture and img HTML tags? Not new, and thatโs how we have seamless experience on all clients!
Video needs re-encoding for even short clips, or say goodbye to mobile users (majority)! ๐ถ๐พ๐ซก
Yeah but Cloudflare and CloudFront just cache images automatically, they can just be set to cache everything coming out of a server so I don't think special config is needed.
Any CDN offering a video streaming service will auto encode for the target device if needed. If that ends up being costly I could simply have my web app encode and compress videos on upload using ffmpeg so they're mobile friendly already.
Honestly things are so flexible these days with services offering pay for what you use type plans it's never been easier.
If I was trying to do the same thing just 10 years ago I'd have to rent a lot more compute power upfront!
Depends on CDN, new generation does much more. Hash will be broken. JSON images will not play well.
Re-encoding on the client is not feasible, since resource consumption and number of formats/sizes needed is high. No mobile will last on battery.
Re-encoding is usually not done on-the-fly, only for real-time streaming at reduced quality.
And I do know what offerings are out there for most of that, just due to the nature of my profession! ๐ถ๐พ๐ซก๐ซ
I wasn't suggesting encoding on the client. Rather when the content creator uploads the video to my site to embed in a Nostr note, my site would run a little ffmpeg script on the server to encode on upload, compressing and making sure it'll play nice with mobile.
Since this only happens when a video is uploaded and the result is lower CPU and bandwidth usage for playback it seems like the sensible approach, otherwise I'm probably paying extra to a CDN to automate that task for me per client.
I am not sure if you have experience encoding many videos on a server, but I assure you that it is a very costly operation. Youโll need a whole farm of GPU fitted servers to handle the load.
If you expect small number of uploads, then external service like Qencode, mux, etc. might be within reason from cost perspective, otherwise it can be prohibitive.
Scripting ffmpeg can be done, but diversity of source media can be a huge challenge, if you expect good results!
๐ถ๐พ๐ซก
I've only done this kinda thing on a small scale before but I do have experience encoding videos including on servers.
I'm not gonna be hosting 4K HDR here. I'm thinking 720p max. And the upload will be limited by file size so I wouldn't need to worry about the expensive task of transcoding 4K down to 720p for example.
In my experience working with videos in the 720p range is no problem for a modern CPU VPS.
As the service grows we may see demand for higher resolution but by that point the money would be rolling in.
But realistically most people will view this content on their phones. I don't anticipate huge demand for high res video. 720p is the sweet spot where it can be compressed sufficiently to minimize storage and bandwidth usage and not make any difference in viewing experience on a phone.
Fair. But youโll also need to consider using HLS and adaptive quality, if phones is your target. Also, relay and encoder should never be on the same system (security and performance). And synchronizing all of that between relays will be a challenge, once you want to go beyond 2-3.
Solved problem with CDN and object storage! ๐ถ๐พ๐ซก
I'm definitely planning on using object storage. I mentioned S3 earlier. Ideally wouldn't wanna use AWS, but obviously a lot of other hosts have adopted the standard nowadays.
Like I said from the start I'm only planning to store images or maybe small short clips on the actual relay. Any videos would be on a separate server.
Yes I'd have another VPS dedicated to encoding videos, then it would fling them to object storage once they're ready and they get served from there so I only pay proportionally to how popular the content is.
And at this point I'm really just building something experimental for the fun of it. If I get to the point where my biggest problem is keeping up with the sheer volume of high demand for my service I'd be pretty happy to say the least! At that stage I'll have enough subscriptions coming in I can scale up, pay staff if needed.
Not even thinking that far ahead yet though this is just a hobby project to try building something new on new technology. If it happens to actually take off that's a bonus.
Understood! It was a pleasure discussing this with you, thank you! ๐ถ๐พ๐ซ๐ซก