CasparCG / server

CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
GNU General Public License v3.0
904 stars 269 forks source link

(build 2.4 date 6-3-2023) performance with H264 recording and streaming is must less then CasparCG 2.1 #1468

Closed TKooijmans closed 1 year ago

TKooijmans commented 1 year ago

Expected behaviour

Some how the newer CasparCG 2.4 builds still perform a lot less then the CasparCG 2.1 with streaming and h264 recording.

Here are the results if I compare CPU load format setting 1080i5000 CLEAR 1 with 2.1 CPU load 5% PLAY 1-1 DECKLINK DEVICE 2 FORMAT 1080i5000 with 2.1 CPU load 6%

UDP live stream ADD 1 STREAM udp://239.192.10.60:5000?pkt_size=1316 -pix_fmts yuv420p -format mpegts -vcodec libx264 -crf 28 -c:a libvo_aacenc -b:a 256k -tune zerolatency -preset superfast CPU load 30%

record HD 1080i50 mp4 file ADD 1 FILE TestH264.mp4 -pix_fmt yuv420p -vcodec libx264 -preset superfast -tune film -crf 23 -x264opts tff=1 CPU load 30%


Then with CasparCG 2.4 latest build format setting 1080i5000 CLEAR 1 with 2.1 CPU load 5% PLAY 1-1 DECKLINK DEVICE 2 FORMAT 1080i5000 with 2.4 CPU load 22%

UDP live stream ADD 1 STREAM "udp://239.192.10.60:5000?pkt_size=1316" -format mpegts -codec:v libx264 -crf:v 28 -preset:v superfast -filter:v format=pix_fmts=yuv420p,tinterlace=4 -flags:v +ildct+ilme -codec:a aac -b:a 128k -ar:a 48k -filter:a pan=stereo|c0=c0|c1=c2 CPU load 75%

record HD 1080i50 mp4 file ADD 1 FILE "myfile 1.mp4" -codec:v libx264 -crf:v 23 -preset:v veryfast -filter:v format=pix_fmts=yuv420p,tinterlace=4 -flags:v +ildct+ilme -codec:a aac -b:a 128k -ar:a 48k -filter:a pan=stereo|c0=c0|c1=c2 CPU load 95%

So CasparCG 2.4 is a lot less effective with recording and streaming in H264. Also playback of a Decklink source takes much more CPU power. The good news is however, that the recorded mp4 files now are compatible with Premiere Pro. And the udp streaming now works also.

Why is performance a lot less effective compared to CasparCG 2.1?

Environment

Win 10 cpu i7 2600k 16GB ram Nvidia GTX 1660 Win 10

Julusian commented 1 year ago

how does it compare if you use a 1080p5000 channel in both versions instead? I expect that a majority of the cpu change will be related to the mixer being 50p in 2.2+, and essentially having double the data rate compared to 2.1. the recording and stream in 2.4 might be coming through as p50 even, I dont remember if there was anything forcing it to be interlaced, it doesnt look like you are setting that in the consumers.

for the decklink producer, it is probably because deinterlacing is forced for them now due to the pipeline changes and that being needed to allow for scaling and things to work

Julusian commented 1 year ago

I don't think there is anything to look into here currently. I think my suspicion of the ffmpeg outputs in 2.4 being fed and encoding 50p will be part of the cost, and could probably be improved by adding interlacing to the ffmpeg filter.
Anything else sounds like the general cost of the internal changes made for 2.2.