Open thanhbinh89 opened 5 months ago
SRS only support opus
as audio codec.
I think it's reasonable to support G711 codec with WebRTC. Note that SRS will convert Opus/G711 to AAC for RTMP/HTTP-FLV/HLS if enabled converting RTC to RTMP.
The first problem is prepare a test/dev env, how to prepare a webrtc client with G711 audio codec?
The common WHIP request sent from the web browser, which generate the sdp offer with opus
codec by default. As I know the Gstreamer
has an element whipsink to publish webrtc streams without web browser, but need to verify whether G711
works in this scenario.
@thanhbinh89 Could you describe how your webrtc env with G711 works?
I am using a G711 sample file, which has been recorded from a camera device. Below is the sample file (rt-recored.g711) and the smaller samples (g711/) that have been cut for transmission into WebRTC. Additionally, I have attached a Python script.
#!/usr/bin/env python3
def split_file(input_file, output_prefix, chunk_size):
with open(input_file, 'rb') as f:
i = 0
while True:
chunk = f.read(chunk_size)
if not chunk:
break
output_file = f"{output_prefix}{i:d}.g711"
with open(output_file, 'wb') as chunk_file:
chunk_file.write(chunk)
i += 1
input_file = 'rt-recored.g711'
output_prefix = 'g711/sample-'
chunk_size = 160
split_file(input_file, output_prefix, chunk_size)
TRANS_BY_GPT4
@thanhbinh89 How do you publish above G711 files to SRS by RTC? more details step to step?
@suzp1984 It will involve quite a few steps. I can't provide detailed instructions, but the steps will be:
Describe the bug Received a 502 Bad Gateway response when sending the WHIP. The SDP content in the body of the WHIP is provided below. The SDP includes video (H.264) and audio (G.711a), not Opus.
Version Docker ossrs/srs:5 , ossrs/srs:6
To Reproduce sdp