Open spencerchance opened 2 days ago
I had the exact same problem, only in my case, I was using ffmpeg and had to invoke my commands with: -async 50
I noticed issues when streaming video files that used AAC audio tracks, but the async
buffer option.
What you identified as a "red herring" may be exactly the opposite: the encoder may not be writing at the correct pace.
@hqkirkland good call on the -async 50 option. I was not re-encoding the stream since my media source was already using Opus as the audio codec, but upon using runOnReady: ffmpeg -i rtsp://192.168.1.66:554/axis-media/media.amp -c:a libopus -b:a 64K -async 50 -f rtsp rtsp://0.0.0.0:$RTSP_PORT/audio-fixed
, the performance is substantially improved.
Also worth noting that my audio environment now looks like this:
Source path: Axis Streamer > RTSP > MediaMTX(server1)/(FFmpeg re-encoding here) > SRT > MediaMTX(server2) > WebRTC > client/browser.
WebRTC from my second server now sounds great. I am not sure where to pin this issue.
Glad to hear it!
A similar discussion took place here, which is where I found my solution using -async 50
.
https://github.com/bluenviron/mediamtx/discussions/2787
I share your mystification. If it helps for comparison, my layout is:
[AAC+H.264 File] -> ffmpeg -re ... -async 50 rtsp://...
-> MediaMTX RTSP Ingest -> MediaMTX WebRTC/WHEP Egress
Which version are you using?
v1.9.2
Which operating system are you using?
Linux amd64 Docker
Describe how to replicate the issue
Current Setup: I am streaming audio from an Axis C8110 Network bridge and encoding the audio data using OPUS - 48kHz. Source path: Axis Streamer > RTSP > MediaMTX > WebRTC > client/browser. Source path: Axis Streamer > RTSP > MediaMTX > SRT > VLC.
Observations and findings: Streaming audio over WebRTC is perpetually bad. From the MediaMTX server to my browser is over a VPN. The media is unclear and frequently sounds clippy and poppy.
I also found that streaming to VLC is bad if i set the latency/caching to 0ms. However, i believe this to be a red herring.
If i set the cache in VLC to = 50ms, the quality is almost perfect.
I understand that WebRTC is supposed to be real-time, but i am trying hard to determine if there is a way for me to adjust the receive buffer. I have created my own version of the read_index page, but have not had success testing with jitterBufferTarget. No matter what i set values to, audio quality over WebRTC is still bad.
I have attached a zip folder with two audio samples -- I used Audacity to record them. One is of audio over WebRTC & Chrome, and the other is over SRT & VLC w/ caching set to 50ms
audioSamples.zip
Server logs
mediamtx.log
Network dump
No response