Repository navigation
Conversation
… and mirror qsv_h264 values
Basically working: - h264_nvenc - hevc_nvenc Possible optimization: - Even in constant quality mode, a user ceiling bit_rate might be desirable, currently only the maximum is used like in VP8/9: w x h x fps Remaining issues: 1) Muxer issue with h264_nvenc + MKV, ffprobe shows: [h264 @ 0x55ae4dedacc0] sps_id 32 out of range [h264 @ 0x55ae4dedacc0] Invalid nal size 1677734572 [h264 @ 0x55ae4dedacc0] missing picture in access unit with size 40644 Notable: This does not happen with hevc_nvenc Tested: - GNU/Linux Debian 9 - GeForce GTX 950 - BD 1080p source, cropped: Around 70fps h264 + hevc
Adding 'rc-lookahead 32, init_qp 1, spatial_aq 1, aq-strength 8' for h264 and hevc in case of VBR CQ mode, see <https://devtalk.nvidia.com/default/topic/1013152/video-technologies/crf-for-nvenc/post/5179877/#5179877> and NVENC_VideoEncoder_API_ProgGuide.pdf v08 Chapter 8 p27, as well as Table 1 p33.
This reverts commit 0466852.
…mentation
Nvenc patch on Handbrake using libav12.2
Note: I am working w/ ffmpeg 3.4 and all features incl. hevc encoding
are working without flaws.
Only the common 'Invalid nal size' issue w/ h264 remains
in playback.
ffmpeg's nvenc version is more up-to-date and closer to the Nvenc spec,
libav's version is sort of outdated.
While performing this more 'academic' task, it seems that the overall
ffmpeg code is in much better shape, i.e. re-factored code, more modularized,
better error handling. The worst seems to be for libav that contributors
often simply copy/paste ffmpeg patches against it (like this here),
where incompatibilities may exist and therefor bugs beign introduced.
Tested:
- Vanilla libav12.2
- hevc muxer error: 'muxavformat: avformat_write_header failed!'
from within libavformat/mux.c
[01:41:34] encavcodecInit: Trying avcodec option preset = hq
[01:41:34] encavcodecInit: Trying avcodec option rc = vbr
[01:41:34] encavcodecInit: Trying avcodec option cq = 28.00
[01:41:34] encavcodecInit: Trying avcodec option init_qpP = 1
[01:41:34] encavcodecInit: Trying avcodec option init_qpB = 1
[01:41:34] encavcodecInit: Trying avcodec option init_qpI = 1
[01:41:34] encavcodecInit: Trying avcodec option rc-lookahead = 32
[01:41:34] encavcodecInit: Trying avcodec option spatial_aq = 1
[01:41:34] encavcodecInit: Trying avcodec option aq-strength = 8
[hevc_nvenc @ 0x7ff6500c5700] Device 0 [GeForce GTX 950] supports NVENC
[hevc_nvenc @ 0x7ff6500c5700] The variable bitrate rate-control requires the 'qmin' and/or 'qmax' option set.
[01:41:34] encavcodecInit: Unknown avcodec option cq ( = 28.00 )
[01:41:34] encavcodecInit: Unknown avcodec option init_qpP ( = 1 )
[01:41:34] encavcodecInit: Unknown avcodec option init_qpB ( = 1 )
[01:41:34] encavcodecInit: Unknown avcodec option init_qpI ( = 1 )
[01:41:34] encavcodecInit: Unknown avcodec option rc-lookahead ( = 32 )
[01:41:34] encavcodecInit: Unknown avcodec option spatial_aq ( = 1 )
[01:41:34] encavcodecInit: Unknown avcodec option aq-strength ( = 8 )
[01:41:34] muxavformat: avformat_write_header failed!
[01:41:34] work: average encoding speed for job is 0.000000 fps
- h264 encoding/muxer result is visibel has same
player MKV issues 'Invalid nal size' as w/ ffmpeg3.4
- most enhanced Nvenc params not supported in ffmpeg,
- mostly: adaptive constant quality
- visible in above log snippet
- Patched libav12.2: Using ffmpeg3.4 nvenc and cuda set
- hevc muxer error: 'muxavformat: avformat_write_header failed!'
from within libavformat/mux.c, same as w/ vanilla12.2
[02:05:44] encavcodecInit: Trying avcodec option preset = medium
[02:05:44] encavcodecInit: Trying avcodec option profile = main
[02:05:44] encavcodecInit: Trying avcodec option rc = vbr
[02:05:44] encavcodecInit: Trying avcodec option cq = 28.00
[02:05:44] encavcodecInit: Trying avcodec option init_qpP = 1
[02:05:44] encavcodecInit: Trying avcodec option init_qpB = 1
[02:05:44] encavcodecInit: Trying avcodec option init_qpI = 1
[02:05:44] encavcodecInit: Trying avcodec option rc-lookahead = 32
[02:05:44] encavcodecInit: Trying avcodec option spatial_aq = 1
[02:05:44] encavcodecInit: Trying avcodec option aq-strength = 8
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: Loaded version 8.0
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc initialized successfully
[hevc_nvenc @ 0x7f0e90037aa0] 1 CUDA capable devices found
[hevc_nvenc @ 0x7f0e90037aa0] [ GPU #0 - < GeForce GTX 950 > has Compute SM 5.2 ]
[hevc_nvenc @ 0x7f0e90037aa0] supports NVENC
[hevc_nvenc @ 0x7f0e90037aa0] Using global_quality with nvenc is deprecated. Use qp instead.
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: quality 28.000000
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: cqp 3304
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: avg bit_rate 47875324
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: rc >= 0
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: set_vbr def qp_i_p 26
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: set_vbr rcqp qp_inter_p 1
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: set_vbr rcqp qp_intra_p 1
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: set_vbr rcqp qp_inter_p 1
[hevc_nvenc @ 0x7f0e90037aa0] Nvenc: AQ enabled.
[hevc_nvenc @ 0x7f0e90037aa0] Lookahead enabled: depth 32, scenecut enabled, B-adapt disabled.
[02:05:44] muxavformat: avformat_write_header failed!
- h264 OK, same as w/ vanilla libav12.2
- gained enhanced Nvenc options from new ffmpeg files,
see above snippet
This was referenced Nov 2, 2017
Contributor
Author
|
since this was performed just for academic reasons to figure out the quality difference of FFMPEG vs LIBAV, see #974 - and the result is not usable. I hereby close this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@sr55 so this is the more academic patch for libav12.2 with many issues remaining.
One I haven't noted yet is the 'working' h264 case results in return 4, causing the job to remain in the queue while artifacts seem to be OK. This doesn't happen w/ ffmpeg 3.4.
See more details here: cf7c027
I still would prefer ffmpeg over libav, especially after this little patch work,
see my notes in above commit message and README file.