How can I save audio as PCMA?
- I register codec with PCMA
if err := m.RegisterCodec(webrtc.RTPCodecParameters{
RTPCodecCapability: webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypePCMA, ClockRate: 8000, Channels: 0, SDPFmtpLine: "", RTCPFeedback: nil},
PayloadType: 8,
}, webrtc.RTPCodecTypeAudio); err != nil {
panic(err)
}
- while on track, What kind of file should I use to store it to disk, or should I use the example's OGG file?
peerConnection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
codec := track.Codec()
fmt.Println(codec.MimeType)
if strings.EqualFold(codec.MimeType, webrtc.MimeTypePCMA) {
fmt.Println("Got Opus track, saving to disk as output.opus (48 kHz, 2 channels)")
saveToDisk(oggFile, track)
}
})
- But I failed, finally the OGG file don't work !
- please help me, Thank!
Can save to disk as audio/PCMA