Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Performance Insights] CPU vs. GPU also utilization of shm #6

Open
koisi-io opened this issue Jan 24, 2024 · 1 comment
Open

[Performance Insights] CPU vs. GPU also utilization of shm #6

koisi-io opened this issue Jan 24, 2024 · 1 comment

Comments

@koisi-io
Copy link
Collaborator

I'm not too familiar with the details of video processing, but I'd like to share some performance observations from my practice.

CPU Usage for Decoding

My test involves pulling a single original video stream, doing some intermediate processing (consuming about 50% of CPU), then re-encoding and pushing it to an RTMP server(about 12% of CPU, using GPU encoding). I then watch the final processed live stream.

Here's my setup:

  • CPU: Intel Xeon Gold 5118 2.30GHz x8
  • GPU: Nvidia Tesla V100 32GB
  • Origin Video: 1080p 24fps, 4Mbps h264-baseline

The CPU usage below are not exact measurements, they are merely my intuitive perception from observing htop.

Decoding Scenario Min Avg Max
Single stream with CPU 18% 22% 30%
Single stream with GPU 20% 23% 25%

When it comes to 6-stream parallel decoding:

  • With GPU: CPU usage stabilizes at nearly 100% across all 8 cores, and the resulting video stream is almost smooth.
  • With CPU: The total CPU usage fluctuates between 40% and 80%, but the video is more stuttered compared to using GPU.

In my case, I might opt for the GPU solution as it appears more stable, although it seems not so friendly to energy efficiency.

@koisi-io
Copy link
Collaborator Author

koisi-io commented Jan 26, 2024

CPU Usage for Encoding(focus on shm)

My setup is as previously mentioned.

Without SHM: About 25% CPU usage, encoding one frame takes 10~11ms
With SHM: CPU usage seems down to 23%, encoding one frame takes 9~10ms

I previously used a streaming library(WriteGear), which passed frame data to an FFmpeg process through a pipe, with FFmpeg handling GPU encoding.The py part had a CPU usage of about 12%, and ffmpeg is 30%.
So, it seems both py part and ffmpeg each take about 10% CPU usage for data delivery.

However, currently, due to the lack of full support for encoding parameters in ffio, the encoding quality is not ideal, which will be the focus in future.

@koisi-io koisi-io changed the title [Performance Insights] CPU vs. GPU [Performance Insights] CPU vs. GPU also utilization of shm Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant