RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

Playing Video ads(local MP4 files) while RTMP streaming is in progress.

Open penmatsa opened this issue 11 months ago • 4 comments

Thanks @pedroSG94 for Great Library. We are implementing video ads feature when RTMP streaming is in progess by "SurfaceRenderFilter" for Video packets And AudioFileSource for sending Audio Packets.

Issue when audio sample rate changes with different local video files(mp4) getting Error "Audio file sample rate 44100 is different than the configured: 22050"

Can we change audio sample rate on the fly without stopping stream.

Thanks

penmatsa avatar May 14 '25 16:05 penmatsa

Hello,

No, it is not possible. The only way is use a file with the same sample rate or develop a method to resample the audio. If you can do a method to resample the audio I can implement it to avoid this error.

pedroSG94 avatar May 16 '25 11:05 pedroSG94

Hello,

Need to add library for resampling Link: https://github.com/google/oboe/blob/main/src/flowgraph/resampler/README.md#building-the-resampler

Thanks

penmatsa avatar May 16 '25 12:05 penmatsa

Hello,

If you can compile the library, you can create your own AudioFileSource (you can copy the code) and instead of throw the fail, resample each buffer before send it to the encoder.

pedroSG94 avatar May 18 '25 07:05 pedroSG94

Thanks @pedroSG94 will try your suggestion.

penmatsa avatar May 28 '25 18:05 penmatsa