Comments (2)
I tried MediaPlayer() as well, it can play the .wav file properly.
I looked into the code, and found out that there's a resampler inside.
aiortc/src/aiortc/contrib/media.py
Line 99 in e9c13ea
But in my use case, the audio data is sent in streaming (one chunk for one video frame), so I cannot use MediaPlayer.
from aiortc.
Solved.
@jlaine Seems like aiortc wouldn't create sdp offer according to specific tracks. I added an audio track with sample rate 16k and ptime 40ms to peerconnection, but the generated offer still contains the default atributes:
m=audio 61921 UDP/TLS/RTP/SAVPF 96 0 8
c=IN IP4 2.0.0.1
a=sendrecv
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=mid:1
a=msid:7efcc2eb-a421-41b5-8aed-dd5914c45052 b3c4a814-0993-42bb-a5d6-fb32d37c902d
a=rtcp:9 IN IP4 0.0.0.0
a=rtcp-mux
a=ssrc:2645354522 cname:eee68eb0-1a58-49c2-9fe7-a6ab3c3db647
a=rtpmap:96 opus/48000/2
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
I simply changed the line:
def change_sdp(sdp):
target = 'a=rtpmap:96 opus/48000/2'
update = 'a=rtpmap:96 opus/16000/1\r\na=fmtp:96 minptime=40;useinbandfec=1'
return sdp.replace(target, update)
And the sound can be played properly.
from aiortc.
Related Issues (20)
- [Example][Server] MediaRecorder is not saving audio (mp3) from the web HOT 2
- Establish one-way video from server to client HOT 2
- Data channel stuck in connecting state while still receiving messages on it HOT 1
- Request for Guidance on Extracting WHEP Save as MP4 Files from AIORTC
- MediaPlayer HTTP stream from the same EndPoint does work
- Cannot connect to video stream: BINDING ERROR / 400 Bad Request HOT 1
- Can aiortc module be used for professional or semi-professional use?
- Implement MediaStreamTrack.enabled HOT 3
- Setting RTCRtpTransceiver.direction to `inactive` does not have any effect HOT 1
- Issue encountered when installing aiortc from source
- JS and PYTHON communication are available in the LAN, and the Internet connection fails HOT 1
- 'server' example failed when served in a remote machine HOT 2
- example videostream-cli not working HOT 1
- addTrack failing inside datachannel message receive handler
- Recording video on server discards beyond a few seconds.
- Combining multiple mp3 files to be returned as a single MediaStreamTrack
- Server Python to Client Python Q/A (INCLUDE FULL SCRIPTS!)
- Webrtc initial negotiation succeeds but renegotiation fails
- Set packet_time = 125 msec instead of 20 msec (both side) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiortc.