<aside> ℹ️ This is a good tutorial for someone who is minting NFTs for the first time. If you know how to use tokenURI to mint an NFT you can follow only Step 1 and use the nftMetadataUrl field as the tokenURI for your NFT. The URL is compatible with both ERC-721 and ERC-1155.

</aside>

In this tutorial, we’ll be using Alchemy as the Eth service provider.

Step 1: Upload the Video and configure the metadata for your NFT

You can use the @livepeer/video-nft npm script to have a local file uploaded to Livepeer, exported to IPFS and then mint the NFT out of it. Alternatively, if you don’t have node installed you can use this script (bash) which works in a similar way.

Start by getting a Livepeer API key to use from the tool: Get an API key

Then simply run npx @livepeer/video-nft . The CLI will ask you for any information it needs and in the end will give you a URL for a simple page for minting the NFT.

Some tips in case you use it often:

Example:

$ npx @livepeer/video-nft
Need to install the following packages:
  @livepeer/[email protected]
Ok to proceed? (y) y
? Enter your Livepeer API key (learn more at [<http://bit.ly/lp-api-key>](<http://bit.ly/lp-api-key>)): ********
****************************
Tip: You can set the LP_API_KEY environment variable to avoid this prompt.
? What file do you want to use? nasa25.mp4
You can also send the filename as an argument to this command.
? What name do you want to give to your NFT? NASA 25th bday
? Would you like to customize the NFT metadata? No
1. Requesting upload URL...
Pending asset with id=08266a15-ff67-4ce6-9b8c-dff485ff3825
2. Uploading file...
Waiting for import task completion... id=5412f48e-af58-4d1b-80a8-2ec818519ffe
 - progress: 35.3%
 - progress: 60.8%
 - progress: 92.30000000000001%
3. Starting export...
Created export task with id=b008532d-839b-4925-9833-094d2d6a1cc3
Waiting for export task completion... id=b008532d-839b-4925-9833-094d2d6a1cc3
 - progress: 99%
4. Export successful! Result:
{
  "videoFileCid": "QmcEZYeH2QxySWqHFcQbSovb43NGST4JaDBpeG1Tk4aXmA",
  "nftMetadataCid": "QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h",
  "videoFileUrl": "ipfs://QmcEZYeH2QxySWqHFcQbSovb43NGST4JaDBpeG1Tk4aXmA",
  "videoFileGatewayUrl": "[<https://ipfs.livepeer.com/ipfs/QmcEZYeH2QxySWqHFcQbSovb43NGST4JaDBpeG1Tk4aXmA>](<https://ipfs.livepeer.com/ipfs/QmcEZYeH2QxySWqHFcQbSovb43NGST4JaDBpeG1Tk4aXmA>)",
  "nftMetadataUrl": "ipfs://QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h",
  "nftMetadataGatewayUrl": "[<https://ipfs.livepeer.com/ipfs/QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h>](<https://ipfs.livepeer.com/ipfs/QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h>)"
}
5. Mint your NFT at:
[<https://livepeer.com/mint-nft?tokenUri=ipfs://QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h>](<https://livepeer.com/mint-nft?tokenUri=ipfs://QmR2SaapDATg7q9vVG2NSaGbSE3KUBLfUN49Lb737HY88h>)

<aside> 💡 The nftMetadataUrl is what you need to remember for custom minting of the NFT.

</aside>

The equivalent command avoiding all the prompts would be:

$ export LP_API_KEY=<your API key obtained from the Livepeer dashboard>
$ npx @livepeer/video-nft nasa25.mp4 --asset-name "NASA 25th bday" --nft-metadata '{"description":"NASA's commemorative video for their 25th birthday"'

Step 2: Install web3

<aside> ❗ If you are happy with the NFT minted by the video-nft script above you can stop here! Keep going if you are curious how to create custom ERC-721 contracts and/or having your own NFT minting logic. You can reference the same exported files on IPFS for your custom NFTs, grabbed from the script output.

</aside>

This tutorial assumes you have already deployed an ERC721 contract.

In your project home directory, run: