shiveshnavin commited on
Commit
fbabb05
·
1 Parent(s): 736fda1
Files changed (3) hide show
  1. app.js +5 -1
  2. benchmark.sh +36 -0
  3. uploads/.nomedia +0 -0
app.js CHANGED
@@ -324,7 +324,11 @@ const uploadDir = join(__dirname, 'uploads');
324
  const oracleAPI = OracleStorage.semibit_media.url
325
 
326
  if (!existsSync(uploadDir)) {
327
- mkdirSync(uploadDir);
 
 
 
 
328
  }
329
 
330
  app.post('/upload', async (req, res) => {
 
324
  const oracleAPI = OracleStorage.semibit_media.url
325
 
326
  if (!existsSync(uploadDir)) {
327
+ try {
328
+ mkdirSync(uploadDir);
329
+ } catch (e) {
330
+ console.log('Error in making uploads dir', e.message)
331
+ }
332
  }
333
 
334
  app.post('/upload', async (req, res) => {
benchmark.sh ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Download the video file using curl with specific TLS version
4
+ curl --tlsv1.2 -o input.mp4 https://ia600102.us.archive.org/23/items/SampleVideo1280x72020mb/SampleVideo_1280x720_20mb.mp4
5
+
6
+ # Check if the download was successful
7
+ if [ $? -eq 0 ]; then
8
+ echo "Download successful."
9
+ else
10
+ echo "Download failed."
11
+ exit 1
12
+ fi
13
+
14
+ if [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
15
+ ffmpeg_executable="ffmpeg.exe"
16
+ else
17
+ ffmpeg_executable="ffmpeg"
18
+ fi
19
+
20
+
21
+ start_time="$(date +%s)"
22
+ $ffmpeg_executable -i input.mp4 -c:v libx264 -preset medium -crf 23 -c:a aac -strict experimental -y output.mp4
23
+ end_time="$(date +%s)"
24
+
25
+ # Check if the reencoding was successful
26
+ if [ $? -eq 0 ]; then
27
+ echo "Reencoding successful."
28
+ else
29
+ echo "Reencoding failed."
30
+ exit 1
31
+ fi
32
+
33
+ rm input.mp4
34
+ rm output.mp4
35
+ elapsed_time=$((end_time - start_time))
36
+ echo "Reencoding took approximately $elapsed_time seconds."
uploads/.nomedia ADDED
File without changes