jhj0517
commited on
Commit
·
6849ec3
1
Parent(s):
ba0008b
Add sound check
Browse files- tests/test_config.py +9 -0
tests/test_config.py
CHANGED
|
@@ -6,6 +6,7 @@ import functools
|
|
| 6 |
import numpy as np
|
| 7 |
import cv2
|
| 8 |
from skimage.metrics import structural_similarity as compare_ssim
|
|
|
|
| 9 |
|
| 10 |
from modules.utils.paths import *
|
| 11 |
|
|
@@ -70,6 +71,14 @@ def are_videos_different(video1_path: str, video2_path: str):
|
|
| 70 |
return False
|
| 71 |
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
@functools.lru_cache
|
| 74 |
def is_cuda_available():
|
| 75 |
return torch.cuda.is_available()
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
import cv2
|
| 8 |
from skimage.metrics import structural_similarity as compare_ssim
|
| 9 |
+
from moviepy.editor import VideoFileClip
|
| 10 |
|
| 11 |
from modules.utils.paths import *
|
| 12 |
|
|
|
|
| 71 |
return False
|
| 72 |
|
| 73 |
|
| 74 |
+
def has_sound(video_path: str):
|
| 75 |
+
try:
|
| 76 |
+
video = VideoFileClip(video_path)
|
| 77 |
+
return video.audio is not None
|
| 78 |
+
except Exception as e:
|
| 79 |
+
return False
|
| 80 |
+
|
| 81 |
+
|
| 82 |
@functools.lru_cache
|
| 83 |
def is_cuda_available():
|
| 84 |
return torch.cuda.is_available()
|