【发布时间】:2020-06-03 11:12:25
【问题描述】:
我的目标是将 opus 文件解码为 pcm 文件。我尝试 ffmpeg 示例 [How do I decode opus file to pcm file using libavcodec from ffmpeg? 不成功。我了解到 libopus 也可以从 Internet 上完成。所以我下载了 libopus[https://opus-codec.org/release/stable/2019/04/12/libopus-1_3_1.html].After 我从编译 opus_demo.c 得到 opus_demo ,我运行这个。
./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
我的作品文件是从 ffmpeg 命令中捕获的。
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
我该怎么办?并达到我的目标。请帮助我。
【问题讨论】: