mirror of
https://github.com/CoolnsX/repos_scripts.git
synced 2025-12-20 07:15:20 +05:30
add split feature for SNS
This commit is contained in:
20
youtube
20
youtube
@@ -1,5 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# script for downloading youtube videos and split it into pieces..
|
||||
|
||||
# defining shell colors for distinction
|
||||
c_red="\033[1;31m"
|
||||
c_green="\033[1;32m"
|
||||
c_yellow="\033[1;33m"
|
||||
@@ -8,7 +11,7 @@ c_magenta="\033[1;35m"
|
||||
c_cyan="\033[1;36m"
|
||||
c_reset="\033[0m"
|
||||
|
||||
|
||||
#function to download full video
|
||||
full_video()
|
||||
{
|
||||
video=$1
|
||||
@@ -16,6 +19,7 @@ full_video()
|
||||
|
||||
}
|
||||
|
||||
# function to download part of a video and also split it for SNS...
|
||||
part_video()
|
||||
{
|
||||
video=$1
|
||||
@@ -23,8 +27,18 @@ part_video()
|
||||
read start
|
||||
printf "${c_yellow}Enter Upto Seconds:${c_cyan}"
|
||||
read dur
|
||||
ffmpeg -i $(youtube-dl -f best --get-url "$video") -ss $start -t $dur $HOME/Videos/$(date +%s).mp4
|
||||
}
|
||||
printf "Do you want to split video for SNS?? (y or n) :"
|
||||
read x
|
||||
if [ $x == 'n' ]; then
|
||||
ffmpeg -i $(youtube-dl -f best --get-url "$video") -ss $start -t $dur $HOME/Videos/$(date +%T_%F).mp4
|
||||
else
|
||||
out=$(date +%T_%F)
|
||||
ffmpeg -i $(youtube-dl -f best --get-url "$video") -map 0 -codec copy -f segment -segment_time 30 -ss $start -t $dur $HOME/Videos/${out}_%03d.mp4
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#program starts from here..
|
||||
|
||||
printf "${c_blue}Input Youtube link :${c_magenta}"
|
||||
read x
|
||||
|
||||
Reference in New Issue
Block a user