# Hardware acceleration Hardware accelerated encoding/decoding can be used in encore if it is supported in the ffmpeg executable used. ## Encoding To use hardware accelerated encoding, prepare an encoding profile with a `VideoEncode` where the `codec` property is set to the name of a hardware encoders, such as `hevc_nvenc`. See example profile below. ## Decoding To use hardware decoding, the appropriate input parameters must be specified in the encore job. See example job below. For more details on input configuration, see the [Input Configuration](Input-configuration.md#hardware-decoding) guide. ## Hardware filters *Note: Support for hardware filters as described below was added in encore version 0.2.8-4.* Hardware filters can be configured like other filters through the `videoFilters` property of inputs or the `filters` property of a video encode. It is up to the user to make sure that hardware filters are fed with hardware frames by either using hardware decoding (see above) or inserting `hwupload` in the filter chain if necessary. Some filters are inserted automatically by encore. It is possible to configure a profile so that encore uses equivalent hardware filters instead. Hardware replacements for `split`, `scale`, `crop`, and `pad` filter can be specified. See example profile below. Specifying hardware equivalents for `scale`, `crop`, and `pad` filters are useful, as encore will then use the hardware filters to scale/crop/pad according to dimensions and aspect ratios configured in the job and/or encoding profiles. ### Hardware split filter Specifying a hardware equivalent for the `split` filter is not useful in most cases, since the standard `split` filter has no problem handling hardware frames. However, some hardware supports custom split filter with extended functionality. The splitFilter property will be treated differently depending on if the values contains a '=' or not. If no '=' is included, the value is treated as the name of the filter to use and something like 'SPLITFILTERVALUE=N[out1][out2]...' will be added to the filtergraph, where N is the number of relevant outputs in the profile. If an '=' is included, the value is assumed to already include the size parameters and something like 'SPLITFILTERVALUE[out1][out2]...' will be added to the filtergraph. Care must be taken in this case to ensure that the size parameters match the number of relevant outputs in the profile. This latter form of specifying the split filter can be useful for certain custom split filters that allow extra parameters, ie ni_quadra_split filter for netint quadra cards which allows access to scaled output from the decoder. ## Examples ### Cuda/nvenc encoding profile ``` name: nvenc-test description: "NVENC HEVC profile Note: This profile requires encore version 0.2.8-4 or later. This profile requires using cuda hardware decoding by specifying cuda hardware decoding on the input by setting parameters as below \"params\": { \"hwaccel\": \"cuda\", \"hwaccel_output_format\": \"cuda\" } " scaling: bicubic filterSettings: scaleFilter: scale_cuda scaleFilterParams: format: p010le padFilter: pad_cuda encodes: - type: VideoEncode codec: hevc_nvenc format: mp4 suffix: _h265_2600 twoPass: false height: 1080 params: b:v: 2600k maxrate: 3900k bufsize: 5200k r: 25 profile:v: main10 tag:v: hvc1 force_key_frames: expr:not(mod(n,96)) audioEncode: type: AudioEncode codec: aac bitrate: 192k suffix: STEREO ``` ### Cuda/nvenc encore job Example job below using cuda hardware acceleration for decoding, and hardware decoding (hevc_nvenc) through the encoding profile above. ``` { "profile": "nvenc-test", "outputFolder": "/output/folder/example/", "baseName": "example-hw-acceleration", "inputs": [ { "uri": "/videos/example.mp4", "type": "AudioVideo", "params": { "hwaccel": "cuda", "hwaccel_output_format": "cuda" } } ] } ```