add other parameters for demo videos
Browse files
app.py
CHANGED
|
@@ -414,18 +414,23 @@ def translate_from_video(
|
|
| 414 |
time.sleep(1)
|
| 415 |
break
|
| 416 |
if i == 119:
|
| 417 |
-
|
| 418 |
-
|
| 419 |
|
| 420 |
for i in range (120):
|
| 421 |
time.sleep(1)
|
| 422 |
print('process audio...')
|
| 423 |
if os.path.exists(audio_wav):
|
| 424 |
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
if i == 119:
|
| 426 |
print("Error can't create the audio")
|
| 427 |
return
|
| 428 |
-
|
| 429 |
else:
|
| 430 |
if preview:
|
| 431 |
print('Creating a preview from the link, 10 seconds to disable this option, go to advanced settings and turn off preview.')
|
|
|
|
| 414 |
time.sleep(1)
|
| 415 |
break
|
| 416 |
if i == 119:
|
| 417 |
+
print('Error processing video')
|
| 418 |
+
return
|
| 419 |
|
| 420 |
for i in range (120):
|
| 421 |
time.sleep(1)
|
| 422 |
print('process audio...')
|
| 423 |
if os.path.exists(audio_wav):
|
| 424 |
break
|
| 425 |
+
if i == 60 and round(os.path.getsize(f'{OutputFile}') / (1024 * 1024), 1) == 0.0:
|
| 426 |
+
os.system('rm intermediate.aac') # only for demo
|
| 427 |
+
os.system(f'ffmpeg -i {video} -ss 00:00:00 -t 00:00:10 -vn -acodec aac -strict -2 intermediate.aac')
|
| 428 |
+
time.sleep(5)
|
| 429 |
+
os.system('ffmpeg -i intermediate.aac -acodec pcm_s16le -ar 44100 -ac 2 audio.wav')
|
| 430 |
if i == 119:
|
| 431 |
print("Error can't create the audio")
|
| 432 |
return
|
| 433 |
+
os.system('rm intermediate.aac')
|
| 434 |
else:
|
| 435 |
if preview:
|
| 436 |
print('Creating a preview from the link, 10 seconds to disable this option, go to advanced settings and turn off preview.')
|