mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-08 05:33:52 -05:00
Added ffmpeg cpu benchmark based on @nharris-lmg commands 3 options for encode (h264, av1, h265) will report final vmaf score as "score" in report json logs saved to artifacts
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
"""utility functions for running ffmpeg tests"""
|
|
|
|
import os
|
|
import shutil
|
|
import time
|
|
from pathlib import Path
|
|
|
|
L_FFMPEG_FOLDER = Path(
|
|
"\\\\labs.lmg.gg\\labs\\01_Installers_Utilities\\ffmpeg\\ffmpeg-8.0.1-full_build"
|
|
)
|
|
SCRIPT_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
|
|
FFMPEG_FOLDER_NAME = "ffmpeg-8.0.1-full_build"
|
|
FFMPEG_EXE_PATH = SCRIPT_DIR / FFMPEG_FOLDER_NAME / "bin" / "ffmpeg.exe"
|
|
SOURCE_VIDEO_NAME = "big_buck_bunny_1080p24.y4m"
|
|
|
|
|
|
def ffmpeg_present() -> bool:
|
|
"""Check if ffmpeg is present on the system"""
|
|
return os.path.isfile(FFMPEG_EXE_PATH)
|
|
|
|
|
|
def copy_ffmpeg_from_network_drive():
|
|
"""copy ffmpeg cli from network drive"""
|
|
source = L_FFMPEG_FOLDER
|
|
shutil.copytree(source, SCRIPT_DIR / FFMPEG_FOLDER_NAME)
|
|
|
|
|
|
def is_video_source_present() -> bool:
|
|
"""check if big buck bunny video source is present"""
|
|
return os.path.isfile(Path(SCRIPT_DIR / SOURCE_VIDEO_NAME))
|
|
|
|
|
|
def copy_video_source():
|
|
"""copy big buck bunny source video to local from network drive"""
|
|
source = r"\\labs.lmg.gg\labs\03_ProcessingFiles\Handbrake Test\big_buck_bunny_1080p24.y4m"
|
|
root_dir = os.path.dirname(os.path.realpath(__file__))
|
|
destination = os.path.join(root_dir, SOURCE_VIDEO_NAME)
|
|
shutil.copyfile(source, destination)
|
|
|
|
|
|
def current_time_ms():
|
|
"""Get current timestamp in milliseconds since epoch"""
|
|
return int(time.time() * 1000)
|