[FFmpeg-devel] [PATCH] lavc/vaapi_encode_h264: add support for maxframesize

Michael Niedermayer michael at niedermayer.cc
Wed Apr 24 01:31:31 EEST 2019


On Tue, Apr 23, 2019 at 11:29:17AM +0800, Linjie Fu wrote:
> Add support for max frame size:
>     - max_frame_size (bytes) to indicate the allowed max frame size.
>     - pass_num to indicate number of passes.
>     - delta_qp to indicate adjust qp value.
> 
> Currently only AVC encoder can support this settings in multiple pass case.
> If the frame size exceeds, the encoder will do more pak passes to adjust the
> QP value to control the frame size.
> 
> Set Default num_passes to 4 (1~4), set delta_qp[4] = {1, 1, 1, 1}, use
> new_qp for encoder if frame size exceeds the limitation:
>     new_qp = base_qp + delta_qp[0] + delta_qp[1] + ...
> 
> ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \
>         -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \
>         -c:v h264_vaapi -profile:v main -g 30 -bf 3 -max_frame_size 40000 \
>         -pass_num 2 -delta_qp 2 -vframes 100 -y ./max_frame_size.h264
> 
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
>  libavcodec/vaapi_encode.c      | 46 ++++++++++++++++++++++++++++++++++
>  libavcodec/vaapi_encode.h      | 11 ++++++++
>  libavcodec/vaapi_encode_h264.c | 15 +++++++++++
>  3 files changed, 72 insertions(+)

fails to build

CC	libavcodec/vaapi_encode.o
In file included from libavcodec/vaapi_encode.c:27:0:
libavcodec/vaapi_encode.h:280:9: error: unknown type name ‘VAEncMiscParameterBufferMultiPassFrameSize’
         VAEncMiscParameterBufferMultiPassFrameSize mfs;
         ^
libavcodec/vaapi_encode.c: In function ‘vaapi_encode_init_max_frame_size’:
libavcodec/vaapi_encode.c:1660:33: error: ‘VAEncMiscParameterTypeMultiPassFrameSize’ undeclared (first use in this function)
     ctx->mfs_params.misc.type = VAEncMiscParameterTypeMultiPassFrameSize;
                                 ^
libavcodec/vaapi_encode.c:1660:33: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/vaapi_encode.c:1661:24: error: request for member ‘type’ in something not a structure or union
     ctx->mfs_params.mfs.type = VAEncMiscParameterTypeMultiPassFrameSize;
                        ^
libavcodec/vaapi_encode.c:1662:24: error: request for member ‘max_frame_size’ in something not a structure or union
     ctx->mfs_params.mfs.max_frame_size = max_frame_size;
                        ^
libavcodec/vaapi_encode.c:1663:24: error: request for member ‘num_passes’ in something not a structure or union
     ctx->mfs_params.mfs.num_passes = num_passes;
                        ^
libavcodec/vaapi_encode.c:1664:24: error: request for member ‘delta_qp’ in something not a structure or union
     ctx->mfs_params.mfs.delta_qp = delta_qp;
                        ^
make: *** [libavcodec/vaapi_encode.o] Error 1
CC	libavcodec/vaapi_encode_h264.o
In file included from libavcodec/vaapi_encode_h264.c:36:0:
libavcodec/vaapi_encode.h:280:9: error: unknown type name ‘VAEncMiscParameterBufferMultiPassFrameSize’
         VAEncMiscParameterBufferMultiPassFrameSize mfs;
         ^
make: *** [libavcodec/vaapi_encode_h264.o] Error 1
CC	libavcodec/vaapi_encode_mpeg2.o
In file included from libavcodec/vaapi_encode_mpeg2.c:28:0:
libavcodec/vaapi_encode.h:280:9: error: unknown type name ‘VAEncMiscParameterBufferMultiPassFrameSize’
         VAEncMiscParameterBufferMultiPassFrameSize mfs;
         ^
make: *** [libavcodec/vaapi_encode_mpeg2.o] Error 1
make: Target `all' not remade because of errors.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190424/e89c8300/attachment.sig>


More information about the ffmpeg-devel mailing list