1
0
Fork 0
Commit Graph

77 Commits

Author SHA1 Message Date
Diego Felix de Souza 1f265aa91d avcodec/nvenc: Multi NVENC Split Frame Encoding in HEVC and AV1
When Split frame encoding is enabled, each input frame is partitioned into
horizontal strips which are encoded independently and simultaneously by
separate NVENCs, usually resulting in increased encoding speed compared to
single NVENC encoding.

Signed-off-by: Diego Felix de Souza <ddesouza@nvidia.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2024-04-13 18:00:43 +02:00
Timo Rothenpieler 271a0a55bc avcodec/nvenc: provide nvenc with monotonic frame index 2024-04-01 00:46:12 +02:00
Timo Rothenpieler 21b4708969 avcodec/nvenc: add support for unidirectional b-frames 2024-03-31 21:32:55 +02:00
Timo Rothenpieler a270966118 avcodec/nvenc: add support for uhq tune 2024-03-31 21:17:11 +02:00
Timo Rothenpieler 77d23bcb1b avcodec/nvenc: add support for lookahead_level 2024-03-31 20:58:27 +02:00
Timo Rothenpieler 64e3fc9069 avcodec/nvenc: add support for HEVC temporal filtering 2024-03-31 20:47:59 +02:00
Timo Rothenpieler 06c2a2c425 avcodec/nvenc: support SDK 12.2 bit depth API 2024-03-31 19:10:49 +02:00
James Almer 67e7f0b05e avutil: remove deprecated FF_API_REORDERED_OPAQUE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
Timo Rothenpieler e006680d8e avcodec/nvenc: add option to control subsampling of packed rgb input 2023-10-09 20:17:44 +02:00
Aleksoid 7eb0d9e905 avcodec/nvenc: add option to limit slice size 2023-08-22 23:46:11 +02:00
Timo Rothenpieler 16fdb48e0d avcodec/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-06-16 22:10:42 +02:00
Timo Rothenpieler 6c418ae25e Revert "lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE"
The implementation is flawed in that the frame opaque data is not in
fact correctly reordered along with the packets, but is being output in
packet input order, just like the dts are.

This reverts commit 3553809703.
2023-06-16 22:10:42 +02:00
Timo Rothenpieler d2b46c1ef7 avcodec/nvenc: stop using deprecated rc modes with SDK 12.1 2023-06-01 23:47:14 +02:00
Anton Khirnov 3553809703 lavc/nvenc: handle frame durations and AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE 2023-01-29 09:23:17 +01:00
Timo Rothenpieler 5c288a44ad avcodec/nvenc: add AV1 encoding support
The encoder seems to be trading blows with hevc_nvenc.
In terms of quality at low bitrate cbr settings, it seems to
outperform it even. It produces fewer artifacts and the ones it
does produce are less jarring to my perception.

At higher bitrates I had a hard time finding differences between
the two encoders in terms of subjective visual quality.

Using the 'slow' preset, av1_nvenc outperformed hevc_nvenc in terms
of encoding speed by 75% to 100% while performing above tests.

Needless to say, it always massively outperformed h264_nvenc in terms
of quality for a given bitrate, while also being slightly faster.
2022-11-05 21:17:37 +01:00
Anton Khirnov 587545c9e0 lavc/nvenc: switch to the new FIFO API 2022-02-07 00:31:23 +01:00
Limin Wang 0c8741f819 avcodec/nvenc: add udu_sei option to import user data unregistered SEIs
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-12-25 14:12:26 +01:00
Limin Wang 75001ae844 avcodec/nvenc: add constrainedFrame encoding support
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-09-06 14:25:26 +02:00
Limin Wang 3756525a59 avcodec/nvenc: add single slice intra refresh support
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-09-06 14:13:00 +02:00
Limin Wang e6bd5171ac avcodec/nvenc: add intra refresh support
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-09-06 14:12:57 +02:00
Ricardo Monteiro e56f6e59b6 avcodec/nvenc: add chroma qp offset support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-08-08 01:56:32 +02:00
Timo Rothenpieler 8bcce5673a avcodec/nvenc: add option to disable all extra SEI data
With these triggering a lot of crashes recently, an option to globally
disable all of them is added as a tool to work around those crashes in
case the SEI data is not needed by the user.

Also re-enables s12m for hevc_nvenc, since the issue is not specifically
with that, but it affects all SEI data.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-06-06 22:01:56 +02:00
Brad Hards 63948a6170 avcodec/nvenc: use persistent sei data buffer
Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-06-04 18:24:49 +02:00
Timo Rothenpieler 988f2e9eb0 avcodec/nvenc: fix lossless tuning logic
Relying on the order of the enum is bad.
It clashes with the new presets having to sit at the end of the list, so
that they can be properly filtered out by the options parser on builds
with older SDKs.

