Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio streaming via ffmpeg produces choppy playback on Android devices #115

Closed
Parfyonator opened this issue Jun 10, 2023 · 2 comments
Closed

Comments

@Parfyonator
Copy link

Hello

I have an issue when using Ingress for audio streaming to a room with ffmpeg. I have two backends

  • Go backend for room creation, Egress instantiation and rtmp URL generation for Ingress I'm using node.js for backend
  • Node.js backend for playlist management and audio streaming to given rtmp URL.

Frontend is written in Flutter/Dart and uses livekit flutter SDK of the latest version (1.3.4). Flutter version: 3.7.12

When I spawn ffmpeg process to strem music to previously generated rtmp URL with this code (Node.js)

const ffmpeg = childProcess.spawn(
    `ffmpeg`, [`-re`, `-ss`, `${toHHMMSS(req.body.seekSeconds)}`, `-stream_loop`, `-1`, `-i`, `${concat}`, `-c:v`, `libx264`, `-c:a`, `aac`, `-f`, `flv`, `${req.body.rtmpUrl}`],
    {
        cwd: process.cwd() + '/songs'
    }
);

it looks like some parts of a song are dropping and it becomes choppy (watch the attached video). This behaviour happens only on Android devices: it works fine in example Web app and iOS build of my Flutter application.
Snipper comment: toHHMMSS transforms transforms seconds to MM:SS format and concat is a list of mp3 files for playback.

IMG_0099.MOV
@Parfyonator
Copy link
Author

Parfyonator commented Jun 10, 2023

Hi. I managed to find a solution to a problem. I switched -c:a from aac to mp3 and added -vbr 5. And now everything works fine for all platforms.

@biglittlebigben
Copy link
Contributor

Have you tried with the libfdk_aac encoder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants