[FFmpeg-devel] [PATCH 0/5] Add IPFS and IPNS protocol support

Mark Gaiser markg85 at gmail.com
Mon Jan 31 15:51:11 EET 2022


Hi,

This patch series adds support for IPFS.

I've been adviced to keep the patches as they are (split). If needed, I can 
squash them to a single patch.

The following is a short summary. In the IPFS ecosystem you access it's content
by a "Content IDentifier" (CID). This CID is, in simplified terms, a hash of 
the content. IPFS itself is a distributed network where any user can run a node
to be part of the network and access files by their CID. If any reachable node 
within that network has the CID, you can get it.

IPFS (as a technology) has two protocols, ipfs and ipns.
The ipfs protocol is the immutable way to access content.
The ipns protocol is a mutable layer on top of it. It's essentially a new CID 
that points to a ipfs CID. This "pointer" if you will can be changed to point 
to something else.
Much more information on how this technology works can be found here [1].

This patch series allows to interact natively with IPFS. That means being able
to access files like:
- ffplay ipfs://<cid>
- ffplay ipns://<cid>

There are multiple ways to access files on the IPFS network. This patch series
uses the gateway driven way. An IPFS node - by default - exposes a local 
gateway (say http://localhost:8080) which is then used to get content from IPFS.

Much of the logic in this patch series is to find that gateway and essentially 
rewrite:

"ipfs://<cid>"

to:

"http://localhost:8080/ipfs/<cid>"

Once that's found it's forwared to the protocol handler where eventually the
http protocol is going to handle it. Note that it could also be https. There's 
enough flexibility in the implementation to allow the user to provide a 
gateway. There are also public https gateways which can be used just as well.

After this patch is accepted, I'll work on getting IPFS supported in:
- mpv (requires this ffmpeg patch)
- vlc (prefers this patch but can be made to work without this patch)
- kodi (requires this ffmpeg patch)

Best regards,
Mark Gaiser

[1] https://docs.ipfs.io/concepts/


Mark Gaiser (5):
  Early version of IPFS protocol support.
  Fix up IPNS support.
  Merge IPNS and IPFS handling.
  Implement logic to determine the IPFS gateway.
  Fix review feedback

 configure               |   2 +
 doc/protocols.texi      |  30 +++++
 libavformat/Makefile    |   2 +
 libavformat/ipfs.c      | 283 ++++++++++++++++++++++++++++++++++++++++
 libavformat/protocols.c |   2 +
 5 files changed, 319 insertions(+)
 create mode 100644 libavformat/ipfs.c

-- 
2.35.1



More information about the ffmpeg-devel mailing list