Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org>
To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org>
Cc: "Wu, Tong1" <tong1.wu@intel.com>, "Chen, Wenbin" <wenbin.chen@intel.com>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/qsvenc: make QSV encoder encode VAAPI and D3D11 frames directly
Date: Thu, 9 Jun 2022 06:47:42 +0000
Message-ID: <ef3225ba199a2687961322264a2ea4ee78372229.camel@intel.com> (raw)
In-Reply-To: <DM8P223MB036570CD9A96ED1543974391BAA49@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>

On Wed, 2022-06-08 at 11:13 +0000, Soft Works wrote:
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Xiang,
> > Haihao
> > Sent: Wednesday, June 8, 2022 10:42 AM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Wu, Tong1 <tong1.wu@intel.com>; Chen, Wenbin <wenbin.chen@intel.com>
> > Subject: Re: [FFmpeg-devel] [PATCH] avcodec/qsvenc: make QSV encoder encode
> > VAAPI and D3D11 frames directly
> > 
> > On Wed, 2022-06-08 at 05:08 +0000, Soft Works wrote:
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Tong
> > > > Wu
> > > > Sent: Tuesday, June 7, 2022 11:22 AM
> > > > To: ffmpeg-devel@ffmpeg.org
> > > > Cc: Tong Wu <tong1.wu@intel.com>; Wenbin Chen <wenbin.chen@intel.com>
> > > > Subject: [FFmpeg-devel] [PATCH] avcodec/qsvenc: make QSV encoder encode
> > > > VAAPI
> > > > and D3D11 frames directly
> 
> [..]
> 
> > > > 2.35.1.windows.2
> > > 
> > > Hi,
> > > 
> > > thanks for submitting this patch. Though, I'm afraid, but this
> > > 
> > > - fundamentally contradicts the logic of ffmpeg's handling of hw
> > 
> > acceleration,
> > >   hw device and hw frames contexts
> > > - adds code to an encoder, doing things an encoder is not supposed to do-
> > 
> > qsv
> > > encoders and decoders have their own context => QSV
> > 
> > nvdec and nvenc have CUDA but nvenc can also support D3D11va, it sounds make
> > sense for me to support D3D11va/vaapi in qsvenc too as d3d11va/vaapi are
> > used
> > internally in MediaSDK.
> 
> Can you please post a command line showing nvenc working with input
> from a D3D11VA decoder and without using any hwmap/hwupload/hwdownload
> filters?
> 

According to the code below, nvenc may accept d3d11 frames directly,

https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvenc.c#L46-L72

so the command below should work

$> ffmpeg -y -hwaccel_output_format d3d11 -hwaccel d3d11va -i input.mp4 -c:v
hevc_nvenc out.mp4 

> 
> > 
> > > - is not safe/guaranteed to work always
> > >   there are different requirements for QSV than for other other cases
> > >   like VAAPI - for example: QSV requires a fixed-size frame pool
> > >   and encoders often need a larger frame pool than VAAPI
> > > 
> > 
> > Encoders in MediaSDK don't need a fixed pool, probably we may relax this
> > limitation in QSV.
> 
> Well - I think they do:
> 
> Common
> The QSV hw frames context implementation is using a fixed pool size and
> changing that would be anything but trivial. 
> 
> D3D11
> The decoders are using and allocating a D3D11 array textures which cannot 
> be resized. When the surface count is too low, QSV encoding will fail.
> 
> VAAPI
> See vaapi_frames_init(): there is support for dynamically sized pools, but
> not as render targets.
> 
> 
> The actual problem though is not about fixed vs dynamic pool size - it's
> about whether the number of frames will be sufficient for encoding.
> And when try to use the (d3d11va) decoder's output frames and supply them
> to the encoder, they may very likely be insufficient.
> 
> 
> QSV encoding always requires quite a number of surfaces.
> You might remember all the extra_hw_frames parameters in the sample
> command lines: 
> 
> https://trac.ffmpeg.org/wiki/Hardware/QuickSync
> 
> -------------
> 
> Did you ever test this with a D3D11VA decoder on Windows? 
> I'm not sure whether this can work at all (feeding decoder frames
> into the encoder) due to the differing bind_flags requirements.
> 
> In case you did test that - could you please post the command line?

vaapi on Linux:

$ ffmpeg -y -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -c:v
hevc_qsv out.mp4

d3d11va on Windows:

$ ffmpeg.exe -y -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -c:v
h264_qsv -y out.mp4


Thanks
Haihao

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-06-09  6:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  9:22 Tong Wu
2022-06-07  9:33 ` Anton Khirnov
2022-06-08  4:47   ` Wu, Tong1
2022-06-13  9:07   ` Anton Khirnov
2022-06-15  2:54     ` Wu, Tong1
2022-06-08  5:08 ` Soft Works
2022-06-08  8:41   ` Xiang, Haihao
2022-06-08 11:13     ` Soft Works
2022-06-09  6:47       ` Xiang, Haihao [this message]
2022-06-10 23:54         ` Soft Works
2022-06-15  2:48           ` Wu, Tong1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef3225ba199a2687961322264a2ea4ee78372229.camel@intel.com \
    --to=haihao.xiang-at-intel.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=tong1.wu@intel.com \
    --cc=wenbin.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git