Skip to content

Instantly share code, notes, and snippets.

@leejongyoung
Created June 3, 2023 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leejongyoung/19a3f9588b257efc03dc109418bbef83 to your computer and use it in GitHub Desktop.
Save leejongyoung/19a3f9588b257efc03dc109418bbef83 to your computer and use it in GitHub Desktop.
#!/bin/bash
function download_video {
video_url=$1
output_file=$2
if [ -f "$output_file" ]; then
echo "$output_file already exists. Skipping download."
return
fi
# 다운로드 속도와 예상 완료 시간 계산
# echo "Calculating download speed..."
# download_speed=$(wget --progress=dot "$video_url" 2>&1 | awk '/[0-9.]+\s+[KM]B\/s$/ {speed=$1; unit=$2} END {print speed, unit}')
# echo "Download speed: $download_speed"
# 파일 크기 가져오기
# file_size=$(wget --spider "$video_url" 2>&1 | awk '/Length/ {print $2}')
# 다운로드 예상 완료 시간 계산
# download_time=$(echo "scale=2; $file_size / $download_speed" | bc)
# echo "Estimated download time: $download_time seconds"
# ffmpeg 명령어를 사용하여 동영상 다운로드
ffmpeg -i "$video_url" -c copy "$output_file"
}
download_video ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment