[FFmpeg-devel] [PATCH v3 2/2] ffmpeg_opt: consider HW acceleration method when selecting decoder

Xiang, Haihao haihao.xiang at intel.com
Mon Aug 1 05:37:17 EEST 2022


On Mon, 2022-08-01 at 02:14 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> > Xiang, Haihao
> > Sent: Monday, August 1, 2022 3:53 AM
> > To: ffmpeg-devel at ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] ffmpeg_opt: consider HW
> > acceleration method when selecting decoder
> > 
> > On Fri, 2022-07-29 at 09:46 +0000, Soft Works wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> > > > Ronald S. Bultje
> > > > Sent: Friday, July 29, 2022 10:50 AM
> > > > To: FFmpeg development discussions and patches <ffmpeg-
> > > > devel at ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH v3 2/2] ffmpeg_opt: consider
> > 
> > HW
> > > > acceleration method when selecting decoder
> > > > 
> > > > Hi,
> > > > 
> > > > On Fri, Jul 29, 2022 at 4:38 PM Xiang, Haihao <
> > > > haihao.xiang-at-intel.com at ffmpeg.org> wrote:
> > > > 
> > > > > libdav1d is the preferred AV1 decoder in FFmpeg, libdav1d is
> > 
> > always
> > > > 
> > > > used
> > > > > when
> > > > > running the command below even if user expects vaapi or other
> > 
> > HW
> > > > > acceleration
> > > > > methods.
> > > > > 
> > > > 
> > > > I think that is a pretty serious issue. Don't we always want to
> > > > prefer a hw
> > > > decoder by default? I agree there should also be ways to force-
> > 
> > select
> > > > specific hw/sw decoders, but shouldn't hw be the default?
> > > 
> > > I don't think that this would be reasonably possible in any way.
> > > There are a lot of questions which ffmpeg cannot answer, e.g.:
> > > 
> > > - Which hwaccel to choose?
> > > - Which hwaccel is available?
> > > - Which parameters are required for selecting a device
> > >   that is working?
> > > - Is the auto-selected device even capable to decode a certain
> > >   input?
> > >   (pixel format, bit depth, codec profile, frame size, ...)
> > > 
> > > For the user who is creating the command line, it is important to
> > > be able to rely on what is going to happen. If they can't command
> > > lines will fail:
> > > 
> > > - The outputs of hw decoders vary. Some output to hw format, some
> > >   to sw format by default. You may need to specify
> > 
> > hwaccel_output_format
> > >   or use hwdownload
> > > - Depending on the hwaccel, a totally different set of filters
> > >   may be required (not to speak of encoders)
> > > - How would you specify that you want a sw decoder instead?
> > > 
> > > IMO, predictability is the topmost important behavioral aspect
> > > for users (be it humans of machines.. ;-)
> > 
> > 
> > I agree with you it would be better not to make hw the default if
> > user doesn't
> > ask for. However '-hwaccel arg' is used to specify hw acceleration
> > method in the
> > examples. According to doc (
> > https://github.com/FFmpeg/FFmpeg/blob/master/doc/ffmpeg.texi#L1260-
> > L1262), a hwdecoder is expected.
> > 
> > "@item -hwaccel[:@var{stream_specifier}] @var{hwaccel}
> > (@emph{input,per-stream})
> > Use hardware acceleration to decode the matching stream(s). "
> > 
> > This patch is to fix the issue that a SW decoder is chosen even if
> > user is
> > expecting a hw method, not to make hw the default in any case.
> > 
> > Thanks
> > Haihao
> > 
> 
> Oh, I'm in no way opposed to your patch, I just talked about the
> idea of a general automatic selection of hardware decoders.
> 

Sorry for misreading your email and thanks for your clarifying. 

> I agree that the behavior for AV1 should be the same as for the other
> decoders.

Thanks, I will push it if no more comment in a few days.

- Haihao



More information about the ffmpeg-devel mailing list