使用 FFMpeg 将 WMA 解码为 PCM
我想将 WMA 流解码为 16 位 PCM。 现在我有一个关于 FFMpeg 的问题 - .. 的输出格式是什么?
len = avcodec_decode_audio2(c, (int16_t *)outbuf, &outbuf_used, inbuf_ptr, size);
这是执行此任务的正确函数吗?
谢谢
I want to decode a WMA stream to 16 Bit PCM. Now i have a Question concerning FFMpeg- what is the output format of ..
len = avcodec_decode_audio2(c, (int16_t *)outbuf, &outbuf_used, inbuf_ptr, size);
is this the right function for this task?
Thank you
备注:尝试在 ffmpeg 用户列表上询问这个问题。 您肯定会在那里找到 ffmpeg 专家。
我主要使用ffmpeg来编码/解码视频。 要解码,“avcodec_decode_*”是正确使用的东西......解码。 您得到的是... 16 位 PCM。
我的意思是解码多媒体流可能很棘手,而 ffmpeg 是一个相当低级的库。 仅凭您给出的代码行很难变得更精确(至少您应该对参数更精确)。
您应该注意的是,在读取多媒体流时,您必须首先对流进行解复用(有时即使您的容器中只有一个流),然后使用正确的编解码器对其进行解码。 如果您已经正确地解复用了流,正确地初始化了编解码器/编解码器上下文,那么您可以调用 avcodec_decode 并且它会起作用:)
当您在标签中提到 c++ 时,您可以尝试对 ffmpeg 进行 c++ 包装: FOBS
使用起来要简单得多,但当然,你会失去精确的控制......
我希望它有所帮助。
A remark : try to ask this question on ffmpeg user list. You will certainly find ffmpeg gurus there.
I mainly use ffmpeg to encode/decode video. To decode, the "avcodec_decode_*" are the right things to use for ... decoding. What you get is ... 16 bits PCM.
What I mean is that decoding a multimedia stream can be tricky and ffmpeg is quite a low level lib. It is hard to be more precise with just the line of code you give (at least you should be more precise about your parameters).
What you should be careful about is that when reading multimedia stream, you have to demux you stream first (sometimes even if there is only one stream in your container) and then to decode it with the right codec. If you have correctly demuxed your stream, correctly initialized your codec / codec context then you can call avcodec_decode and it will works :)
As you mention c++ in your tags, you can try a c++ wrapping for ffmpeg : FOBS
The use is much more simple but of course, you lose precise control ...
I hope it helps.