Runtime update to support multiple versions per video assets to increase compatibility (encoding, bitrate, audio/video only) and possible applications like podcasts, kiosk mode, skimming, etc.
Rationale
The Joystream CDN currently is bitrate agnostic and does not reprocess for example very high definition videos for consumption via mobile devices or users with slow connection:
Status Quo
Query to fetch duration, size and codec for videos:
query { videos { id duration
mediaMetadata { pixelWidth pixelHeight size encoding {codecName}}
} }
This shows video bitrate for actual video files:
for file in /home/joystream-storage/uploads/*
do
echo -n "$file: " ; ffprobe -i $file -v quiet -select_streams v:0 -show_entries stream=bit_rate -of default=noprint_wrappers=1:nokey=1
done
Scope
Store uploaded videos in known YT qualities, starting with possibly most common 144p and 720p.

Sounds really cool but do we really want to do all things like this client-side in the long term? I mean extraction of images, possibly transcoding and other stuff. I think this can get complicated quite quickly. Do we have any long-term plans to support different resolutions per video so the experience can be optimized? I would expect us to start introducing some features like that on the storage provider side, some kind of processing of assets, otherwise we can end up with a lot of unnecessary uploads from the client
I think the near term way to handle multiple resolutions would just be to support uploading multiple assets, and then requiring the user to have done that in advance. With that, we could at least take advantage of this feature on the consumer side, and we could automatically deal with it in the YT-synch feature we are planning.
Allow a publisher to provide more than one media file, both during original publishing, or at a later time
Basically allow the viewer to both see the resolution of the media currently being viewed, but also discover whether others exist, and the opportunity to change during play.
I don't believe this feature is a precondition for launching youtube-synch, or even mainnet, but it seems like a sensible feature enhancement, and some of the exploratory engineering RnD can be done as a filler task at any time.
Maybe instead of doing this client-side we could figure out how to enable server-side support with minimal work? I think we could even do this separately from Orion, as a completely separate service that would later be integrated into Orion.
Processing
This is the easy tho time consuming part.
Which actors can be trusted to reprocess all videos?
- Gateways: do not exist yet and their concept needs to be fully fleshed out first.
- Outsourcing this task was discussed and discarded as too complex (see below)
Workflow
draft to figure out which role gateways would play in this
- creator A registers with some special Joystream Processing Service (JPS) via their membership account
- creator uploads one or more video file(s) to the JPS via their UI and selects target formats
- creator issues on-chain transaction to pay JPS for transcoding
- JPS generates all desired formats and informs A for example via email when it's done
- in the meantime A prepared all metadata and now creates the video on-chain
- by signing the transaction in the JPS UI (website/cli/app) which uploads all versions to a SP
There can be multiple JPS and they could be regional Gateway Providers that also take care of other obligations on the way based on local laws (KYC, content screening, IP/ copyright checks).
In any way the chain needs to be able to link multiple media assets to one video. Ideally rather short-term (or at least before mainnet) to give possible investors time to develop their infrastructure around that. Also for auditing which is on the way for other features already and takes time.
RICE estimates
Would require
updating runtime to allow Orion to do upload after transcoding is done.
updating query node to reflect this change.
some way to do authentication between user and Orion, which is unclear, as seen in discussion above.
adding capability of Orion to accept, store, dispatch work to some cloud transcoding service, like AWS Transcoding, monitor progress, expose this progress in an API for end-user, and complete final upload to storage system when done.
updating Atlas design to represent state of interaction with Orion on these uploads.
updating Atlas to know when to use this service and when to not, hopefully without involving the user.
updating Atlas to use its already designed player which allows resolution controls.
updating Atlas to have some reasonable policy of selecting what encoding to use for playback by default, given the device and connection.
Gateway ideas
There is an increasing list of enhancements to atlas that may warrant the introduction of a proto-Gateway node, well in advance of the core access financing function that Gateways are supposed to serve.
Gateways are a future infrastructure service, operated by what will be called gateway operators. They are responsible for the last mile between the blockchain economics and infrastructure and a mainstream consumer audience. This is not a part of the system which is currently fully designed or built. Briefly put, the role of a gateway is to achieve the following goals
Glue: Deliver the product features which are either too hard to prioritise facilitating through decentralised infrastructure accountable to the DAO directly. So this is stuff like post-processing of videos, like transcoding or preview image extraction, translation, etc.
Currently, the Orion node, which holds viewership statistics and content featuring policy information, is expected to become the precursor for the gateway node. A good introduction to some of these topics can be found in this video https://play.joystream.org/video/1266
Transcoding: There is no ability for uploaded videos to get converted into a range of different resolutions and encoding formats, making it easier for users to consume the content in a way which is suitable for their device and product.
Downside of leaving this to off-chain internal Gateway processes may defeat CDN advantages to store and distribute different versions per bag and asset.
Storage
Open questions:
- How to store multiple versions per video on chain?
- Who uploads versions to SP, ie who signs transaction and owns the video file?
- Either the creator has to accept and sign-off after processing or this process is opaque to users and has to happen automatically by trusted entities (gateways).
- if there will be more than one GP, will each bag be assigned to exactly one GP? if not who is authority or how do they negotiate about the correct version?
=> update storage system to be able to save multiple versions per "video"
=> update QN support needed queries for consumer apps (available versions with bitrate by asset id)
Discussion
July 2021
First discussed In July 21 Operations was asked to look into client side transcoding.
@l1dev hey, are you going to be able to tackle those two problems I asked about? benchmarking client side transcoding and preview extraction?
for the transcoding, we should be picking some output format similar to what YT has, as it is likely already the optimal tradeoff between computational load and browser support
I think it is a terrible idea. Can setup a server for transcoding instead if you are interested.
a) Can you please unpack what specifically is terrible about one or both of the ideas?
b) The reason these ideas are interesting from my point of view is that, at least in principle, they could possibly work in the main production system (depending on what we find about speed and cost). You running a server is not really an alternative for mainnet, it would just be a bandaid. If someone, or multiple people, are going to be runnin transcoding servers on mainnet, then that is a much bigger and more complex idea that I would like to avoid, we already have enough infrastructure operated by the DAO, it is getting very complex. The only alternatie I see here is if Gateways have to run their own transcoding server on behaf of their users, but not sure about what impact that has for the fixed costs of strting a Gateway, which we want to be low.
- heavy processing in a browser is a no-go from my perspective. not only is it bad for mobile devices but it also easily blocks the browser on desktops and users might think it is some kind of hidden miner. I might be wrong.
- doing it server side could get too complex - this point does not make sense to me. complex tasks are ususally run server-side because we can control the environment and in contrast to frontends install any software we need
- for the near term - let us set up a system that is a good solution in the long term (mainnet)
I see two options worth exploring:
- going to be runnin transcoding servers on mainnet - yes, like storage providers we might need processing providers
- outsourcing the task to services like file.video (livepeer) or flixier.com even if they cost some
- I agree we need to be concerned about doing heavy processin in the browser, so we need to try to nail down just how heavy it actually would be.
- The complexity comes not from technically running a server, but the incentive and protocol side of having it all work well together. We are now building storage v2 based on a lot of experience, and it won't be flawless, transcoding is a totally differnt problem, and Livepeer is entirely focused on just that, thats what I mean by complexity.
- outsourcing to livepeer is very complex, because remember, the user is not supposed to deal with this, so the DAO would ahve to pay livepeer at the protocol level, which means you would have to ahve a cross chain bridge from Joystream to Ethereum, and then connect the Ethereum side to Livepeer. Additionally, the DAO would have to hold LPT on Ethereum over this bridge... this is super complex, and its not even clear if Livepeer will actually allow us to do everything we need, or in the way we need, its still very much in developmnt.
Nov 2021
without third party post-processing, will a user be able to upload multiple versions of the same video, with the same metadata, at the same time?
this is just about making a product which allows this. So Atlas would have to be adapted to support this sort of multi asset kind of uploading, and the playback side would have to understand this, and perhaps offer user control over which version to play back and so on.
Dec 2021
The platform should have the capability to expose the format and other characteristics of the media via some metadata
The platform in future maybe used to build applications on top of it, for which it is important to consider:
a. To design some kind of mechanism where in the platform has the capability to allow and comprehend some kind of configurable features like:
i. Adaptive bitrates while uploading, and as well as streaming via Argus
ii. Allow application to dictate the streaming formats like HLS, HDS, MPEG etc.,
It is important to define where or who is expected to implement the media format conversions.
a. The applications that may be built on top of joystream platform may expect some kind of metadata information either from Colossus or Argus to enable it to convert the ingest stream of data to desired formatted output.
May 2022
Lately discussed here suggesting the DASH concept to switch bitrate.
Runtime update to support multiple versions per video assets to increase compatibility (encoding, bitrate, audio/video only) and possible applications like podcasts, kiosk mode, skimming, etc.
Rationale
The Joystream CDN currently is bitrate agnostic and does not reprocess for example very high definition videos for consumption via mobile devices or users with slow connection:
Status Quo
Query to fetch duration, size and codec for videos:
This shows video bitrate for actual video files:
Scope
Store uploaded videos in known YT qualities, starting with possibly most common 144p and 720p.
Processing
This is the easy tho time consuming part.
Which actors can be trusted to reprocess all videos?
Workflow
draft to figure out which role gateways would play in this
There can be multiple JPS and they could be regional Gateway Providers that also take care of other obligations on the way based on local laws (KYC, content screening, IP/ copyright checks).
In any way the chain needs to be able to link multiple media assets to one video. Ideally rather short-term (or at least before mainnet) to give possible investors time to develop their infrastructure around that. Also for auditing which is on the way for other features already and takes time.
RICE estimates
Gateway ideas
Downside of leaving this to off-chain internal Gateway processes may defeat CDN advantages to store and distribute different versions per bag and asset.
Storage
Open questions:
=> update storage system to be able to save multiple versions per "video"
=> update QN support needed queries for consumer apps (available versions with bitrate by asset id)
Discussion
July 2021
First discussed In July 21 Operations was asked to look into client side transcoding.
Nov 2021
Dec 2021
May 2022
Lately discussed here suggesting the DASH concept to switch bitrate.