Pushing everything
This commit is contained in:
@@ -1,19 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
show_help() {
|
||||
echo "Usage: $(basename $0) [--input|-i input_file] [--crop|-c width:height] [--trim-start start] [--trim-end end] [--crf crf_value] [--fps new_fps] [--scale new_video_resolution] [--merge-audio] [--remove-audio] --output|-o output_file"
|
||||
echo """Usage: $(basename $0) \
|
||||
[--input|-i input_file] \
|
||||
[--crop|-c width:height] \
|
||||
[--trim-start start] \
|
||||
[--trim-end end] \
|
||||
[--crf crf_value] \
|
||||
[--fps new_fps] \
|
||||
[--scale new_video_resolution] \
|
||||
[--merge-audio] \
|
||||
[--remove-audio] \
|
||||
[--volume-multiplier] \
|
||||
--output|-o output_file"""
|
||||
echo "Options:"
|
||||
echo " --input|-i Specify the input video file (required)."
|
||||
echo " --crop|-c Specify the width:height for video cropping."
|
||||
echo " --trim-start Specify the start timestamp for video trimming."
|
||||
echo " --trim-end Specify the end timestamp for video trimming."
|
||||
echo " --crf Specify the CRF value for video compressing."
|
||||
echo " --fps Specify the new frames per second for the video."
|
||||
echo " --scale Scale the video to a new resolution."
|
||||
echo " --merge-audio Merge all audio tracks into the main track."
|
||||
echo " --remove-audio Suppress all audio and remove audio tracks."
|
||||
echo " --audio-track-no Selects a specific audio track for the output"
|
||||
echo " --output|-o Specify the output filename (required)."
|
||||
echo " --input|-i Specify the input video file (required)."
|
||||
echo " --crop|-c Specify the width:height for video cropping."
|
||||
echo " --trim-start Specify the start timestamp for video trimming."
|
||||
echo " --trim-end Specify the end timestamp for video trimming."
|
||||
echo " --crf Specify the CRF value for video compressing."
|
||||
echo " --fps Specify the new frames per second for the video."
|
||||
echo " --scale Scale the video to a new resolution."
|
||||
echo " --merge-audio Merge all audio tracks into the main track."
|
||||
echo " --remove-audio Suppress all audio and remove audio tracks."
|
||||
echo " --volume-multiplier Changes the video's volume with a multiplier."
|
||||
echo " --audio-track-no Selects a specific audio track for the output"
|
||||
echo " --output|-o Specify the output filename (required)."
|
||||
}
|
||||
|
||||
remove_audio() {
|
||||
@@ -37,6 +49,7 @@ new_fps=""
|
||||
scale=""
|
||||
merge_audio=false
|
||||
remove_audio=false
|
||||
volume_multiplier=""
|
||||
audio_track_no=1
|
||||
output_file=""
|
||||
|
||||
@@ -82,6 +95,10 @@ while [ "$#" -gt 0 ]; do
|
||||
remove_audio=true
|
||||
shift
|
||||
;;
|
||||
--volume-multiplier)
|
||||
volume_multiplier="$2"
|
||||
shift 2
|
||||
;;
|
||||
--audio-track-no)
|
||||
audio_track_no="$2"
|
||||
shift
|
||||
@@ -104,7 +121,7 @@ if [ -z "$output_file" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$crop" ] && [ -z "$trim_start" ] && [ -z "$trim_end" ] && [ -z "$crf" ] && [ -z "$new_fps" ] && [ "$merge_audio" = false ] && [ -z "$scale" ] && [ "$remove_audio" = false ]; then
|
||||
if [ -z "$crop" ] && [ -z "$trim_start" ] && [ -z "$trim_end" ] && [ -z "$crf" ] && [ -z "$new_fps" ] && [ "$merge_audio" = false ] && [ -z "$scale" ] && [ "$remove_audio" = false ] && [ -z "$volume_multiplier" ]; then
|
||||
echo "Error: At least one optional parameter is required."
|
||||
exit 1
|
||||
fi
|
||||
@@ -171,6 +188,10 @@ if [ -n "$scale" ]; then
|
||||
ffmpeg_command+=" -s $scale"
|
||||
fi
|
||||
|
||||
if [ -n "$volume_multiplier" ]; then
|
||||
ffmpeg_command+=" -filter:a \"volume=$volume_multiplier\""
|
||||
fi
|
||||
|
||||
if [ "$merge_audio" = true ]; then
|
||||
num_audio_streams=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 "$input_file" | wc -l)
|
||||
ffmpeg_command+=" -filter_complex amerge=inputs=$num_audio_streams"
|
||||
|
||||
Reference in New Issue
Block a user