dotfiles/mergeFFMPEG.sh

26 lines
710 B
Bash
Executable File

#!/bin/bash
# Assign the first command line argument to the variable video_source
video_source="$1"
# Assign the second command line argument to the variable audio_source
audio_source="$2"
# Assign the third command line argument to the variable output_file
output_file="$3"
# Check if all arguments are provided
if [ "$#" -ne 3 ]; then
echo "Usage: $0 video_source audio_source output_file"
exit 1
fi
# Use ffmpeg to merge the video and audio files
ffmpeg -i "$video_source" -i "$audio_source" -c:v copy -c:a copy -strict experimental "$output_file"
# Check if ffmpeg succeeded
if [ $? -eq 0 ]; then
echo "Merging completed successfully."
else
echo "An error occurred during merging."
fi