[FFmpeg-devel] [PATCH] avcodec/nvenc: add udu_sei option to import user data unregistered SEIs

lance.lmwang at gmail.com lance.lmwang at gmail.com
Fri Dec 24 16:47:15 EET 2021


On Fri, Dec 24, 2021 at 03:00:10PM +0100, Timo Rothenpieler wrote:
> On 24.12.2021 05:32, lance.lmwang at gmail.com wrote:
> > From: Limin Wang <lance.lmwang at gmail.com>
> > 
> > Note:
> > nvenc sdk will truncated user data unregistered SEI if the size > 503.
> > for example, hardcode its size to 504, trace_headers will report below error:
> > Invalid SEI message: payload_size too large (504 504 bytes).
> 
> I'm amazed it even does that now.
> Last time I tested this, encoding straight up failed if the SEI data was too
> large, since the allocated packet output buffer has a fixed size, and no API
> to influence that size exists.

I'm not sure whether it's for the sdk version, I'm using
nv-codec-headers(sdk/11.0) and encoding is OK, but I can't
find any user data unregistered SEIs although my testing
is created by libx264(default the data has encoding information 
by the UDU SEIs, its size > 503 always). So I using trace_headers
to trace the output and find out it's truncated.

> 
> Disabling unregistered SEIs by default is probably a good call, given 99% of
> the time it'll lead to unexpected failures and is not actually intended or
> used by the user.

Yes, if it's not truncated, you'll see the x264 encoding setting after using
h264_nvenc encoding with libx264 encoding file, it's very misleading in fact.
 
> 
> It IS technically an API break though, so not 100% sure on this.

It's introduced by commit: cee9f9628fb, it's not correct to import 
unregistered SEIs to output default and the patch try to fix that.
We can bump the minor version for the API change.

> Ideally it'd be possible to just increase the buffer size, so the SEI data
> fits.
> 
> Where exactly did you see this 503 byte truncation happening?

You can tested with libx264 output file, the size of unregistered SEIs(for encoding
setting) will > 503 always, if you don't make the size <= 503, you'll see below
error by trace_eaders filter.  
Invalid SEI message: payload_size too large (xxx 504 bytes).

Note,  libavcodec/cbs_sei_syntax_template.c line 262, I print out "get_bits_left(rw) / 8".

I think the buffer size is OK, but nvenc sdk truncate the data after encoding.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


-- 
Thanks,
Limin Wang


More information about the ffmpeg-devel mailing list