High CPU usage decoding 4K 60fps video
Sergio González
sergiogf93 at gmail.com
Tue Jul 26 11:49:48 UTC 2022
Hi All,
Thank you very much for your replies!
In my app I am giving the encoded frames to the app source as fast as
possible and properly timestamp. I tried playing with the properties with
`gst_app_src_set_max_bytes`, `gst_app_sink_set_max_buffers`;
`g_object_set(m_avdec, "max-threads", "1", NULL);` but it did not change
the cpu usage. In principle no video conversion is done. I just grab the
yuv textures from the appsink and can display them, or dump them to disk.
I tried changing the avdec_h265 by vaapih265dec, but it seems I don't have
it since I get `No such element or plugin 'vaapih265dec'`. I tried to
install it with `sudo apt install va-driver-all gstreamer1.0-vaapi` but it
still does not appear with gst-inspect.
One thing I noticed is that if I change avdec_h265 to libde265dec, it seems
to run more smoothly. Maybe there is an issue on how I compile libav? That
does not affect the gst-launch command?
I'll keep looking into it.
Cheers,
Sergio
On Tue, 26 Jul 2022 at 13:26, Tim-Philipp Müller via gstreamer-devel <
gstreamer-devel at lists.freedesktop.org> wrote:
> On Tue, 2022-07-26 at 09:36 +0200, Sergio González via gstreamer-devel
> wrote:
>
> Hi Sergio,
>
> appsrc ! queue ! typefind ! h265parse ! capsfilter ! avdec_h265 ! queue !
> videoconvert ! queue ! appsink
>
> What I am observing is that when I push buffers to the appsrc, if the
> decoding components are linked, there is a high surge of CPU consumption
> (as in, 12 of the 16 cores are at 100%). However, if on the same machine I
> just execute the same pipeline with gst-launch, the cpu usage is way more
> reasonable and the decoding goes smoothly.
>
>
> How do you feed buffers into appsrc? Time-based (e.g. 60 buffers per
> second) or as fast as possible?
>
> appsink has an unlimited queue internally, so if you feed buffers as fast
> as possible on the source side, nothing will throttle the decoding until
> you run out of memory. You can set appsink max-buffers=5 or so to work
> around that.
>
> Do you force video conversion after the decoder (via caps on the appsink)
> that you don't get in a playback pipeline?
>
> Do you put proper timestamps on the buffers you push into appsrc, or how
> is the data timestamped?
>
>
> Adding a Probe to the sink and the source pads of the avdec_h265 tells me
> that the time between decoding buffers at the beginning is of about 200ms,
> but as app keeps decoding, it soon reaches 600ms.
>
>
> That sounds like the appsrc/sink pipeline is decoding at a slower rate
> than realtime? (But at the same time using much more cpu?)
>
> Do you have some insight on what might cause this? Maybe I am missing some
> property in some of the components?
>
>
> There are properties on avdec_h265 that you can play with, like
> thread-type=slice or max-threads=X but if the defaults are used in both
> cases that doesn't really explain the difference in behaviour.
>
> Cheers
> Tim
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220726/1917c74c/attachment.htm>
More information about the gstreamer-devel
mailing list