GStreamer + HLS stream taking up a massive amount of CPU
Hello all! Working on a rather tough problem lately that I've having a hard
time wrapping my head around.
I have an HLS livestream I'm reading from twitch.tv. I want to grab one
frame per second from the livestream, and save it locally. But, I need to
stay real time. So, when I save an image from the stream, that image should
be very close to what is actually live.
This isn't very difficult via GStreamer on the command line.
success, frame = cap.read()
This code is doing exactly what I want it to do. Saving one frame per second
and staying close to real time. This is why I do: max-buffers=1 drop=true
sync=false. I also have a one second sleep, since I only need to read one
frame per second.
The issue is, the above code takes up 250% of my machine's CPU (tested on
Windows, Linux, and OS X). I'm attempting to understand why this is the case
and what I can do to reduce CPU usage.
I'm having a hard time understanding why decoding a single frame from an HLS
stream leads to such high CPU usage. I've tried Python multithreading.