OpenVisualCloud / SVT-HEVC

SVT HEVC encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-HEVC encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
516 stars 172 forks source link

GOP size impacts on latency of SVT-HEVC. #509

Closed SGShen closed 4 years ago

SGShen commented 4 years ago

GOP size seems to have a great impact on the performance (latency, fps) of SVT-HEVC. With smaller GOP size, the latency increases and fps decreases dramatically. Here is a test result on 8K30FPS video (running on 8280m server):

"im360@IM360-Edge:~/tests/svt_hevc/SVT-HEVC/Bin/Release$ numactl --cpubind=0 --membind=0 ./SvtHevcEncApp -i ~/tests/videos/7680x3840_420_5.yuv -w 7680 -h 3840 -fps 30 -scd 0 -pred-struct 0 -irefresh-type 0 -rc 1 -tbr 50000000 -temporal-id 0 -lad 0 -encMode 9 -fpsinvps 0 -tile_col_cnt 6 -tile_row_cnt 12 -tile_slice_mode 1 -intra-period 4 -n 1000"

Encoding 1000 SUMMARY --------------------------------- Channel 1 -------------------------------- Total Frames Frame Rate Byte Count Bitrate 1000 30.00 fps 761149456 182675.87 kbps

Channel 1 Average Speed: 28.50 fps Total Encoding Time: 35088 ms Total Execution Time: 38593 ms Average Latency: 920 ms Max Latency: 1446 ms Encoder finished

"im360@IM360-Edge:~/tests/svt_hevc/SVT-HEVC/Bin/Release$ numactl --cpubind=0 --membind=0 ./SvtHevcEncApp -i ~/tests/videos/7680x3840_420_5.yuv -w 7680 -h 3840 -fps 30 -scd 0 -pred-struct 0 -irefresh-type 0 -rc 1 -tbr 50000000 -temporal-id 0 -lad 0 -encMode 9 -fpsinvps 0 -tile_col_cnt 6 -tile_row_cnt 12 -tile_slice_mode 1 -intra-period 29 -n 1000"

Encoding 1000 SUMMARY --------------------------------- Channel 1 -------------------------------- Total Frames Frame Rate Byte Count Bitrate 1000 30.00 fps 965102477 231624.59 kbps

Channel 1 Average Speed: 39.54 fps Total Encoding Time: 25293 ms Total Execution Time: 28805 ms Average Latency: 460 ms Max Latency: 628 ms Encoder finished

Is there any way to enhance the SVT-HEVC to make sure the latency and fps change within a small range, when GOP size is different?

intelmark commented 4 years ago

Hi @SGShen - wondering if you've tried adjusting the lad value to correspond to the intra period, or even removing the lad parameter and using the default.

From the encoding guide (for lad parameter): When RateControlMode is set to 1 it's best to set this parameter to be equal to the Intra period value (such is the default set by the encoder). When CQP is chosen, then a (2 * minigopsize +1) look ahead is recommended.

tianjunwork commented 4 years ago

image Without using numactl, gop 30 uses less CPU than gop 5. So if you squeeze the encoding into one socket, gop 5 encoding has greater impact.

SGShen commented 4 years ago

Hi, @intelmark, i tried to set lad to intra period value. It improves the FPS but the latency number is about the same. Our use case is about live streaming. So I guess the 'lad' should be 0? Thanks.

im360@IM360-Edge:~/tests/svt_hevc/SVT-HEVC/Bin/Release$ numactl --cpubind=0 --membind=0 ./SvtHevcEncApp -i ~/tests/videos/7680x3840_420_5.yuv -w 7680 -h 3840 -fps 30 -scd 0 -pred-struct 0 -irefresh-type 0 -rc 1 -tbr 50000000 -temporal-id 0 -lad 4 -encMode 9 -fpsinvps 0 -tile_col_cnt 6 -tile_row_cnt 12 -tile_slice_mode 1 -intra-period 4 -n 1000

SUMMARY --------------------------------- Channel 1 -------------------------------- Total Frames Frame Rate Byte Count Bitrate 1000 30.00 fps 165430098 39703.22 kbps

Channel 1 Average Speed: 31.23 fps Total Encoding Time: 32019 ms Total Execution Time: 35641 ms Average Latency: 956 ms Max Latency: 1325 ms

tianjunwork commented 4 years ago

Hi @SGShen, the only way to improve performance is to increase -encMode setting. The drawback is the video quality. Please check if the trade-off meet your needs.

SGShen commented 4 years ago

Hi, @tianjunwork, can I assume SVT-HEVC have done certain measurement on "encoder mode vs. PSNR"? That would be very helpful.

SGShen commented 4 years ago

Thanks for the help! @tianjunwork, @intelmark .

The data shows that we can make a tradeoff between "encMode + bitrate" and "quality + latency".