If a CID links to say a 1 hour video file, and i want to show a five minute clip from that file, could I then generate a cid which refers to say minute 24 to minute 29 only. If I already have the larger file it is part of pinned, ipfs would be smart enough to realise that this âclipâ cid is part of a larger chunk that i already have, and load it instantly? And could this be done with other file types like images, sounds, text?
Theoretically yes.
It all depends on how the content is DAG-ified. Someone with enough interest could write the code to, rather than chunk a video file, do the chunks more intelligently, separating metadata and video data etc. in its own blocks, potentially allowing what you want. This would be a format-aware importer.
IPFS does not ship with any format-aware importers (there was a âtarâ one that was removed). It does ship with a âtrickleâ DAG layout (the default is âbalancedâ, see ipfs add --help
and Trickle DAG Visualizer / Irakli Gozalishvili | Observable). This type of DAG, would allow you to âcutâ into an intermediary CID which, depending on the video format, might work as a way to play from a certain point. It does not limit where the cut would end though.
That said, you could always generate a root-block by hand that links a specific set of blocks that corresponds to the minutes you want. Depending on the video format it might work too. But I reiterate that for such cases, the best is to dagify things intelligently and in a format-aware fashion.
One version of doing the dag-ifying relatively simply that Iâve seen a number of people do is leverage schemes like HLS that express breaking up a video file into many smaller files. This isnât the same as breaking up a single video file dag into its components which as @hector said can be doable too depending on the format.