Skip to content

Instantly share code, notes, and snippets.

@michel47
Last active August 6, 2021 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michel47/8000fa6b5b4a337666727657a22045fc to your computer and use it in GitHub Desktop.
Save michel47/8000fa6b5b4a337666727657a22045fc to your computer and use it in GitHub Desktop.
A universal format to store video or image (or any other multimedia)

Universal storage for media file

To all who store a large amount of media files (videos or image) ...

multi media are often static files and therefore they are by nature "sharable" and can be deduplicated however for this to be possible we all have to come up with the same method to store them.

The IPFS network is ideal for this : an index for 4726 images has only have a size of 414K

videos and movie clips

I decided to store all my movies under IPFS with the following command :

ls -1S *.mp4 | while read videofile; do
echo "$videofile
ipfs add --nocopy --raw-leaves --trickle --chunker rabin-65536-524288-1048576 -w "$videofile" | tee -a added.log
done

pictures and images

I decided to store all my images under IPFS with the following command :

export IPFS_PATH=/media/IPFS/IMAGES
# ipfs add --raw-leaves --trickle --chunker size-1048576 -w --hash sha1 $imagefile

WWW=/usr/local/share/doc/civetweb/public_html/
find $WWW -name *.png -exec ipfs add --raw-leaves  --trickle --chunker size-1048576 --hash sha1 {} \; | tee -a added.log
find $WWW -name *.jpg -exec ipfs add --raw-leaves  --trickle --chunker size-1048576 --hash sha1 {} \; | tee -a added.log
find . -name "*.jpg" -exec ipfs add --progress=false --raw-leaves  --trickle --chunker size-1048576 --hash sha1 {} \;| tee -a added.log

Universal name

I would be nice too to give a media file a universal name; why not choosing its "SHA1" as a basename (encoded in base36)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment