lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Integrated video hosting via pictrs or peertube?

Open dessalines opened this issue 2 years ago • 7 comments

With pictrs, we've tightly coupled a separate image host with lemmy. We have pictrs instance settings in the config, and have image upload buttons in the UI.

Since a good amount of people are asking for it, and since a lot of other platforms like reddit are making videos and shorts first-class citizens in the UI, maybe we should start thinking about ways to do the same.

Some ideas:

  • See if video support / processing could be added to pictrs. IIRC pictrs does have this somewhat, although I think sound gets stripped, and I'm not sure of the limitations.
  • Integrate with a Peertube instance. Maybe a custom peertube URL, and admin login could be provided in the config, and videos could be uploaded via that, and then we show the embeds in lemmy.
  • Find another rust-specific image host that works with docker

I also want to re-iterate that IMO the main problem of images not being decentrally hosted ( and thus sharing hosting costs like torrents do ), will start to be a much bigger problem as we add videos, with many potentially large videos being individually hosted by many servers while sharing none of the hosting burden. Peertube does support webtorrents, but I'm skeptical about how much that actually gets used, since its not connected to regular torrents, and is only active while people are viewing the videos. If I had a lot more time I'd work on building a media server built atop public torrents, de-duped by file hashes or image perceptual hashes.

cc @asonix @Nutomic

#2312

dessalines avatar Jun 13 '22 14:06 dessalines

Would it be possible to leverage the live streaming feature in Lemmy?

DMTryptamines avatar Jun 16 '22 13:06 DMTryptamines

Since lemmy's a link aggregator, ppl could post links to livestreams, and communities could sticky them, assuming whatever video solution we decide on supports it.

dessalines avatar Jun 16 '22 15:06 dessalines

I have many doubts how this could work with Peertube. Would videos from all users get uploaded to the same account? That would get quite messy. In terms of federation, videos could be federated twice, via Peertube and Lemmy, which will also cause problems. Also, installing Peertube alongside Lemmy would increase resource usage a lot, especially for transcoding.

I think a better solution would be to improve the video player in lemmy-ui which is extremely basic. It only allows playback and thumbnail size or in fullscreen, nothing in between. Some more controls could also be useful. Video processing in pict-rs should be no problem as in uses ffmpeg, might just need some tweaks like keeping sound (and then sound could be muted by default in the lemmy-ui video player). Plus it might be useful to move the upload size limit into lemmy config, to make it easy to change. Maybe even use different size limits for image/video files.

So overall, i think only a couple of minor tweaks are necessary to make basic videos work much better in Lemmy. That should cover most use cases, without the complications of integrating with another platform. For more advanced use cases, its better to link to a specialized video platform.

Nutomic avatar Jun 17 '22 12:06 Nutomic

storing and serving videos take a TON of space and memory. I think it would be good to relegate hosting videos to a separate service, because it drastically changes the hosting requirements.

I prefer a $60 "high memory" VM for hosting a basic peertube instance, but lemmy will work just fine on a $5 VM.

Thann avatar Jun 22 '22 18:06 Thann

@asonix what would be the main issues with adding videos to pictrs?

dessalines avatar Jun 24 '22 13:06 dessalines

there's not really a technical barrier to adding videos to pictrs

i'd just rather not

asonix avatar Jun 24 '22 23:06 asonix

@asonix Is there any particular reason? After all, it should be easy enough to enable or disable video uploads with a config option.

Nutomic avatar Jun 27 '22 18:06 Nutomic

@asonix I saw that pictrs has support for muted video already. @Nutomic Is that testable already? I would love to have that feature, what help is needed to push it forward?

sam365724 avatar Sep 26 '22 16:09 sam365724

There are some fixes around video going into the 0.4 branch that make this work better. 0.3 had issues identifying uploaded mp4 files, meaning really the only real use was for uploading GIFs. 0.4 will also have support for full videos, and better controls for limiting video sizes (there's now a configuration option for specifying the maximum number of frames allowed in uploaded media)

asonix avatar Sep 26 '22 16:09 asonix

@sam365724 You can adjust docker-compose.yml to use the 0.4 beta image. It should work assuming there are no breaking api changes.

https://hub.docker.com/r/asonix/pictrs/tags

Nutomic avatar Sep 29 '22 21:09 Nutomic