Skip to content

Industry leading face manipulation platform

Try to fix UDP stream

henryruhsa02df0be7e3a
diff --git a/facefusion/ffmpeg_builder.py b/facefusion/ffmpeg_builder.py
index aa36e862..8eb8e91f 100644
--- a/facefusion/ffmpeg_builder.py
+++ b/facefusion/ffmpeg_builder.py
@@ -56,6 +56,10 @@ def set_stream_mode(stream_mode : StreamMode) -> Commands:
return []
+def set_stream_quality(stream_quality : int) -> Commands:
+ return [ '-b:v', str(stream_quality) + 'k' ]
+
+
def unsafe_concat() -> Commands:
return [ '-f', 'concat', '-safe', '0' ]
diff --git a/facefusion/uis/components/webcam.py b/facefusion/uis/components/webcam.py
index 70547b2c..87c4c0d8 100644
--- a/facefusion/uis/components/webcam.py
+++ b/facefusion/uis/components/webcam.py
@@ -173,6 +173,7 @@ def open_stream(stream_mode : StreamMode, stream_resolution : str, stream_fps :
if stream_mode == 'udp':
commands.extend(ffmpeg_builder.set_input('-'))
commands.extend(ffmpeg_builder.set_stream_mode('udp'))
+ commands.extend(ffmpeg_builder.set_stream_quality(2000)),
commands.extend(ffmpeg_builder.set_output('udp://localhost:27000?pkt_size=1316'))
if stream_mode == 'v4l2':