LivePeer: Mint a Video NFT with LivePeer

Learn how to mint a video NFT with LivePeer.

What is LivePeer?

LivePeer is a Web3 video streaming infrastructure designed to build video streaming and hosting applications. LivePeer offers a native API and an npm package for minting video NFTs through the LivePeer infrastructure.

In this guide, we’ll use the LivePeer npm package to mint a video NFT using a video stored on IPFS through Filebase.

Read below to learn how to mint a video NFT with LivePeer.

Prerequisites:

1. First, we need a Filebase IPFS bucket.

To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.

2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

Select ‘Create Bucket’ in the top right corner to create a new bucket.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

In this guide, we’re calling the bucket filebase-IPFS.

Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.

4. Select a video to upload to your Filebase bucket by selecting the Upload button in the top right corner.

The progress bar displays the upload’s status:

5. Once uploaded, copy the IPFS CID by clicking on the CID in the CID field.

6. Next, head over to the LivePeer web dashboard.

Select ‘Developers’ from the left side bar menu.

7. Select ‘Create API Key’:

8. Give your API key a name:

9. Copy the API token.

10. Open a command prompt.

Install the LivePeer Video NFT package:

npx @livepeer/video-nft

11. Once installed, you will be presented with a series of prompts:

  • Enter your LivePeer API Key: Enter the LivePeer API key created in step 9.

  • What file do you want to use?: Enter the file name of your video file. If this file isn’t located in the current directory, specify this file with the full file path.

  • What name do you want to give to your NFT?: Enter a name for your NFT

  • Would you like to customize the NFT Metadata?: Yes

  • Open text editor: Press enter to open your system’s default text editor. This will open a temporary text file containing your NFT’s metadata.

12. Edit the file to reflect the following:

{
  "name": "Sample Video",
  "description": "Livepeer video from asset \\"Sample Video\\"",
  "image": "ipfs://FILEBASE-IPFS-CID",
  "videoFileUrl": "ipfs://FILEBASE-IPFS-CID",
  "videoFileGatewayUrl": "https://ipfs.filebase.io/ipfs/FILEBASE-IPFS-CID",
  "properties": {}
}

Replace FILEBASE-IPFS-CID with the CID you copied in step 5. We’re editing this file to use our Filebase IPFS CID, since all Filebase IPFS files are pinned on the Sia network, making them resilient to rug pulls or the IPFS garbage collection process.

13. Save and close the text file.

The command prompt will upload the file, then export information about your NFT.

The values displayed in the command prompt that were manually set in the Metadata file (videoFileURL, image, videoFileGatewayUrl) are incorrect in this output since the Metadata file overwrites these values.

To confirm this, open the ‘nftMetadataUrl’ using either the IPFS link or a gateway link. The JSON metadata file reflects the correct values:

15. Select ‘Connect to MetaMask’ to connect to your Metamask wallet:

16. Once connected, the button will change to ‘Mint NFT’:

Select ‘Mint NFT’ to authorize and confirm the minting transaction:

17. Confirm the transaction was successful in the LivePeer output:

18. You can then view your NFT on OpenSea by clicking the ‘Check it out on OpenSea’:

Last updated