So this refactors nvenc.c to instead rely on the internal NVENC_LOSSLESS
flag. For this, the preset mapping has to happen much earlier, so it's
moved from nvenc_setup_encoder to nvenc_setup_device and thus runs
before the device capability check.
2021-04-18 11:39:45 +02:00
Mark Thompson cd322794ee lavc: Mark hw_config pointer arrays as const
They are read-only just like the HWConfig structures they point to.
2020-11-08 18:54:42 +00:00
Timo Rothenpieler 1bf86ee907 avcodec/nvenc: removed unused and deprecated field 2020-10-21 18:47:30 +02:00
Timo Rothenpieler 11a8e93681 avcodec/nvenc: use alias to provide deprecated profiles 2020-10-21 18:03:45 +02:00
Timo Rothenpieler 3223f6b32d avcodec/nvenc: add new h264 levels from Video SDK 10
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-07-01 16:10:00 +02:00
Roman Arzumanyan 9115d77222 avcodec/nvenc: add new Video SDK 10 features
1. new Nvenc presets
2. new multipass encode modes
3. low delay key frame scale

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-07-01 16:10:00 +02:00
Timo Rothenpieler 9aef4ae975 avcodec/nvenc: rename tc option to something more unique
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-06-30 19:03:56 +02:00
Limin Wang fdead2a31a avcodec/nvenc: support for HEVC timecode passthrough
Reviewed-by:   Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-28 21:40:49 +08:00
James Almer 827d6fe73d avcodec/encode: restructure the core encoding code
This commit follows the same logic as 061a0c14bb, but for the encode API: The
new public encoding API will no longer be a wrapper around the old deprecated
one, and the internal API used by the encoders now consists of a single
receive_packet() callback that pulls frames as required.

amf encoders adapted by James Almer
librav1e encoder adapted by James Almer
nvidia encoders adapted by James Almer
MediaFoundation encoders adapted by James Almer
vaapi encoders adapted by Linjie Fu
v4l2_m2m encoders adapted by Andriy Gelman

Signed-off-by: James Almer <jamrial@gmail.com>
2020-06-18 17:11:37 -03:00
Timo Rothenpieler 9ce7de9038 avcodec/nvenc: refactor dts calculation logic
The old approach used some highly complex delta computation math and
output-delaying.
I do not remember what the initial reasoning behind that was, but given
that we can just offset the dts by the amount of bframes, it seems wholy
unnecessary.

This leaves open an issue with VFR content, for which some more complex
logic might be needed.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-05-02 01:33:49 +02:00
Mark Thompson 1dff97b7bc avcodec/nvenc: add hardware config metadata
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2020-04-27 23:06:06 +02:00
Philip Langdale 3ea7057677 nvenc: implement flush to help allow an encoder to be re-used
It can be useful to re-use an encoder instance when doing segmented
encodings, and this requires flushing the encoder at the start of
each segment.
2020-01-08 19:20:36 -08:00
Timo Rothenpieler ab0ef1abdf avcodec/nvenc: make use of new GetLastErrorString function
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Timo Rothenpieler 51a23343d9 avcodec/nvenc: pass CUstream to nvenc when available
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Roman Arzumanyan 567b5e33d9 avcodec/nvenc: add multiple reference frames support
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Timo Rothenpieler e929b2f248 avcodec/nvenc: switch to dedicated dpb_size option
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-09-27 20:00:59 +02:00
Roman Arzumanyan f1f66df6a2 avcodec/nvenc: add b_as_ref support for HEVC
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2019-02-14 13:22:09 +01:00
Timo Rothenpieler dc2d56a66b avcodec/nvenc: add option to turn off a53 closed caption embedding 2018-08-21 15:14:56 +02:00
pkviet 155375123c avcodec/nvenc: support dynamic bitrate changes
The patch enables dynamic bitrate through ReconfigureEncoder method
from nvenc API.
This is useful for live streaming in case of network congestion.

Signed-off-by: pkviet <pkv.stream@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-05-04 23:35:38 +02:00
Timo Rothenpieler 9f3902f107 avcodec/nv{enc,dec}: use sane version checking macro
For some odd reason, the Nvidia version macros puts the minor version in
the msb, so comparing against it is impossible.
2018-04-13 11:19:43 +02:00
Timo Rothenpieler 86e9dba8fa avcodec/nvenc: add support for B frames as ref 2018-04-11 14:55:28 +02:00
Timo Rothenpieler 27cbbbb33f compat: remove in-tree NVidia headers
External headers are no longer welcome in the ffmpeg codebase because they
increase the maintenance burden. However, in the NVidia case the vanilla
headers need some modifications to be usable in ffmpeg therefore we still
provide them, but in a separate repository.

The external headers can be found at
https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git

Fate-source is updated because of the deleted files, and dynlink_loader.h
license headers were updated with the standard FFmpeg headers.

Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-02-27 16:22:12 +01:00
Timo Rothenpieler bbe1b21022 avcodec/nvenc: refcount input frame mappings
If some logic like vsync in ffmpeg.c duplicates frames, it might pass
the same frame twice, which will result in a crash due it being
effectively mapped and unmapped twice.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-01-28 12:29:24 +01:00
Mark Thompson 3fbd4fc476 nvenc: Include config.h before checking for D3D11 support
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-11-26 15:40:24 +00:00
Timo Rothenpieler 15b019e40a avcodec/nvenc: fix double defined GUID on cygwin 2017-11-17 23:34:18 +01:00
Hendrik Leppkes bff6d98ba3 nvenc: support d3d11 surface input 2017-11-15 10:35:44 +01:00
Timo Rothenpieler a56d0497cb avcodec/nvenc: migrate to new encode API
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-09-07 12:08:32 +02:00