Spaces:
Running
Running
| # Download the video file using curl with specific TLS version | |
| curl --tlsv1.2 -o input.mp4 https://ia600102.us.archive.org/23/items/SampleVideo1280x72020mb/SampleVideo_1280x720_20mb.mp4 | |
| # Check if the download was successful | |
| if [ $? -eq 0 ]; then | |
| echo "Download successful." | |
| else | |
| echo "Download failed." | |
| exit 1 | |
| fi | |
| if [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then | |
| ffmpeg_executable="ffmpeg.exe" | |
| else | |
| ffmpeg_executable="ffmpeg" | |
| fi | |
| start_time="$(date +%s)" | |
| $ffmpeg_executable -i input.mp4 -c:v libx264 -preset medium -crf 23 -c:a aac -strict experimental -y output.mp4 | |
| end_time="$(date +%s)" | |
| # Check if the reencoding was successful | |
| if [ $? -eq 0 ]; then | |
| echo "Reencoding successful." | |
| else | |
| echo "Reencoding failed." | |
| exit 1 | |
| fi | |
| rm input.mp4 | |
| rm output.mp4 | |
| elapsed_time=$((end_time - start_time)) | |
| echo "Reencoding took approximately $elapsed_time seconds." |