Open andre-fuchs opened 1 year ago
👋 just noting RFC 72: Background workers feels very relevant as far as the processing needed of the video files.
👋 just noting RFC 72: Background workers feels very relevant as far as the processing needed of the video files.
This would solve the conversion part, of course! Amazing how Wagtail is evolving. I am game to help with the development of this adaptive streaming feature. I would need some guidance though. Would you implement adaptive streaming via the wagtailmedia package? It uses a Media() model for both video and audio. HTTP Live Streaming could be interesting for both. ffmpeg converts both video and/or audio for HLS, I think. I have never done this before, to be honest.
If you need any help, I am willing as well to help! Depending on the platform they use one strategy or another. In twitch.tv they convert to HLS, but others like Youtube convert the video to MPEG-DASH. It is important to notice that, due to how much bandwidth it consumes to send the video to multiple people, you usually upload the chunks to platforms such as Akamai (the largest), Cloudflare or Amazon Cloudfront; basically CDNs.
By the way, there is a project that it is a wrapper around FFMpeg https://pypi.org/project/pyffmpeg/. Perhaps it is not the best solution, but i don't thing a native solution using python is better. The main problem is that video is one of the heaviest computations always, so the more low-level implemented it is, the better. Usually, FFMpeg tries to use some hardware accelerators if there are any, such as graphic cards https://developer.nvidia.com/ffmpeg.
This sounds like a fun sprint topic for Wagtail Space! https://www.wagtail.space/
It bugs me that the native HTML implementation of a video player does not support adaptive streaming. I end up using Vimeo all the time. But the wagtailmedia package might be the place to prepare a video for adaptive streaming in combination with HLS.js on the frontend side. Here are the required steps:
Backend
Frontend
Encoder
An encoder might be the bottleneck here as FFmpeg is not available via some hosters (or at least my preferred hoster to be honest). Are there any Python packages that could natively replace services that support HLS? ... like Zencoder, Coconut, Mux and AWS Transcoder.
Laziness
The conversion and splitting of the video file and the generation of the playlists could be done on demand like the Wagtail image renditions following Django’s laziness philosophy. For longer video files on weaker machines that might take a long time.
A client side JavaScript encoder as part of the React upload form might be the solution to both problems here, encoder and time.
Overall this could be a killer feature of the Wagtail CMS. I offer my help here with anything apart from React if there is an reliable encoder that could be integrated.