首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gstreamer使用(Uri)解码器播放视频文件中的音频- CPU使用率高

Gstreamer使用(Uri)解码器播放视频文件中的音频- CPU使用率高
EN

Stack Overflow用户
提问于 2017-05-28 02:44:08
回答 1查看 928关注 0票数 1

我使用gstreamer来转换来自文件/RTMP/RTSP流的音频,然后对其进行分析。

问题是,如果我的源文件是视频或videostream,gstreamer会占用很多CPU。

示例1(视频)-使用30-35%的CPU,如htop所说。

代码语言:javascript
复制
gst-launch-1.0 uridecodebin uri='test.mp4' ! autoaudiosink

示例2(上述视频文件中的音频通过ffmpeg副本转换)-使用2-4%的-c

代码语言:javascript
复制
gst-launch-1.0 uridecodebin uri='test.mp3' ! autoaudiosink

如何指定只需要视频文件中的音频源?

我之所以使用decodebin,是因为我不知道我会从用户那里得到哪些文件(格式)。

EN

回答 1

Stack Overflow用户

发布于 2017-05-28 17:49:36

对于上面的例子,你可以使用playbin来设置标志属性:

代码语言:javascript
复制
flags               : Flags to control behaviour
                        flags: readable, writable
                        Flags "GstPlayFlags" Default: 0x00000617, "soft-colorbalance+deinterlace+soft-volume+text+audio+video"
                           (0x00000001): video            - Render the video stream
                           (0x00000002): audio            - Render the audio stream
                           (0x00000004): text             - Render subtitles
                           (0x00000008): vis              - Render visualisation when no video is present
                           (0x00000010): soft-volume      - Use software volume
                           (0x00000020): native-audio     - Only use native audio formats
                           (0x00000040): native-video     - Only use native video formats
                           (0x00000080): download         - Attempt progressive download buffering
                           (0x00000100): buffering        - Buffer demuxed/parsed data
                           (0x00000200): deinterlace      - Deinterlace video if necessary
                           (0x00000400): soft-colorbalance - Use software color balance

如果你想提取音频并进行转码,你可能需要写一些代码。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44220477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档