mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-09 10:36:03 +02:00
Refactor/ffmpeg less stream (#1092)
* remove ffmpeg from stream to use opus and vpx, add bunch of todos * fix testing * improve download checkout * fix datachannel download, fix super dirty test clients - setup logic does not belong there * fix testing
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
import ctypes
|
||||
import os
|
||||
from functools import lru_cache
|
||||
from typing import Dict, Optional
|
||||
from typing import Dict, Optional, Tuple
|
||||
|
||||
from facefusion.common_helper import is_linux, is_macos, is_windows
|
||||
from facefusion.download import conditional_download_hashes, conditional_download_sources, resolve_download_url_by_provider
|
||||
from facefusion.filesystem import resolve_relative_path
|
||||
from facefusion.types import DownloadSet
|
||||
|
||||
|
||||
def resolve_library_file() -> Optional[str]:
|
||||
def resolve_library_paths() -> Optional[Tuple[str, str]]:
|
||||
if is_linux():
|
||||
return 'linux-x64-openssl-h264-vp8-av1-opus-libdatachannel-0.24.1.so'
|
||||
return 'linux/libdatachannel.hash', 'linux/libdatachannel.so'
|
||||
if is_macos():
|
||||
return 'macos-universal-openssl-h264-vp8-av1-opus-libdatachannel-0.24.1.dylib'
|
||||
return 'macos/libdatachannel.hash', 'macos/libdatachannel.dylib'
|
||||
if is_windows():
|
||||
return 'windows-x64-openssl-h264-vp8-av1-opus-datachannel-0.24.1.dll'
|
||||
return 'windows/datachannel.hash', 'windows/datachannel.dll'
|
||||
return None
|
||||
|
||||
|
||||
@lru_cache
|
||||
def create_static_library_set() -> Dict[str, DownloadSet]:
|
||||
library_file = resolve_library_file()
|
||||
library_hash_path, library_source_path = resolve_library_paths()
|
||||
|
||||
return\
|
||||
{
|
||||
@@ -27,21 +29,28 @@ def create_static_library_set() -> Dict[str, DownloadSet]:
|
||||
{
|
||||
'datachannel':
|
||||
{
|
||||
'url': 'https://huggingface.co/bluefoxcreation/libdatachannel/resolve/main/linux-x64-openssl-h264-vp8-av1-opus-libdatachannel-0.24.1.so.hash',
|
||||
'path': resolve_relative_path('../.binaries/' + library_file + '.hash')
|
||||
'url': resolve_download_url_by_provider('huggingface', 'libraries-4.0.0', library_hash_path),
|
||||
'path': resolve_relative_path('../.libraries/' + os.path.basename(library_hash_path))
|
||||
}
|
||||
},
|
||||
'sources':
|
||||
{
|
||||
'datachannel':
|
||||
{
|
||||
'url': 'https://huggingface.co/bluefoxcreation/libdatachannel/resolve/main/linux-x64-openssl-h264-vp8-av1-opus-libdatachannel-0.24.1.so',
|
||||
'path': resolve_relative_path('../.binaries/' + library_file)
|
||||
'url': resolve_download_url_by_provider('huggingface', 'libraries-4.0.0', library_source_path),
|
||||
'path': resolve_relative_path('../.libraries/' + os.path.basename(library_source_path))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def pre_check() -> bool:
|
||||
library_hash_set = create_static_library_set().get('hashes')
|
||||
library_source_set = create_static_library_set().get('sources')
|
||||
|
||||
return conditional_download_hashes(library_hash_set) and conditional_download_sources(library_source_set)
|
||||
|
||||
|
||||
@lru_cache
|
||||
def create_static_library() -> Optional[ctypes.CDLL]:
|
||||
library_path = create_static_library_set().get('sources').get('datachannel').get('path')
|
||||
|
||||
Reference in New Issue
Block a user