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

Allow to set an audio codec per channel #62

Open
felipecrs opened this issue Dec 11, 2024 · 9 comments
Open

Allow to set an audio codec per channel #62

felipecrs opened this issue Dec 11, 2024 · 9 comments

Comments

@felipecrs
Copy link

felipecrs commented Dec 11, 2024

OPUS is great and is the best audio codec hands down.

But sometimes we need other codecs. For example, legacy HLS (browser) players can only play AAC audio.

go2rtc can be used for that:

streams:
  my_cam:
    - rtsp://thingino:[email protected]/ch1
    - ffmpeg:my_cam#audio=aac

But this will invoke ffmpeg on the receiving end, which consumes CPU resources and (probably) adds some latency.

It would be great if we could have different audio codecs per channel, so that I could do something like this in go2rtc:

streams:
  my_cam:
    # ch1 would be set to send OPUS
    - rtsp://thingino:[email protected]/ch1
    # copy AAC audio track from my_cam_hd
    - rtsp://127.0.0.1:8554/my_cam_hd?audio=aac
  my_cam_hd:
    # ch0 would be set to send AAC
    - rtsp://thingino:[email protected]/ch0
    # copy OPUS audio track from my_cam
    - rtsp://127.0.0.1:8554/my_cam?audio=opus

Which would not require any transcoding. :)

@themactep
Copy link
Collaborator

themactep commented Dec 11, 2024

So let's be clear, you are worried about resources on the receiving end which has at least 512mb of ram, and want to solve it shifting the load onto a tiny camera with virtually nonexisting resources which is already busy fetching data from the sensor and transcoding and sending them?

@felipecrs
Copy link
Author

I thought the camera would have enough to handle it. I guess some of them would.

The receiving end could be a Raspberry Pi 3 with enough resources to handle AAC transcoding for few cameras, but not enough to handle it for let's say 16 cameras.

@gtxaspec
Copy link
Owner

interesting, @nschimme want to take a stab at this?

@themactep
Copy link
Collaborator

An average camera has 64mb or ram with half of it reserved for media. It barely can handle what it is intended to do.

@felipecrs
Copy link
Author

felipecrs commented Dec 11, 2024

I see. Dahua and Hikvision cameras has this feature, but they are often expensive. Maybe they have better hardware indeed.

@gtxaspec
Copy link
Owner

depends on the chip the vendor uses. X/A series chips (ingenic) have 128+MB ram, while L/LC/N chips, only 64mb :O
We always recommend 128MB/16MB units, but sometimes thats not what you already have. But I think this feature would be awesome anyway to have, i actually do this remotely using go2rtc, would be nice to see if we can optimize it on unit.

@nschimme
Copy link
Contributor

Sorry, too preoccupied with other projects right now. I see @felipecrs is an engineer, he should take a stab at it ;-)

@felipecrs
Copy link
Author

felipecrs commented Dec 11, 2024

Guys, no rush at all. I'm not demanding anything.

@nschimme, lol sure. Everyone can, I guess, no need to be an engineer. But not being familiar with the project and code base certainly makes the bar higher for me.

@nschimme
Copy link
Contributor

Haha, I said the same thing before I added the AAC and OPUS codecs :-P

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

4 participants