hello
hello

Reputation: 35

Why do I get some errors using opus_demo command?

My goal is decoding opus file to pcm file.I try ffmpeg example[How do I decode opus file to pcm file using libavcodec from ffmpeg? not success.And I learn that libopus also can do it from Internet. So I download the libopus[https://opus-codec.org/release/stable/2019/04/12/libopus-1_3_1.html].After I get opus_demo from compiling opus_demo.c ,I run this.

./opus_demo  
Usage: ./opus_demo [-e] <application> <sampling rate (Hz)> <channels (1/2)> <bits per second>  [options] <input> <output>
       ./opus_demo -d <sampling rate (Hz)> <channels (1/2)> [options] <input> <output>

application: voip | audio | restricted-lowdelay
options:
-e                   : only runs the encoder (output the bit-stream)
-d                   : only runs the decoder (reads the bit-stream as input)
-cbr                 : enable constant bitrate; default: variable bitrate
-cvbr                : enable constrained variable bitrate; default: unconstrained
-delayed-decision    : use look-ahead for speech/music detection (experts only); default: disabled
-bandwidth <NB|MB|WB|SWB|FB> : audio bandwidth (from narrowband to fullband); default: sampling rate
-framesize <2.5|5|10|20|40|60|80|100|120> : frame size in ms; default: 20 
-max_payload <bytes> : maximum payload size in bytes, default: 1024
-complexity <comp>   : complexity, 0 (lowest) ... 10 (highest); default: 10
-inbandfec           : enable SILK inband FEC
-forcemono           : force mono encoding, even for stereo input
-dtx                 : enable SILK DTX
-loss <perc>         : simulate packet loss, in percent (0-100); default: 0

 ./opus_demo -d 16000 2 ./test.opus ./outfile.pcm
libopus 1.3.1
Decoding with 16000 Hz output (2 channels)
Invalid payload length: 440786851
bitrate statistics are undefined

My opus file is captured from ffmpeg command.

ffmpeg -f avfoundation -i :0 out.opus
ffmpeg -i out.opus -acodec pcm_s16le -f s16le -ac 1 -ar 16000 ./out.pcm
ffplay -ar 16000 -ac 1 -f s16le -i ./out.pcm

What should I do? And reach my goal.Please help me.

Upvotes: 0

Views: 524

Answers (1)

anthumchris
anthumchris

Reputation: 9090

Is this an Ogg Opus file? opus_demo is more of a "tutorial" for learning to program with the libopus C library from what I remember. You can decode using the CLI tools:

$ opusdec music.opus music.wav

https://opus-codec.org/release/dev/2018/09/18/opus-tools-0_2.html

Upvotes: 1

Related Questions