scripts: strip-metadata helper
This commit is contained in:
parent
39ebb798c8
commit
bd73f5d40d
1 changed files with 21 additions and 0 deletions
21
home/programs/scripts/strip-metadata
Executable file
21
home/programs/scripts/strip-metadata
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def main [path: string] {
|
||||
glob $path | each { |item|
|
||||
match ($item | path parse | get extension | str downcase) {
|
||||
"jpg" | "jpeg" | "png" => {
|
||||
exiftool -all= -overwrite_original_in_place $item
|
||||
},
|
||||
"mp4" => {
|
||||
let tmp_item = $"($item)_out.mp4"
|
||||
|
||||
ffmpeg -i $item -map_metadata -1 -c:v copy -c:a copy $tmp_item
|
||||
rm $item
|
||||
mv $tmp_item $item
|
||||
},
|
||||
_ => {
|
||||
error make { msg: 'Unsupported file extension' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue