Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Determine input and output directories based on the number of arguments
- if [ "$#" -eq 1 ]; then
- input_dir="$(pwd)"
- output_dir="$1"
- elif [ "$#" -eq 2 ]; then
- input_dir="$1"
- output_dir="$2"
- else
- echo "Usage: $0 [input_folder] /path/to/output_folder"
- echo "If input_folder is omitted, the current directory is used as the input."
- exit 1
- fi
- # Check if the input directory exists
- if [ ! -d "$input_dir" ]; then
- echo "Error: Input directory '$input_dir' does not exist."
- exit 1
- fi
- # Create the output directory if it doesn't exist
- mkdir -p "$output_dir"
- # Loop through all files in the input directory
- for input_file in "$input_dir"/*; do
- # Process only regular files
- if [ -f "$input_file" ]; then
- # Extract the filename without its extension
- filename=$(basename "$input_file")
- name="${filename%.*}"
- # Define the output file path
- output_file="$output_dir/$name.mov"
- echo "Converting $input_file to $output_file..."
- # Convert the video using FFmpeg
- ffmpeg -i "$input_file" -c:v copy -c:a pcm_s16le -ar 48000 -ac 2 "$output_file"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement