Audio Gstreamer使用(uri)decodebin从视频文件播放音频-CPU使用率高
我正在使用gstreamer转换文件/RTMP/RTSP流中的音频,然后对其进行分析 问题是,如果我的源文件是视频或视频流,gstreamer会占用大量CPU 示例1(视频)-如htop所述,使用30-35%的CPUAudio Gstreamer使用(uri)decodebin从视频文件播放音频-CPU使用率高,audio,ffmpeg,gstreamer,Audio,Ffmpeg,Gstreamer,我正在使用gstreamer转换文件/RTMP/RTSP流中的音频,然后对其进行分析 问题是,如果我的源文件是视频或视频流,gstreamer会占用大量CPU 示例1(视频)-如htop所述,使用30-35%的CPU gst-launch-1.0 uridecodebin uri='test.mp4' ! autoaudiosink 示例2(上面视频文件中的音频使用ffmpeg-c副本转换)-使用2-4%的CPU gst-launch-1.0 uridecodebin uri='test.mp
gst-launch-1.0 uridecodebin uri='test.mp4' ! autoaudiosink
示例2(上面视频文件中的音频使用ffmpeg-c副本转换)-使用2-4%的CPU
gst-launch-1.0 uridecodebin uri='test.mp3' ! autoaudiosink
如何指定我只需要视频文件中的音频源
我使用decodebin是因为我不知道我将从用户那里获得哪些文件(格式)。对于上述示例,您可以使用playbin设置flags属性:
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
如果您想提取音频并对其进行转码,您可能需要编写一些代码。我已经有了decodebin和appsink的工作管道,这使我能够访问原始转码pcm16 16khz音频,谢谢!好像我发现了问题所在。Decodebin2(顺便说一句,它在playbin中使用)解码它在源文件/stream/等中可以找到的所有流。看起来现在正在开发的decodebin3将摆脱无用的CPU使用。