【问题标题】:Why do I get some errors using opus_demo command?为什么使用 opus_demo 命令会出现一些错误?
【发布时间】: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

我该怎么办?并达到我的目标。请帮助我。

【问题讨论】:

    标签: audio decode opus


    【解决方案1】:

    这是 Ogg Opus 文件吗? opus_demo 更像是一个“教程”,用于学习使用我所记得的libopus C 库进行编程。您可以使用 CLI 工具进行解码:

    $ opusdec music.opus music.wav
    

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

    【讨论】:

    • 我需要在我的代码中编程,所以我想找一些例子来实现我的目标,将 opus 文件解码为 pcm 文件。我的 opus 文件来自 webrtc,我将 rtp 数据包保存为 opus文件。需要将opus文件解码为pcm文件才能发送到远程服务器API。我该怎么办?我需要知道什么?
    • 这是您特指的 Ogg Opus 文件吗?还是没有打包在像 Ogg 这样的容器中的 opus 数据包文件?
    • 我使用 ffmpeg 命令获取 opus 文件。ffmpeg -f avfoundation -i :0 out.opus然后,使用 ffprobe 命令了解它的信息。 Input #0, ogg, from 'out.opus': Duration: 00:00:14.57, start: 0.000000, bitrate: 57 kb/s Stream #0:0: Audio: opus, 48000 Hz, mono, fltp Metadata: encoder : Lavc58.54.100 libopus也会报错。
    猜你喜欢
    • 2017-04-24
    • 2019-09-17
    • 2019-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-20
    • 2022-06-13
    • 1970-01-01
    相关资源
    最近更新 更多