File size: 914 Bytes
fbabb05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

# 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."