{"id":14234966,"url":"https://github.com/openvino-dev-samples/decode-infer-on-GPU","last_synced_at":"2025-08-10T23:31:22.632Z","repository":{"id":63167424,"uuid":"549726659","full_name":"openvino-dev-samples/decode-infer-on-GPU","owner":"openvino-dev-samples","description":"This sample shows how to use the oneAPI Video Processing Library (oneVPL) to perform a single and multi-source video decode and preprocess and inference using OpenVINO to show the device surface sharing (zero copy)","archived":false,"fork":false,"pushed_at":"2023-06-15T03:31:26.000Z","size":105,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-13T00:32:42.391Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openvino-dev-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-10-11T16:30:20.000Z","updated_at":"2024-09-19T02:30:37.000Z","dependencies_parsed_at":"2024-01-16T01:26:22.788Z","dependency_job_id":"411d8f45-7c9b-424a-8673-c043ec55d35f","html_url":"https://github.com/openvino-dev-samples/decode-infer-on-GPU","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openvino-dev-samples/decode-infer-on-GPU","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvino-dev-samples%2Fdecode-infer-on-GPU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvino-dev-samples%2Fdecode-infer-on-GPU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvino-dev-samples%2Fdecode-infer-on-GPU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvino-dev-samples%2Fdecode-infer-on-GPU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openvino-dev-samples","download_url":"https://codeload.github.com/openvino-dev-samples/decode-infer-on-GPU/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvino-dev-samples%2Fdecode-infer-on-GPU/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269804845,"owners_count":24477868,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-20T21:00:52.736Z","updated_at":"2025-08-10T23:31:22.365Z","avatar_url":"https://github.com/openvino-dev-samples.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# decode-infer-on-GPU\nThis sample shows how to use the oneAPI Video Processing Library (oneVPL) to perform a ***single and mulit-source*** video decode and preprocess and inference using OpenVINO to show the device surface sharing (zero copy), modified from the example in (oneVPL)[https://github.com/oneapi-src/oneVPL/tree/master/examples].\n\n![vpl_ov](https://user-images.githubusercontent.com/91237924/201594545-16a056c0-8724-4562-a697-9d6eb46ab72b.png)\n\n## System requirements\n\n| Optimized for    | Description\n|----------------- | ----------------------------------------\n| OS               | Ubuntu* 20.04\n| Hardware         | Compatible with Intel® oneAPI Video Processing Library(oneVPL) GPU implementation, which can be found at https://github.com/oneapi-src/oneVPL-intel-gpu \n| Software         | Intel® oneAPI Video Processing Library(oneVPL) CPU implementation and Intel® - OpenVINO 2022.2\n\n## How to build the sample\n\n### Install OpenVINO toolkits 2022.2 from achieved package\n1) Download and install OpenVINO C++ runtime:\nhttps://docs.openvino.ai/latest/openvino_docs_install_guides_installing_openvino_from_archive_linux.html\n2) Configurations for Intel® Processor Graphics (GPU):\nhttps://docs.openvino.ai/latest/openvino_docs_install_guides_configurations_for_intel_gpu.html#gpu-guide\n3) Install the OpenVINO Developtment tools:\n```shell\npip install openvino-dev[tensorflow2,onnx]\n```\n\n### Install environment package prerequisites (optional)\n```shell\napt update \u0026\u0026 \\\n    apt install --no-install-recommends -q -y software-properties-common gnupg wget sudo unzip libnss3-tools ncurses-term python3-pip\n```\n\n### Install Intel graphics stack packages from Agama\n```shell\nwget https://repositories.intel.com/graphics/intel-graphics.key \u0026\u0026 \\\n    apt-key add intel-graphics.key \u0026\u0026 \\\n    apt-add-repository 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main' \u0026\u0026 \\\n    apt update \u0026\u0026 \\\n    apt install -y libmfx1 libmfxgen1 vainfo intel-opencl-icd intel-level-zero-gpu level-zero intel-media-va-driver-non-free python3.9\n```\n\n### Install Dev package\n```shell\napt install -y cmake build-essential libva-dev libdrm-dev net-tools pkg-config libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev level-zero-dev opencl-headers build-essential\n```\n\nOr you can follow this instruction to install the driver package for a discrete GPU device.\nhttps://dgpu-docs.intel.com/index.html\n\n### Install oneVPL devkit package from oneAPI\n```shell\nwget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \u0026\u0026 \\\n    apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \u0026\u0026 \\\n    echo \"deb https://apt.repos.intel.com/oneapi all main\" | tee /etc/apt/sources.list.d/oneAPI.list \u0026\u0026 \\\n    apt update \u0026\u0026 apt install -y intel-oneapi-onevpl-devel  \n```\n\n### Configure the Environment\n1) OpenVINO:\n```shell\nsource \u003cINSTALL_DIR\u003e/setupvars.sh\n```\n2) oneAPI:\n```shell\nsource /opt/intel/oneapi/setvars.sh\n```\n\n3） Build the source code\n```\nmkdir build\ncd build\ncmake -DCMAKE_BUILD_TYPE=Release ..\ncmake --build .\n```\n\nTips: To trigger dGPU, you have to switch the code as below:\nhttps://github.com/OpenVINO-dev-contest/decode-infer-on-GPU/blob/main/multi_src/decode_vpp.h#L252\n\nfrom\n```\nfd = open(\"/dev/dri/renderD128\", O_RDWR);\n```\nto\n```\nfd = open(\"/dev/dri/renderD129\", O_RDWR);\n```\n\n### Download test model\nDownload the vehicle detection model from OpenVINO model zoo\n```\nomz_downloader --name vehicle-detection-0200\n```\n\n### Run the program\n- For single source \n```\n./single_src/single_source -i ../content/cars_320x240.h265 -m ~/vehicle-detection-0200/FP32/vehicle-detection-0200.xml \n```\n- For multiple source \n```\n./multi_src/multi_source -i ../content/cars_320x240.h265,../content/cars_320x240.h265,../content/cars_320x240.h265 -m ~/vehicle-detection-0200/FP32/vehicle-detection-0200.xml -bs 2 -nr 4\n```\n\n- -i = Path to one or multiple input video files, separated by comma;\n- -m = Path to IR .xml file;\n- -bs = Batch size;\n- -nr = Number of inference requests;\n- -ns = Number of GPU streams;\n- -fr = Number of frame to be decoded for each input source;\n\nTips: Since the sample has been set the number of stream as 1, the number of infer request should be larger than 1.\n\n## Example of Output\nIn this sample, you will get the inference result according to stream id of input source.\n```\nlibva info: VA-API version 1.12.0\nlibva info: Trying to open /opt/intel/mediasdk/lib64/iHD_drv_video.so\nlibva info: Found init function __vaDriverInit_1_12\nlibva info: va_openDriver() returns 0\nImplementation details:\n  ApiVersion:           2.7  \n  Implementation type:  HW\n  AccelerationMode via: VAAPI\n  Path: /usr/lib/x86_64-linux-gnu/libmfx-gen.so.1.2.7\n\nFrames [stream_id=1] [stream_id=0]\nimage0: bbox 204.99, 49.43, 296.43, 144.56, confidence = 0.99805\nimage0: bbox 91.26, 115.56, 198.41, 221.69, confidence = 0.99609\nimage0: bbox 36.50, 44.75, 111.34, 134.57, confidence = 0.98535\nimage0: bbox 77.92, 72.38, 155.06, 164.30, confidence = 0.97510\nimage1: bbox 204.99, 49.43, 296.43, 144.56, confidence = 0.99805\nimage1: bbox 91.26, 115.56, 198.41, 221.69, confidence = 0.99609\nimage1: bbox 36.50, 44.75, 111.34, 134.57, confidence = 0.98535\nimage1: bbox 77.92, 72.38, 155.06, 164.30, confidence = 0.97510\nFrames [stream_id=1] [stream_id=0]\nimage0: bbox 206.96, 50.41, 299.54, 146.23, confidence = 0.99805\nimage0: bbox 93.81, 115.29, 200.86, 222.94, confidence = 0.99414\nimage0: bbox 84.15, 92.91, 178.14, 191.82, confidence = 0.99316\nimage0: bbox 37.78, 45.82, 113.29, 132.28, confidence = 0.98193\nimage0: bbox 75.96, 71.88, 154.31, 164.54, confidence = 0.96582\nimage1: bbox 206.96, 50.41, 299.54, 146.23, confidence = 0.99805\nimage1: bbox 93.81, 115.29, 200.86, 222.94, confidence = 0.99414\nimage1: bbox 84.15, 92.91, 178.14, 191.82, confidence = 0.99316\nimage1: bbox 37.78, 45.82, 113.29, 132.28, confidence = 0.98193\nimage1: bbox 75.96, 71.88, 154.31, 164.54, confidence = 0.96582\n...\ndecoded and infered 60 frames\nTime = 0.328556s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenvino-dev-samples%2Fdecode-infer-on-GPU","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenvino-dev-samples%2Fdecode-infer-on-GPU","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenvino-dev-samples%2Fdecode-infer-on-GPU/lists"}