Skip to content

Industry leading face manipulation platform

Basic testing for detect_fps

henryruhsbead4a6c5f0d
diff --git a/tests/test_utilities.py b/tests/test_utilities.py
new file mode 100644
index 00000000..251d57dd
--- /dev/null
+++ b/tests/test_utilities.py
@@ -0,0 +1,21 @@
+import subprocess
+import pytest
+
+from facefusion.utilities import conditional_download, detect_fps
+
+
[email protected](scope = 'module', autouse = True)
+def setup() -> None:
+ conditional_download('.assets/examples',
+ [
+ 'https://github.com/facefusion/facefusion-assets/releases/download/examples/target-1080p.mp4'
+ ])
+ subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=25', '.assets/examples/target-1080p-25fps.mp4' ])
+ subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=30', '.assets/examples/target-1080p-30fps.mp4' ])
+ subprocess.run([ 'ffmpeg', '-i', '.assets/examples/target-1080p.mp4', '-vf', 'fps=60', '.assets/examples/target-1080p-60fps.mp4' ])
+
+
+def test_detect_fps() -> None:
+ assert detect_fps('.assets/examples/target-1080p-25fps.mp4') == 25.0
+ assert detect_fps('.assets/examples/target-1080p-30fps.mp4') == 30.0
+ assert detect_fps('.assets/examples/target-1080p-60fps.mp4') == 60.0