opus
opus copied to clipboard
How to decode file encoded by opusenc
There is a file which is encoded by opusenc --raw-rate 16000 nowavheader-stereo.pcm nowavheader-stereo.opus
i can decode it using opusdec --rate 16000 nowavheader-stereo.opus nowavheader-stereo.opus.pcm
,
I've tried these code
opusbs, err := os.ReadFile("./nowavheader-stereo.opus")
if err != nil {
panic(err.Error())
}
decoder := opus.NewDecoder()
out := make([]byte, 1920)
bandwidth, isStereo, err := decoder.Decode(opusbs, out)
if err != nil {
panic(err.Error())
}
fmt.Printf("bandwidth: %+v, isStereo: %+v\n", bandwidth, isStereo)
_ = decoder
but I got this error
panic: unsupported frame code: 3
file is bellow:
MD5 (nowavheader-stereo.pcm) = 9b5ba9b8bc5b96c8055d93033553184c MD5 (nowavheader-stereo.opus) = 13e606dfa6545c9b51a85a30cef2ab6f
opusenc --version
opusenc opus-tools 0.2 (using libopus 1.5.2) Copyright (C) 2008-2018 Xiph.Org Foundation
how to decode it using this package,any example please? Archive.zip