File: README.md

package info (click to toggle)
libvpl 1%3A2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,580 kB
  • sloc: cpp: 92,604; ansic: 6,176; python: 4,312; sh: 323; makefile: 7
file content (139 lines) | stat: -rw-r--r-- 5,234 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# `hello-sharing-vaapi` Sample

This sample shows how to use the Intel Video Processing Library (Intel VPL) 2.X common API to :
- Perform video encode for a VA-API surface with surface sharing.
- Perform video decode and export mfxFrameSurface1 from Intel VPL to a VA-API surface with surface sharing.

| Optimized for    | Description
|----------------- | ----------------------------------------
| OS               | Ubuntu* 20.04/22.04;
| Hardware         | Compatible with Intel VPL GPU implementation, which can be found at https://github.com/intel/vpl-gpu-rt 
| What You Will Learn | How to use Intel VPL to encode a VA-API surface to H.265 and decode an H.265 encoded video file and save raw frame using VA-API surface sharing
| Time to Complete | 10 minutes


## Purpose

This sample has two command line applications:
- `hello-sharing-vaapi-import`: takes a file containing a raw format video elementary stream as an argument. The application creates a VA-API surface based on the input video stream to be able to illustrate VAAPI surface sharing encoding. Using Intel VPL, the application encodes the VA-API surface and writes the encoded output to `a out.h265` in H.265 format. Native raw frame input format: GPU=NV12.
- `hello-sharing-vaapi-export`: takes a file containing an H.265
video elementary stream as an argument. Using Intel VPL, the application decodes, exports mfxFrameSurface1 to a VA-API surface and writes the decoded surface to a file `out.raw` in raw format. Native raw frame output format: GPU=NV12.

## Key Implementation details

### `hello-sharing-vaapi-import`

| Configuration     | Default setting
| ----------------- | ----------------------------------
| Target device     | GPU
| Input format      | NV12
| Output format     | H.265 video elementary stream
| Output resolution | same as the input

### `hello-sharing-vaapi-export`

| Configuration     | Default setting
| ----------------- | ----------------------------------
| Target device     | GPU
| Input format      | H.265 video elementary stream
| Output format     | NV12
| Output resolution | same as the input

## License

Code samples are licensed under the MIT license.

## Building the `hello-sharing-vaapi` Project

### Include Files
The Intel VPL include folder is located at these locations on your development system:
 - Windows: <vpl_install_dir>\include 


### On a Linux* System

Perform the following steps:

1. Install prerequisites. To build and run the sample you need to
   install prerequisite software and set up your environment:

   - Follow the steps in [install.md](https://github.com/intel/libvpl/blob/master/INSTALL.md) or install libvpl-dev. 
   - Follow the steps in [dgpu-docs](https://dgpu-docs.intel.com/) according to your GPU.
   - Install the packages using following commands:
   ```
   apt update
   apt install -y cmake build-essential pkg-config libva-dev libva-drm2 vainfo
   ```

2. Set up your environment using the following command.
   ```
   source <vpl_install_dir>/etc/vpl/vars.sh
   ```
   Here `<vpl_install_dir>` represents the root folder of your Intel VPL
   installation.  If you customized the
   installation folder, it is in your custom location.

3. Build the program using the following commands:
   ```
   mkdir build
   cd build
   cmake .. -DBUILD_EXAMPLES=ON
   cmake --build . --config Release
   ```
> Note: To build just one of the applications, specify `-t` followed by the name of the executable. For instance to build the import application: ```cmake --build . -t hello-sharing-vaapi-import```

## Running the Sample

1. For import, run the program using the following command:
   ```
   ./hello-sharing-vaapi-import -i ../../../content/cars_320x240.nv12 -w 320 -h 240
   ```
   and sample output is shown below:
   ```
   Implementation details:
   ApiVersion:           2.9
   Implementation type:  HW
   AccelerationMode via: VAAPI
   DeviceID:             4682/0
   Path:  <Path>/_build/__bin/Debug/libmfx-gen.so.1.2.9
   
   Encoding ../examples/../content/cars_320x240.nv12-> out.h265
   Input colorspace: NV12
   Encoded 30 frames
   ```
   
   You can find the output file `out.h265` in the build directory.
   
   You can display the output with a video player that supports raw streams such as
   FFplay. You can use the following command to display the output with FFplay:
   
   ```
   ffplay out.h265
   ```
2. For export, run the program using the following command:
   ```
   ./hello-sharing-vaapi-export -i ../../../content/cars_320x240.h265
   ```
   and sample output is shown below:
   ```
   Implementation details:
   ApiVersion:           2.9
   Implementation type:  HW
   AccelerationMode via: VAAPI
   DeviceID:             4682/0
   Path: <Path>/_build/__bin/Debug/libmfx-gen.so.1.2.9
   
   Decoding ../examples/../content/cars_320x240.h265 -> out.raw
   Output colorspace: NV12
   Decoded 30 frames
   ```
   
   You can find the output file `out.raw` in the build directory.
   
   You can display the output with a video player that supports raw streams such as
   FFplay. You can use the following command to display the output with FFplay:
   
   ```
   ffplay -video_size 320x240 -pixel_format nv12 -f rawvideo out.raw
   ```