MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / start_ffmpeg_process_whep

Method start_ffmpeg_process_whep

lightx2v/utils/va_reader.py:97–125  ·  view source on GitHub ↗

Start gstream process read audio from stream

(self)

Source from the content-addressed store, hash-verified

95 raise
96
97 def start_ffmpeg_process_whep(self):
98 """Start gstream process read audio from stream"""
99 ffmpeg_cmd = [
100 "gst-launch-1.0",
101 "-q",
102 "whepsrc",
103 f"whep-endpoint={self.stream_url}",
104 "video-caps=none",
105 "!rtpopusdepay",
106 "!opusdec",
107 "plc=false",
108 "!audioconvert",
109 "!audioresample",
110 f"!audio/x-raw,format=S16LE,channels={self.audio_channels},rate={self.sample_rate}",
111 "!fdsink",
112 "fd=1",
113 ]
114 try:
115 self.ffmpeg_process = subprocess.Popen(
116 ffmpeg_cmd,
117 stdout=subprocess.PIPE,
118 # stderr=subprocess.PIPE,
119 bufsize=0,
120 )
121 logger.info(f"FFmpeg audio pull process started with PID: {self.ffmpeg_process.pid}")
122 logger.info(f"FFmpeg command: {' '.join(ffmpeg_cmd)}")
123 except Exception as e:
124 logger.error(f"Failed to start FFmpeg process: {e}")
125 raise
126
127 def audio_worker(self):
128 logger.info("Audio pull worker thread started")

Callers 1

startMethod · 0.95

Calls 2

infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected