RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Do not send Audio stream in SRT

Open cryinrain69 opened this issue 11 months ago • 20 comments

Describe the bug

I am using SrtCamera2 + OpenGlView.

During the first livestream, everything seemed to work fine. The server received both image and sound. But after stopping the livestream, and livestreaming again (all subsequent livestreams), the server only received images but no sound. Only when I exited the application and reopened it. Started the livestream again, then there was sound. And the no sound error will repeat if I continue to stop and start the livestream. It can be understood simply like this: Start livestream (server receives image + sound) => Stop => Start livestream (server only has image + no sound). But sometimes the first time I open the app to livestream, there is no sound.

The code I am using to start and stop the livestream:

srtCamera2.startStream(url)
srtCamera2.stopStream()

When the livestream error has no sound, I call srtCamera2.enableAudio() or srtCamera2.disableAudio() and everything is still the same (no sound). When I was livestreaming and had no sound, in the onNewBitrate listener, I checked that srtCamera2.isMute returned false.

I am using vMix as the srt server. https://www.vmix.com/

If I use the CameraFi Live app (on Play Store), everything works fine and doesn't have this error. Please check soon for me.

_Also, do you have a sample project on how to use srt and its features effectively (using this sdk library of yours) ?

I've been struggling with this passphrase (issues 1697) and audio issue for days now and haven't found a solution. Since everything is fine when I use another app to live, I think there's no problem on the server side.

Thank you very much.

image

Smartphone (please complete the following information): Library version [2.5.5] Device: [Samsung Galaxy S22 Ultra, Vsmart Joy 3] OS: [Android 14, 10] Class used: [RtmpCamera2 + OpenGlView]

cryinrain69 avatar Jan 10 '25 08:01 cryinrain69

Ok, I will check it

pedroSG94 avatar Jan 10 '25 09:01 pedroSG94

Ok, I will check it

Hi @pedroSG94 Is there any new information or solution for this problem? I really need this fixed 😢

cryinrain69 avatar Jan 14 '25 10:01 cryinrain69

Hello,

I'm currently with this but I'm no able to reproduce it for now. I tested using MediaMTX. I will install vMIx server today and test with that. Also, can you check that you have audio packets send in the logcat?

pedroSG94 avatar Jan 14 '25 12:01 pedroSG94

I was able to connect stream using vMix but the audio is not working with exactly the same configuration than with MediaMTX, only the video. How can I check the audio channel received?

pedroSG94 avatar Jan 14 '25 12:01 pedroSG94

I was able to connect stream using vMix but the audio is not working with exactly the same configuration than with MediaMTX, only the video. How can I check the audio channel received?

Please see green icon at here: IMG_20250114_200905

cryinrain69 avatar Jan 14 '25 13:01 cryinrain69

I'm not able to see that green bar no matter what. The audio is working fine on others server. Can you tell me your audio config? maybe I need set a config to work properly

pedroSG94 avatar Jan 14 '25 16:01 pedroSG94

I'm not able to see that green bar no matter what. The audio is working fine on others server. Can you tell me your audio config? maybe I need set a config to work properly

Hi. I am configuring like this:

image

image

As I said at the beginning, the sound is transmitted sometimes with signal, sometimes without (When it's live, if there is sound, the whole live session will always have sound. If there is not, the whole live session will not have sound). And when there is no sound signal, I have to stop live and exit the app completely to re-open the app and try live again.

Start livestream (server receives image + sound) => Stop => Start livestream (server only has image + no sound). But sometimes the first time I open the app to livestream, there is no sound.

cryinrain69 avatar Jan 15 '25 04:01 cryinrain69

When live has sound, I print log like this:

image

image


And when live has no sound, the same thing happens in log:

image

image

cryinrain69 avatar Jan 15 '25 05:01 cryinrain69

Hi @pedroSG94 Any new information on this issue ? 😢

cryinrain69 avatar Jan 16 '25 09:01 cryinrain69

Hello,

I'm trying it but i'm not able to make it work even with ffmpeg. With ffmpeg it is not working directly. No audio and no video.

To discard problems when the stream is stopped and started again. I tested that case using 2 servers and it is working as expected (MediaMTX and SRS in this case) For now, I fixed the problem with the video/audioFrameSent variable that never increment.

pedroSG94 avatar Jan 16 '25 23:01 pedroSG94

Hello,

I'm trying it but i'm not able to make it work even with ffmpeg. With ffmpeg it is not working directly. No audio and no video.

To discard problems when the stream is stopped and started again. I tested that case using 2 servers and it is working as expected (MediaMTX and SRS in this case) For now, I fixed the problem with the video/audioFrameSent variable that never increment.

Hi. I use vMix to build additional graphics and control frames for livestreaming. Therefore, using vMix as an SRT server will give faster transmission speed, without having to get source from other intermediate servers. Some other livestreaming applications on the app store still work well with vMix, so I really hope this RootEncoder library will do the same. I hope you will soon find a solution to fix this problem. If there is any new information, please let me know. I will still follow this update every day. Thank you very much.

cryinrain69 avatar Jan 17 '25 05:01 cryinrain69

@pedroSG94 Hi. Have you fixed this yet ? Any news ?

cryinrain69 avatar Mar 10 '25 04:03 cryinrain69

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

pedroSG94 avatar Mar 10 '25 09:03 pedroSG94

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

I tested this StreamPack lib with vMix and it still has both video and audio with SRT protocol. It might help you.

cryinrain69 avatar Mar 10 '25 14:03 cryinrain69

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

Hi. With RTMP it has full video and sound (Device camera and UVC camera are fine). The no sound error only happens with SRT.

cryinrain69 avatar Mar 12 '25 02:03 cryinrain69

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

Hi. With RTMP it has full video and sound (Device camera and UVC camera are fine). The no sound error only happens with SRT.

Hello,

Yes, I noticed that. I'm trying to find the reason with SRT but still I don't know how to fix it. I don't even know if the problem is in MPEGTS packet or SRT data packets.

Since the feedback from vMIx server is 0, I only can do test and error without find the reason.

pedroSG94 avatar Mar 14 '25 07:03 pedroSG94

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

Hi. With RTMP it has full video and sound (Device camera and UVC camera are fine). The no sound error only happens with SRT.

Hello,

Yes, I noticed that. I'm trying to find the reason with SRT but still I don't know how to fix it. I don't even know if the problem is in MPEGTS packet or SRT data packets.

Since the feedback from vMIx server is 0, I only can do test and error without find the reason.

Hi. Have you tried the StreamPack library? It works fine with SRT on vMix. However, when integrating it with UVCCamera, it fails on some devices, while your library still works on those devices, just without sound. If you can fix it, that would be great.

cryinrain69 avatar Mar 14 '25 07:03 cryinrain69

This was paused because I'm not able to make the server works with others encoders like ffmpeg. Also, I have no feedback of the audio received in the server side. I will re-try this week after finish others fixs

Hi. With RTMP it has full video and sound (Device camera and UVC camera are fine). The no sound error only happens with SRT.

Hello, Yes, I noticed that. I'm trying to find the reason with SRT but still I don't know how to fix it. I don't even know if the problem is in MPEGTS packet or SRT data packets. Since the feedback from vMIx server is 0, I only can do test and error without find the reason.

Hi. Have you tried the StreamPack library? It works fine with SRT on vMix. However, when integrating it with UVCCamera, it fails on some devices, while your library still works on those devices, just without sound. If you can fix it, that would be great.

Yes, I tried but, still I have no way to know the problem in my side. I will try discard if the problem is in MpegTS or in SRT packets and maybe I can find the problem but It will take time

pedroSG94 avatar Mar 14 '25 13:03 pedroSG94

Hello,

Finally fixed!! The problem was with small MPEGTS packets. https://github.com/pedroSG94/RootEncoder/commit/238972ce591f9798a456efb877d3e40272ed19bc https://github.com/pedroSG94/RootEncoder/commit/4ba166ee2de26d0b2da55a2b8c5c3cd04cc884c3 You can test it in master branch

pedroSG94 avatar Mar 16 '25 10:03 pedroSG94

Hello,

Finally fixed!! The problem was with small MPEGTS packets. 238972c 4ba166e You can test it in master branch

Hi. I tested on master and got audio signal. Thank you very much for your efforts.

cryinrain69 avatar Mar 17 '25 03:03 cryinrain69