https://github.com/ThomasNegeli/M2CliTools
Backup (or delete) unused product media from filesystem:
php bin/magento tnegeli:cleanup-unused-product-media
Backup (or delete) unused category media from filesystem:
php bin/magento tnegeli:cleanup-unused-category-media
Backup (or delete) unused swatches media from filesystem:
php bin/magento tnegeli:cleanup-unused-swatches-media
You can use the --dry-run option to just test the result.
You can use the --delete option to remove files, instead of doing a backup.