DEV Community

hexfloor
hexfloor

Posted on • Edited on

More storage for media : organize files using ChatGPT

Contents

  1. More storage for media : organize files using ChatGPT : part 1, data preparation

  2. More storage for media : organize files using ChatGPT : part 2, converting JPEG to HEIC

  3. More storage for media : organize files using ChatGPT : part 3, converting MOV to HEVC MPEG-4

  4. More storage for media : organize files using ChatGPT : part4, processing on Gentoo

Summary

Open Source and Big Tech are equally important, and of course if you can afford to have the latest Mac - just do it, if you can afford to subscribe for 1TB plan from your cloud provider - just do it.
Prior to writing this blog I thought that by now there should exist simple GUI programs to convert all the media formats, and the reality is different - you still need linux OR you still need to pay.
And it's okay to have a choice, it's okay to pay as it saves your time, and it's okay to use linux as it saves your money.
Hence I can freely say here, that you start with the recommendations from ChatGPT, however remember at every point that it's better to fix the metadata and the filename before any compression, and to maintain both during the conversion, hence the commands below should be tailored to your needs:
Image description
Image description

As not everyone is thrilled with technology, not everyone will bother to install any linux distribution, not everyone will choose Gentoo - hence I can freely post my recommendations and just say that you can save 10 times more storage by just compressing the files from the high quality to the normal.
Not every video deserves to get the Oscar and it's okay.

Why Gentoo then? Building Gentoo is like to produce a single-use sterile dental scalpel, you should know what is the purpose and then this distribution will be your best friend. It's too sharp to be used at an average workplace, it's not for your general use system, it's for the specific purpose of getting the specific job done at maximum performance - this is what Gentoo is about.
Maybe the time has come for the wider adoption of Gentoo, as in the world where lots of people have a skill to build their system we are approaching to the wiser use of energy. Gentoo is eco-friendly.

I'm also grateful to the maintainers of ffmpeg and ImageMagick, thanks to these enthusiasts you may be at the edge of the progress with limited resources.

So yes, give it a try, you may impress others by compressing the size of the media library, and you will impress yourself after having built your first Gentoo server - it will take time, at least 1 hour, and at most - who knows, let it take the time it needs, or try again later. Do it yourself.
How faster is Gentoo than Ubuntu on WSL?
Exactly the same video processing task took 30.97s on Gentoo and 37.32s on Ubuntu, hence you have around of 20% gain. Is it worth it?
The answer is: it depends on your particular case.

Bonus

It may happen that image compression from heic to heic with ImageMagick doesn't work for iPhone 15 pro iOS 18, in this case you may install IrfanView or any other tool, convert heic to jpeg without loss of quality and then use ImageMagick to convert jpeg to heic with compression.
As well you should have some good understanding of what is fps and what is bitrate before compressing video.

This should be a good start for ffmpeg to be used for vertical videos:

for file in ./input/*.mov; do ffmpeg -i "$file" -vf "scale=-2:1280" -r 30 -c:v libx265 -crf 28 -preset medium -c:a copy "./output/$(basename "$file" .mov).mp4"; done
Enter fullscreen mode Exit fullscreen mode

Credits

Happy Diwali, may Lakshmi bring you peace and prosperity, or if she is gone elsewhere - do it yourself.

Happy Halloween!🎃

Top comments (0)