* feat(user/convert_file_to_flac.sh):Preserve metadata
#!/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])
# Depends: bash 5.1.16, GNU Coreutils (8.32)
# Plumbing
# Depends: bash 5.1.16, GNU Coreutils (8.32)
# Plumbing
# 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
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 < <(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;
#!/usr/bin/env bash
# Desc: Converts file readable by ffmpeg to FLAC audio file
# Usage: convert_file_to_flac.sh [path]
#!/usr/bin/env bash
# Desc: Converts file readable by ffmpeg to FLAC audio file
# Usage: convert_file_to_flac.sh [path]
# Ref/Attrib: [1] Convert audio file to FLAC with ffmpeg? https://superuser.com/a/802126
# [2] How to specify flac compression level when converting with avconv? https://askubuntu.com/questions/544651/
# [3] How can I extract audio from video with ffmpeg? https://stackoverflow.com/a/27413824
# Ref/Attrib: [1] Convert audio file to FLAC with ffmpeg? https://superuser.com/a/802126
# [2] How to specify flac compression level when converting with avconv? https://askubuntu.com/questions/544651/
# [3] How can I extract audio from video with ffmpeg? https://stackoverflow.com/a/27413824
die "FATAL:Not an audio file:$1"; fi;
# Convert file to FLAC. See [1], [2]
die "FATAL:Not an audio file:$1"; fi;
# Convert file to FLAC. See [1], [2]
- try ffmpeg -i "$1" -vn -c:a flac -compression_level 12 "$1".flac
+ try ffmpeg -i "$1" -vn -c:a flac -map_metadata 0 -compression_level 12 "$1".flac
}; # main program
main "$@";
}; # main program
main "$@";