> -----Original Message----- > From: myp...@gmail.com [mailto:myp...@gmail.com] > Sent: Tuesday, April 23, 2019 13:42 > To: FFmpeg development discussions and patches <ffmpeg- > de...@ffmpeg.org> > Cc: Fu, Linjie <linjie...@intel.com> > Subject: Re: [FFmpeg-devel] [PATCH] lavc/vaapi_encode_h264: add support > for maxframesize > > On Tue, Apr 23, 2019 at 11:29 AM Linjie Fu <linjie...@intel.com> 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 > > > Some question list as follow: > > 1. Can I change delta_qp per pass, e,g, 4 pass 1, 2, 3, 4, use > delta_qp[4] like: 1, 2, 4, 8?
Yes, it's available. Actually I considered this whether to expose the detailed settings for the user, And end up with current solution: - setting max_frame_size only will use default 4 passes with delta_qp = {1, 1, 1, 1} - setting max_frame_size with detailed pass_num and delta_qp Can be customized by user. Not splitting delta_qp setting for each pass is trying to make it easier for users. > 2. So let's think about the limiting case, if we setting > max_frame_size = 1 for 1080P, what's the action for this driver? Maybe the commit message is a little bit confusing, driver will adjust add delta_qp to original qp to decrease the frame size for each pass: new_qp = base_qp + delta_qp[0] If the frame size is still too big, will try 2 passes new_qp = base_qp + delta_qp[0] + delta_qp[1] If the frame size is still too big after 4 passes qp modification, driver will use max qp allowed by the sum of delta_qp; new_qp = base_qp + delta_qp[0] + delta_qp[1] + delta_qp[2] + delta_qp[3] > 3. Maybe we can hide the pass_num and delta_qp, only export the > max_frame_size for this case? I don't think export the driver QP > adjustment detail logic to user space is good idea, user will > confused about to how to set/adjust pass_num/delta_qp per pass. Similar with 1, I think a default path with a valuable set of parameters(Needs advice), together with a customizing method is good. > 4. Missing docs Will refine the commit message, and a doc if still needed. > 5. What's the relationship about other bit rate control like VBR or MBBRC ? IMHO, max frame size will modify the qp value set by bit rate control methods, and trying to meet the size limitation for each frame. > 6. Only 264 encoder support this feature? What platform have you tested? Yes, only AVC encoder can be supported by iHD driver, and tested in KBL. Thanks for the comment. Linjie _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".