From 8afa8929717efc7b6a41e6cdb3aae13dcee650c1 Mon Sep 17 00:00:00 2001 From: Teles1 <66783472+Teles1@users.noreply.github.com> Date: Sat, 13 Feb 2021 18:23:44 -0500 Subject: [PATCH] Handling white spaces on the file/dir path I had problems using the script provided because my pathing and files could have white spacing " ". So, the way I provided it makes sure to scape both filename and path. --- content/about/video-codecs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/about/video-codecs.md b/content/about/video-codecs.md index aeebc30..4f310f0 100644 --- a/content/about/video-codecs.md +++ b/content/about/video-codecs.md @@ -40,11 +40,11 @@ Convert recursively mkv and avi and remove original file. ``` #! /bin/bash -while IFS= read -r -d '' file +for file in $( find ./ -iname "*.mkv" -o -iname "*.avi") do - ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4" - rm -f "$file" -done < <(find mydir -name '*.mkv' -print0 -o -name '*.avi' -print0) + ffmpeg -i "$file" -vcodec copy -acodec aac -strict 2 "${file%.*}.mp4" + rm "$file" #! This will delete the original .mkv/.avi file +done ```