HW accelerated transcoding with ffmpeg

0

I've made some backups of some blurays using MakeMKV and now I'm trying to transcode the series to reduce the file sizes to something that is a little more reasonable while maintaining as much quality as I can. I've setup a script to do some automated processing of the series and it works, but I was using software based conversion for h264 and it ran fast enough that I never bothered to try using hardware acceleration. Now I've decided that I want to use h265/HEVC and software conversion is way too slow, so I've been trying to configure ffmpeg to use my 1060 to accelerate the process, but I've been having a lot of trouble finding adequate documentation for actually setting this up and configuring quality.

The series is an animation, and it doesn't appear that any precompiled version of ffmpeg supports the animation tuning yet, so I have been manually applying the tunings as specified by the docs. https://x265.readthedocs.io/en/default/presets.html

I am also trying to encode with 10bit output.

I want to use nvdec/cuvid [h264_cuvid] for decoding and hevc_nvenc for encoding.

The command that I was using for the software conversion is:

ffmpeg -i 0.video -c:v libx265 -preset slow -pix_fmt yuv420p10le -crf 16 -x265-params psy-rd=0.4:aq-strength=0.4:deblock=1,1:bframes=10 -an -f mp4 out.mp4

This seems to work, albeit seems to be missing some tunings as the output will lock up on occasion for a few frames, but it also takes an extreme amount of time, even when the preset is set to slow.

After scouring the internet, the following command is what I have come up with:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 0.video -c:v hevc_nvenc -preset slow -profile:v main10 -pix_fmt yuv420p -cq 16 -rc vbr_hq -aq-strength 0.4 -x265-params psy-rd=0.4:deblock=1,1:bframes=10 -an -f mp4 out.mp4

The above has several issues with it. First, running this fails with

[h264 @ 000002979ae4b800] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from '0.video':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1200k tbn, 47.95 tbc
Codec AVOption x265-params (set the x265 configuration using a :-separated list of key=value parameters) specified for output file #0 (out.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 
'Parsed_null_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!

This tells me that I need to use some filters, and based on tidbits I've come across in forums, I should be using hwupload and hwdownload, but I can't seem to figure out what filter I should be using these with. All limited examples I've found use scale_npp, but this filter isn't supported in the build I have and I don't want to scale the video anyways.

The second problem is that I'm not sure how to pass the remaining x265-params to the encoder, currently, I have left them in the command, but as the output states, they are not applied as they are for the x265 library.

To summarize, how can I convert the first command to be fully hardware accelerated?

Any help would be greatly appreciated and thank you in advance!

EDIT:

Would also appreciate it if someone can help me squelch this error message:

[h264 @ 000002979ae4b800] Stream #0: not enough frames to estimate rate; consider increasing probesize

LostSnail

Posted 2019-06-08T07:05:10.787

Reputation: 11

No answers