Xilinx / video-sdk

https://xilinx.github.io/video-sdk
Other
30 stars 14 forks source link

Codec mpsoc_vcu_h264 has bad performance than h264 #69

Closed wujiangxingzhe closed 1 year ago

wujiangxingzhe commented 1 year ago

I did the bench test in the aws vt1 instance. The codec mpsoc_vcu_h264 costs double time than h264

[root@ip-10-0-17-227 thumbnail]# time ffmpeg -c:v mpsoc_vcu_h264 -i /opt/thumbnail/video/test_540p_recording.mp4 -vsync 0 -vf xvbm_convert,fps=1/4 -frame_pts true -enc_time_base 1 -s 960x540 -f image2 /opt/thumbnail/result/test_540p_recording/20230426092828/%d.jpeg ffmpeg version n4.4.xlnx.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 7 (GCC) configuration: --prefix=/opt/xilinx/ffmpeg --datadir=/opt/xilinx/ffmpeg/etc --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --enable-libfreetype --enable-libfontconfig --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100

<<<<<<<== FFmpeg xrm ===>>>>>>>> No device set hence falling to default device 0 ------------------i=0------------------------------------------

xclbin_name : /opt/xilinx/xcdr/xclbins/transcode.xclbin device_id : 0

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/opt/thumbnail/video/test_540p_recording.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: isommp41mp42 creation_time : 2023-04-19T00:14:06.000000Z Duration: 00:30:05.00, start: 0.000000, bitrate: 2342 kb/s Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Audio vendor_id : [0][0][0][0] Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 960x540, 2336 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] [MPSOC H.264 decoder @ 0xe06000] timing information from stream is not available Stream mapping: Stream #0:1 -> #0:0 (h264 (mpsoc_vcu_h264) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 0xe40000] deprecated pixel format used, make sure you did set range correctly [Parsed_xvbm_convert_0 @ 0x89e000] xvbm_conv:: wait for conversion to finish... Output #0, image2, to '/opt/thumbnail/result/test_540p_recording/20230426092828/%d.jpeg': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: isommp41mp42 encoder : Lavf58.76.100 Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 0.25 fps, 1 tbn (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] encoder : Lavc58.134.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A [Parsed_xvbm_convert_0 @ 0x89e000] xvbm_conv:: wait for conversion to finish... [Parsed_xvbm_convert_0 @ 0x89e000] xvbm_conv:: wait for conversion to finish... Last message repeated 2 times [Parsed_xvbm_convert_0 @ 0x89e000] xvbm_conv:: wait for conversion to finish... frame= 451 fps=5.6 q=5.6 Lsize=N/A time=00:30:01.00 bitrate=N/A speed=22.5x
video:42980kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

real 1m21.117s user 0m9.768s sys 0m14.857s [root@ip-10-0-17-227 thumbnail]# [root@ip-10-0-17-227 thumbnail]# time ffmpeg -c:v h264 -i /opt/thumbnail/video/test_540p_recording.mp4 -vsync 0 -vf fps=1/4 -frame_pts true -enc_time_base 1 -s 960x540 -f image2 /opt/thumbnail/result/test_540p_recording/20230426093010/%d.jpeg ffmpeg version n4.4.xlnx.1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 7 (GCC) configuration: --prefix=/opt/xilinx/ffmpeg --datadir=/opt/xilinx/ffmpeg/etc --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --enable-libfreetype --enable-libfontconfig --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100

<<<<<<<== FFmpeg xrm ===>>>>>>>> No device set hence falling to default device 0 ------------------i=0------------------------------------------

xclbin_name : /opt/xilinx/xcdr/xclbins/transcode.xclbin device_id : 0

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/opt/thumbnail/video/test_540p_recording.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: isommp41mp42 creation_time : 2023-04-19T00:14:06.000000Z Duration: 00:30:05.00, start: 0.000000, bitrate: 2342 kb/s Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Audio vendor_id : [0][0][0][0] Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 960x540, 2336 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] Stream mapping: Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler @ 0x16a7000] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to '/opt/thumbnail/result/test_540p_recording/20230426093010/%d.jpeg': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: isommp41mp42 encoder : Lavf58.76.100 Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 0.25 fps, 1 tbn (default) Metadata: creation_time : 2023-04-19T00:14:06.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] encoder : Lavc58.134.100 mjpeg Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A frame= 451 fps= 12 q=5.6 Lsize=N/A time=00:30:01.00 bitrate=N/A speed=46.8x
video:42980kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

real 0m39.706s user 2m12.470s sys 0m10.159s

NastoohX commented 1 year ago

Hi, Thank you for bringing this to our attention. Noting that this scenario is not one of the intended use-cases, we can confirm your observation. Where mpsoc_vcu accelerators are meant to be used are in high density low power usage deployments. Kindly, refer to https://www.xilinx.com/products/boards-and-kits/alveo/u30.html, for more in depth description. Cheers,