r/bash 12d ago

resolve-prep: a small bash tool that only converts what actually needs converting

Wrote this to solve a personal annoyance (DaVinci Resolve Linux can't decode H.264/HEVC/AAC) but ended up spending more time on the "don't touch what doesn't need touching" logic than the conversion itself — probes every file, skips anything already compatible, verifies codec/duration/size after conversion, never overwrites originals. Bash 4.4+, no deps beyond ffmpeg/coreutils.

[ https://github.com/bhattmanthan/resolve-prep ] — feedback on the shell script itself welcome too, always looking to write cleaner bash.

2 Upvotes

3 comments sorted by

1

u/bac0on 12d ago edited 11d ago

in the _collect_files() function you collect targets in a array, but seems you don't really use it, you could just loop the target directly. Convert those short form statement to conform to your style in general, also move nullglob to top on the file, its for most cases a good default anyway. ${DEBUG:-0} == 1 is abit odd, you substitute if no value then check for 1, if DEBUG isn't 1, does it really matter what it is, just DEBUG == 1 are probably enough, maybe have DEBUG globally defined.

1

u/Antisocial-Stare 12d ago

Thank you 😊 for the feedback, will look into it

1

u/angrykeyboarder 12d ago

Very nice! Thanks for sharing.