mirror of
https://github.com/facefusion/facefusion.git
synced 2026-04-22 17:36:16 +02:00
stop passing format
This commit is contained in:
@@ -110,13 +110,13 @@ async def save_asset_files(upload_files : List[UploadFile]) -> List[str]:
|
||||
|
||||
upload_task = asyncio.create_task(feed_upload_queue(upload_file, upload_queue))
|
||||
|
||||
if media_type == 'audio' and await asyncio.to_thread(ffmpeg.sanitize_audio, file_format, upload_queue.get, asset_path, api_security_strategy): #todo: do not pass format, do not pass queue but bytes if same speed
|
||||
if media_type == 'audio' and await asyncio.to_thread(ffmpeg.sanitize_audio, upload_queue.get, asset_path, api_security_strategy):
|
||||
asset_paths.append(asset_path)
|
||||
|
||||
if media_type == 'image' and await asyncio.to_thread(ffmpeg.sanitize_image, file_format, upload_queue.get, asset_path):
|
||||
if media_type == 'image' and await asyncio.to_thread(ffmpeg.sanitize_image, upload_queue.get, asset_path):
|
||||
asset_paths.append(asset_path)
|
||||
|
||||
if media_type == 'video' and await asyncio.to_thread(ffmpeg.sanitize_video, file_format, upload_queue.get, asset_path, api_security_strategy):
|
||||
if media_type == 'video' and await asyncio.to_thread(ffmpeg.sanitize_video, upload_queue.get, asset_path, api_security_strategy):
|
||||
asset_paths.append(asset_path)
|
||||
|
||||
await upload_task
|
||||
|
||||
@@ -308,8 +308,8 @@ def concat_video(output_path : str, temp_output_paths : List[str]) -> bool:
|
||||
return process.returncode == 0
|
||||
|
||||
|
||||
def sanitize_audio(audio_format : str, media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
|
||||
audio_pipe_format = ffmpeg_builder.resolve_audio_pipe_format(audio_format) #todo: does not make sense this methods are in the builder
|
||||
def sanitize_audio(media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
|
||||
audio_pipe_format = ffmpeg_builder.resolve_audio_pipe_format(get_file_format(asset_path)) #todo: does not make sense this methods are in the builder
|
||||
|
||||
if security_strategy == 'strict':
|
||||
commands = ffmpeg_builder.chain(
|
||||
@@ -329,8 +329,8 @@ def sanitize_audio(audio_format : str, media_chunk_reader : MediaChunkReader, as
|
||||
return run_ffmpeg_with_pipe(commands, media_chunk_reader).returncode == 0
|
||||
|
||||
|
||||
def sanitize_image(image_format : str, media_chunk_reader : MediaChunkReader, asset_path : str) -> bool:
|
||||
image_pipe_format = ffmpeg_builder.resolve_image_pipe_format(image_format) #todo: does not make sense this methods are in the builder
|
||||
def sanitize_image(media_chunk_reader : MediaChunkReader, asset_path : str) -> bool:
|
||||
image_pipe_format = ffmpeg_builder.resolve_image_pipe_format(get_file_format(asset_path)) #todo: does not make sense this methods are in the builder
|
||||
commands = ffmpeg_builder.chain(
|
||||
ffmpeg_builder.pipe_image(image_pipe_format),
|
||||
ffmpeg_builder.deep_copy_image(),
|
||||
@@ -340,8 +340,8 @@ def sanitize_image(image_format : str, media_chunk_reader : MediaChunkReader, as
|
||||
return run_ffmpeg_with_pipe(commands, media_chunk_reader).returncode == 0
|
||||
|
||||
|
||||
def sanitize_video(video_format : str, media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
|
||||
video_pipe_format = ffmpeg_builder.resolve_video_pipe_format(video_format) #todo: does not make sense this methods are in the builder
|
||||
def sanitize_video(media_chunk_reader : MediaChunkReader, asset_path : str, security_strategy : ApiSecurityStrategy) -> bool:
|
||||
video_pipe_format = ffmpeg_builder.resolve_video_pipe_format(get_file_format(asset_path)) #todo: does not make sense this methods are in the builder
|
||||
|
||||
if security_strategy == 'strict':
|
||||
commands = ffmpeg_builder.chain(
|
||||
|
||||
@@ -226,10 +226,10 @@ def test_sanitize_audio() -> None:
|
||||
get_test_output_path('test-sanitize-audio-moderate.wav')
|
||||
]
|
||||
|
||||
assert sanitize_audio('wav', create_media_reader(file_path), output_paths[0], 'strict') is True
|
||||
assert sanitize_audio(create_media_reader(file_path), output_paths[0], 'strict') is True
|
||||
assert detect_audio_codec(output_paths[0]) == 'mp3'
|
||||
|
||||
assert sanitize_audio('wav', create_media_reader(file_path), output_paths[1], 'moderate') is True
|
||||
assert sanitize_audio(create_media_reader(file_path), output_paths[1], 'moderate') is True
|
||||
assert detect_audio_codec(output_paths[1]) == 'pcm_s16le'
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ def test_sanitize_image() -> None:
|
||||
file_path = get_test_example_file('source.jpg')
|
||||
output_path = get_test_output_path('test-sanitize-image.jpg')
|
||||
|
||||
assert sanitize_image('jpeg', create_media_reader(file_path), output_path) is True
|
||||
assert sanitize_image(create_media_reader(file_path), output_path) is True
|
||||
assert is_image(output_path) is True
|
||||
|
||||
|
||||
@@ -249,8 +249,8 @@ def test_sanitize_video() -> None:
|
||||
get_test_output_path('test-sanitize-video-moderate.mp4')
|
||||
]
|
||||
|
||||
assert sanitize_video('mp4', create_media_reader(file_path), output_paths[0], 'strict') is True
|
||||
assert sanitize_video(create_media_reader(file_path), output_paths[0], 'strict') is True
|
||||
assert detect_video_codec(output_paths[0]) == 'h264'
|
||||
|
||||
assert sanitize_video('mp4', create_media_reader(file_path), output_paths[1], 'moderate') is True
|
||||
assert sanitize_video(create_media_reader(file_path), output_paths[1], 'moderate') is True
|
||||
assert detect_video_codec(output_paths[1]) == 'hevc'
|
||||
|
||||
Reference in New Issue
Block a user