An open API service indexing awesome lists of open source software.

https://github.com/harfang3d/harfang-plugin-ffmpeg

FFmpeg video player plugin for HARFANG 3D framework
https://github.com/harfang3d/harfang-plugin-ffmpeg

cpp ffmpeg harfang3d lua video-plugin

Last synced: about 1 month ago
JSON representation

FFmpeg video player plugin for HARFANG 3D framework

Awesome Lists containing this project

README

        

# FFmpeg video plugin

## Prerequisites

### ● Harfang C++ SDK
The Harfang C++ SDK is only required to build the sample test program.

### ● FFmpeg libraries
You can either use the binary packages from the FFmpeg website or any package manager (apt, pacman, homebrew, chocolatey...).

## Build
Both plugin and sample can be built using CMake and any recent C/C++ compiler (gcc, clang, msvc...).

### ● FFmpeg plugin
To build the plugin, go to the source directory and create a build directory where CMake configuration will be performed.

On Windows, you must defined `FFMPEG_ROOT`. This variable contains the path to the FFmpeg libraries and header files.

```
mkdir build
cd build
cmake .. \
-DFFMPEG_ROOT= \
-DCMAKE_INSTALL_PREFIX=
```

On Linux, do not forget to specify `CMAKE_BUILD_TYPE` or the install will fail. If FFmpeg was installed using the system package manager, there is no need to specify `FFMPEG_ROOT`.
```
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=
```

### ● Test program
The sample program requires Harfang C++ SDK, Asset compiler (assetc) and the FFmpeg plugin (or any video stream plugin).

```
cmake .. -DHG_CPPSDK_PATH= \
-DHG_ASSETC_PATH= \
-DHG_VIDEO_STREAM_PLUGIN= \
-DCMAKE_INSTALL_PREFIX=
```

Once the build is complete, the install directory should contain all the required shared libraries and an executable binary named `hg_vid_play`.

```
hg_vid_play movie.mp4
```

![test program screenshot](screenshot.jpg)

### ● Lua sample
The test directory also contains a lua script ([main.lua](./test/main.lua)). This script maps a video stream onto a spinning cube.
Note that you need the Harfang 3D lua 5.3 to run it.