Commit Graph

14 Commits

Author SHA1 Message Date
Timo Rothenpieler
764f87b6ab avcodec/nvenc: Fix profile parameter handling
It was not possible to set a profile before, the builtin profile
parameter does not seem to work propperly.
To be compatible with libx264, this overlays it with a local parameter
that expects a string, instead of an int, that takes the well known values
"high", "main" or "baseline".

Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-02 14:33:42 +02:00
Timo Rothenpieler
b63c9a9990 avcodec/nvenc: Fix typoed nv_status checks
Thanks to Wyatt Aaron for pointing this out

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-01 11:55:26 +02:00
Philip Langdale
21adb9964e avcodec/nvenc: Need a separate class for each encoder
The encoders can't share a class instance.

Signed-off-by: Philip Langdale <philipl@overt.org>
2015-03-25 15:32:09 -07:00
Philip Langdale
21175d8586 avcodec/nvenc: Add support for H.265 encoding
Sufficiently new nvenc hardware (GM20x or later) has support for H.265
encoding. This works the same as the H.264 encoder except the
codec parameters are different.

Due to the fact that common codec parameters are not shareable, there's
quite a bit of conditional logic you'd wish we could do without, but
such is life.

Signed-off-by: Philip Langdale <philipl@overt.org>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
2015-03-24 21:42:07 -07:00
Timo Rothenpieler
48f7c30bf7 avcodec/nvenc: Drop support for old nvenc api
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-24 17:25:11 +01:00
Philip Langdale
d20df2601f avcodec/nvenc: De-compensate aspect ratio compensation of DVD-like content.
For reasons we are not privy to, nvidia decided that the nvenc encoder
should apply aspect ratio compensation to 'DVD like' content, assuming that
the content is not bt.601 compliant, but needs to be bt.601 compliant. In
this context, that means that they make the following, questionable,
assumptions:

1) If the input dimensions are 720x480 or 720x576, assume the content has
an active area of 704x480 or 704x576.

2) Assume that whatever the input sample aspect ratio is, it does not account
for the difference between 'physical' and 'active' dimensions.

From, these assumptions, they then conclude that they can 'help', by adjusting
the sample aspect ratio by a factor of 45/44. And indeed, if you wanted to
display only the 704 wide active area with the same aspect ratio as the full
720 wide image - this would be the correct adjustment factor, but what if you
don't? And more importantly, what if you're used to ffmpeg not making this kind
of adjustment at encode time - because none of the other encoders do this!

And, what if you had already accounted for bt.601 and your input had the
correct attributes? Well, it's going to apply the compensation anyway!
So, if you take some content, and feed it through nvenc repeatedly, it
will keep scaling the aspect ratio every time, stretching your video out
more and more and more.

So, clearly, regardless of whether you want to apply bt.601 aspect ratio
adjustments or not, this is not the way to do it. With any other ffmpeg
encoder, you would do it as part of defining your input paramters or
do the adjustment at playback time, and there's no reason by nvenc
should be any different.

This change adds some logic to undo the compensation that nvenc would
otherwise do.

nvidia engineers have told us that they will work to make this
compensation mechanism optional in a future release of the nvenc
SDK. At that point, we can adapt accordingly.

Signed-off-by: Philip Langdale <philipl@overt.org>
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 02:32:33 +01:00
Timo Rothenpieler
fb34c580bb avcodec/nvenc: Handle non-square pixel aspect ratios
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-28 06:10:40 +01:00
Timo Rothenpieler
914fd42b8a avcodec/nvenc: Fix b-frame parameter handling
This should behave similar to x264 and other encoders, as it handles a
gop_size of 0 as Intra-Only, while it's still possible to control how
many B-Frames it inserts.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-26 15:39:01 +01:00
Philip Langdale
ff0c559329 nvenc: Propagate desired number of reference frames.
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-24 22:59:54 +01:00
agathah
dac91bb4c3 avcodec/nvenc: set repeatSPSPPS flag for streaming
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-21 13:59:35 +01:00
Timo Rothenpieler
bc3f76779b avcodec/nvenc: Add support for nvenc api version 5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-17 18:24:34 +01:00
agathah
72c61c272c avcodec/nvenc: fix b frame settings
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 16:29:25 +01:00
Timo Rothenpieler
1efdb0a43f avcodec/nvenc: Remove special cases for cygwin
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-25 15:54:26 +01:00
Timo Rothenpieler
2a428db5e2 avcodec: Add NVENC encoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-11 01:06:27 +01:00