Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional nvidia hardware-accelerated h264_nvenc encoding #251

Merged
merged 3 commits into from
Aug 5, 2020
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
23 changes: 23 additions & 0 deletions .github/workflows/RunTests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run tests

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1']
julia-arch: [x64, x86]
os: [ubuntu-latest, windows-latest, macOS-latest]
exclude:
- os: macOS-latest
julia-arch: x86

steps:
- uses: actions/checkout@v1.0.0
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-runtest@master

2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
ColorTypes = "0.9, 0.10"
FFMPEG = "0.2, 0.3"
FFMPEG = "0.2, 0.3, 0.4"
Glob = "1.2"
ImageCore = "0.8"
ImageTransformations = "0.8"
Expand Down
6 changes: 3 additions & 3 deletions src/encoding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function prepareencoder(firstimg;framerate::Union{Rational, Integer}=30,AVCodecC
apPacket = Ptr{AVPacket}[av_packet_alloc()]
apPacket == [C_NULL] && error("av_packet_alloc() error")

if eltype(firstimg) == UInt8 && (codec_name == "libx264")
if eltype(firstimg) == UInt8 && (codec_name in ["libx264", "h264_nvenc"])
if islossless(AVCodecContextProperties)
if !isfullcolorrange(AVCodecContextProperties)
@warn """Encoding output not lossless.
Expand All @@ -84,7 +84,7 @@ function prepareencoder(firstimg;framerate::Union{Rational, Integer}=30,AVCodecC
end
end
pix_fmt = AV_PIX_FMT_GRAY8
elseif eltype(firstimg) == Gray{N0f8} && (codec_name == "libx264")
elseif eltype(firstimg) == Gray{N0f8} && (codec_name in ["libx264", "h264_nvenc"])
if islossless(AVCodecContextProperties)
if !isfullcolorrange(AVCodecContextProperties)
@warn """Encoding output not lossless.
Expand All @@ -103,7 +103,7 @@ function prepareencoder(firstimg;framerate::Union{Rational, Integer}=30,AVCodecC
will give better playback results"""
end
pix_fmt = AV_PIX_FMT_RGB24
elseif eltype(firstimg) == RGB{N0f8} && (codec_name == "libx264")
elseif eltype(firstimg) == RGB{N0f8} && (codec_name in ["libx264", "h264_nvenc"])
if islossless(AVCodecContextProperties)
@warn """Encoding output not lossless.
libx264 does not support lossless RGB planes. RGB will be downsampled
Expand Down