Hacker News new | ask | show | jobs
by giovannibonetti 1057 days ago
Related: I have a small library of personal videos, including from my wedding, and I'd like to compress it as much as I can to reduce its storage footprint. I don't care much about codec compatibility, as long as I can watch them on my (ARM) MacBook, it's good.

In the past (over 10 years ago), I used to work with H.264, but I remember fiddling with parameters was a pain. I wonder if nowadays there are some promising new codecs based on ML. Again, as long as it works in my machine it's good, so anything from GitHub, HuggingFace and so on is acceptable, as long as it doesn't need too much effort and specialized knowledge to run it.

4 comments

I'd recommend not re-encoding as you'll have irrevocably lost data. Whatever it's size, in the future it won't be large.
Yea can get wonky, -c:v copy is the correct flag to not re-encode
This depends on how much time you want to spend. If you want the transcode to take less time than the playtime of your videos, it'll probably be best to just use the best hardware encoder you have with high quality settings.

If you have more time, then AV1 is good. Read through the trac page [1] and do test encodes with 5-10 seconds of video to determine what settings give you your desired quality. Note that low `-cpu-used` or `-preset` values will give great quality but take incredibly long. Then, encode a few minutes of video with various settings to determine what settings give you your desired file size.

For human time usage, keep track of the commands and options you use and how those affect the output. If the job will take more than a few hours, write your script to be cancellable and resumable.

[1]: https://trac.ffmpeg.org/wiki/Encode/AV1

There are some promising codecs based on neural networks, however they are all very much research projects and have major limitations. Additionally, the compression ratios are only marginally higher than state-of-the-art engineered codecs. I think for your use case a more modern engineered codec such as VVC (H.266) or AV1 is perhaps more suitable.
Define 'small'? In GB/TB