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>
Subject: Re: [FFmpeg-devel] [PATCH v4 1/1] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions
Date: Tue, 11 Jan 2022 07:01:25 +0000
Message-ID: <96e8c643ca0264d8819e14af2dc884162d5455a1.camel@intel.com> (raw)
In-Reply-To: <8c4d65af-49c3-d594-75a9-b78bfc80792d@jkqxz.net>

On Mon, 2022-01-10 at 21:16 +0000, Mark Thompson wrote:
> On 10/01/2022 06:47, Xiang, Haihao wrote:
> > 
> > Hi Mark,
> > 
> > We want to provide a more user friendly command-line to share gfx memory
> > between
> > QSV, VAAPI and other HW methods.
> > 
> > E.g. VAAPI provides sharpness_vaapi but QSV doesn't provide a corresponding
> > filter, we want to use sharpness_vaapi filter on the output from QSV
> > decoders.
> > Currently the first command-line below may work, however the second command
> > line
> > below can't work because QSV device is not derived from a VAAPI device
> > explicitly, so ffmpeg fails to derive VAAPI device from QSV device (it may
> > derive VAAPI device from QSV device in the first case)
> > 
> > $ ffmpeg -init_hw_device vaapi=intel -init_hw_device qsv=qsv@intel -hwaccel
> > qsv
> > -c:v h264_qsv -i input.mp4 -vf hwmap=derive_device=vaapi,sharpness_vaapi -f
> > null
> > -
> 
> With explicit device selection:
> 
> $ ffmpeg -init_hw_device vaapi=intel -init_hw_device qsv=qsv@intel -hwaccel
> qsv -c:v h264_qsv -i input.mp4 -vf hwmap{intel},sharpness_vaapi -f null -
> 
> (Exact syntax unknown, but I was intending something like that.)

I got the error below if using '-vf hwmap{intel}':

[AVFilterGraph @ 0x556e3141f750] No such filter: 'hwmap{intel}'. 

I also went through the source code for the right syntax, but failed to find it.

The working syntax for me is to use '-vf hwmap=derive_device=vaapi'

> 
> > 
> > $ ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf
> > hwmap=derive_device=vaapi,sharpness_vaapi -f null -
> 
> This is really wanting the reverse case of device derivation.  I guess this
> does want the libmfx hwcontext to always have the source device there, as
> suggested above.


Always setting the source device for qsv device will break 'make fate-hwdevice'. 

(source device can't be set when qsv device is created via '-init_hw_device
qsv=intel)

> 
> > After applying Softworks' patch, the above two command-lines may work well.
> > In
> > addition, we may use other HW methods on QSV output without copy for gfx
> > memory,
> > e.g.
> > 
> > $ ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf
> > "hwmap=derive_device=vaapi,format=vaapi,hwmap=derive_device=vulkan,scale_vul
> > kan=
> > w=1920:h=1080" -f null -
> 
> So, we move the derivation out of the graph and get:
> 
> $ ffmpeg -init_hw_device vaapi=vadev -init_hw_device qsv=qsvdev@vadev
> -init_hw_device vulkan=vkdev@vadev \
>    -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf
> "hwmap{vadev},format=vaapi,hwmap{vkdev},scale_vulkan=w=1920:h=1080" -f null -

See above, -vf hwmap{avdev} doesn't work. 

BTW you prefer to derive a device via -init_hw_device option, right ? It seems
the command line using derive_device option is more straightforward. 

Thanks
Haihao

> 
> (Maybe it would help to have some shorter options for making devices like the
> first line there, because making a set derived in the right sequence is
> probably quite a common operation.  If ffmpeg knows the possible-derivations
> this wouldn't be hard to make.)
> 
> Making it all explicit also lets multiple physical devices work together
> straightforwardly, as Intel seems likely to want to support in the not-too-
> distant future.
> 
> - Mark
> _______________________________________________
> 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".
_______________________________________________
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-01-11  7:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1637807570.git.softworkz@hotmail.com>
     [not found] ` <163785839519.25323.16303122737288435026@lain.red.khirnov.net>
     [not found]   ` <163794332023.25323.7446601680884381987@lain.red.khirnov.net>
     [not found]     ` <163795393240.7822.9483345286843818669@lain.red.khirnov.net>
     [not found]       ` <DM8P223MB0365E3DFD61F63B305FC079BBA639@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
2021-12-23 14:01         ` Xiang, Haihao
2021-12-27  3:08           ` Xiang, Haihao
2022-01-05  3:19             ` James Almer
2022-01-05  3:38               ` Xiang, Haihao
2022-01-09 18:39                 ` Mark Thompson
2022-01-09 21:15                   ` Soft Works
2022-01-09 23:12                     ` Mark Thompson
2022-01-09 23:36                       ` Soft Works
2022-01-10  0:56                         ` Mark Thompson
2022-01-10  1:40                           ` Soft Works
2022-01-10  6:47                             ` Xiang, Haihao
2022-01-10 21:16                               ` Mark Thompson
2022-01-11  7:01                                 ` Xiang, Haihao [this message]
2022-01-10 20:56                             ` Mark Thompson
2022-01-12  5:15                               ` Soft Works
     [not found] ` <DM8P223MB036578CDD5AEA447DD2DE424BA629@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM>
2021-12-29 23:04   ` Mark Thompson
2021-12-30  0:29     ` Soft Works
2021-12-30 11:21       ` Mark Thompson
2021-12-30 19:20         ` Soft Works

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=96e8c643ca0264d8819e14af2dc884162d5455a1.camel@intel.com \
    --to=haihao.xiang-at-intel.com@ffmpeg.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /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