feat(user/ffmpeg_parallel_encode.sh):Add parallel | ffmpeg script
[BK-2020-03.git] / unitproc / bk_export_audio.sh
index bbf3f3d86292df82974e43207ed0331553b3ac45..927556e4afc6e5e706e88a64851da60077030693 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # Desc: Extracts audio from video files
 # Usage: bk_export_audio.sh [input_dir] ([output_dir])
 #!/bin/bash
 # Desc: Extracts audio from video files
 # Usage: bk_export_audio.sh [input_dir] ([output_dir])
-# Version: 0.1.1
+# Version: 0.1.2
 # Depends: bash 5.1.16, GNU Coreutils (8.32)
 
 # Plumbing
 # Depends: bash 5.1.16, GNU Coreutils (8.32)
 
 # Plumbing
@@ -309,11 +309,11 @@ main() {
     # Do work
     yell "DEBUG:dir_in:$dir_in":
     yell "DEBUG:dir_out:$dir_out";
     # Do work
     yell "DEBUG:dir_in:$dir_in":
     yell "DEBUG:dir_out:$dir_out";
-    for file in "$dir_in"/*; do
+    while read -r file; do
         yell "DEBUG:count_jobs:$(count_jobs)";
         while [[ "$(count_jobs)" -ge $max_jobs ]]; do sleep 0.1; done; # limit jobs        
         job "$file" "$dir_out" &
         yell "DEBUG:count_jobs:$(count_jobs)";
         while [[ "$(count_jobs)" -ge $max_jobs ]]; do sleep 0.1; done; # limit jobs        
         job "$file" "$dir_out" &
-    done;
+    done < <(find "$dir_in" -type f);
 
     # Announce completion
     while [[ "$(count_jobs)" -gt 0 ]]; do sleep 1; done;
 
     # Announce completion
     while [[ "$(count_jobs)" -gt 0 ]]; do sleep 1; done;