Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ services:
##### Binary
1. Download a binary release from GitHub, or clone the repository and compile on your machine (e.g. with `GOOS=linux GOARCH=amd64 go build -o plex-dvr-hls-linux-amd64 cmd/main.go`)
2. Create a `config.json` in the working directory and fill in the necessary.
- Possible values for `encoder_profile` are `vaapi`, `video_toolbox`, `omx` and `cpu`. A sample `config.example.json` is available on GitHub.
- Possible values for `encoder_profile` are `vaapi`, `video_toolbox`, `omx`, `nvenc` and `cpu`. A sample `config.example.json` is available on GitHub.
- `nvenc` requires an NVIDIA GPU and ffmpeg with NVENC support. For Docker, see [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html).
3. Create a `channels.json` and fill in the necessary.
- A sample `channels.example.json` is available on GitHub.
4. Copy the `templates` folder from this repository into the working directory (alongside the two JSON files)
Expand Down
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
EncoderProfileVAAPI EncoderProfile = "vaapi"
EncoderProfileVideoToolbox EncoderProfile = "video_toolbox"
EncoderProfileOMX EncoderProfile = "omx"
EncoderProfileNVENC EncoderProfile = "nvenc"
)

type Config struct {
Expand All @@ -33,6 +34,8 @@ func (c Config) GetEncoderProfile() EncoderProfile {
return EncoderProfileOMX
case EncoderProfileVideoToolbox:
return EncoderProfileVideoToolbox
case EncoderProfileNVENC:
return EncoderProfileNVENC
}

return EncoderProfileCPU
Expand Down
17 changes: 17 additions & 0 deletions routes/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ func Stream(c *gin.Context) {
"-hwaccel",
"videotoolbox",
)
case config.EncoderProfileNVENC:
ffmpegArgs = append(
ffmpegArgs,
"-hwaccel",
"cuda",
"-hwaccel_output_format",
"cuda",
)
}

ffmpegArgs = append(
Expand Down Expand Up @@ -111,6 +119,15 @@ func Stream(c *gin.Context) {
"h264_omx",
)
break
case config.EncoderProfileNVENC:
ffmpegArgs = append(
ffmpegArgs,
"-c:v",
"h264_nvenc",
"-preset",
"p3",
)
break
default:
ffmpegArgs = append(
ffmpegArgs,
Expand Down