-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathffmpeg_cut
executable file
·49 lines (28 loc) · 1.05 KB
/
ffmpeg_cut
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
# Provide time in seconds
# if [[ $# -lt 4 ]];then
# echo You are suppose to provide two parameters to this script
# echo Times should be given in hh:mm:ss format
# echo $(basename $0) -ss start_sec -i source_file end_sec modifed_file
# exit 1
# fi
printf "Give the start time in HH:MM:SS format: %s"
read -r start_time
start_sec=$(echo "$start_time" | gawk -F: '{ print ($1 * 60) + ($2 * 60) + $3 }')
echo $start_sec
printf "Give the Souce file: %s"
read -r source_file
printf "Give the end time in HH:SS:MM format: %s"
read -r end_time
end_sec=$(echo "$end_time" | gawk -F: '{ print ($1 * 60) + ($2 * 60) + $3 }')
echo $end_sec
printf "Give the modified file name: %s"
read -r modi_file
echo "ffmpeg -ss ${start_sec} -i ${source_file} -to ${end_sec} -c:a copy -c:v copy ${modi_file}.mp3"
printf "Is it look alright?[Y/N]: %s"
read -r res
if test "$res" == "Y";then
sh -c "ffmpeg -ss ${start_sec} -i ${source_file} -to ${end_sec} -c:a copy -c:v copy ${modi_file}.mp3"
else
printf "Something doesn't look right, fix it"
fi