[FFmpeg-devel] [PATCH] [PATCH] avdevice/avfoundation: add scaleFactor attribute for avfoundation
thilo.borgmann at mail.de
Sat Aug 19 18:05:07 EEST 2017
Am 18.08.17 um 15:44 schrieb sharp bai:
> Thank you for your patient. I will follow your direction.
> Question 1: Your patch misses to cover the scale factor in case of a
> device name string given by the user.
> The problem in mac os the screen to be catpured in avfoundation not
> have a real name. Only video device in avfoundation has a name. The
> screen name "Capture screen [n]" you have seen through "-list_devices"
> is given by ffmpeg developer for convinent. So there is a possibility
> that someone may build a capture device which name is the same as
> "Capture screen 0" which may result in capturing wrong device.
this is obviously why unique indices are there.
> using "-list_devices" to find out the screen index then assign it
> should be the only right way.
This is the only unique and failsafe way. However, we support both ways and if you add functionality it has to continue to work with both existing ways. This is why I want you to add your scale factor handling also to the case of device names used.
> Question 2: Although Apple's reference says it works for scale_factor
>> 1.0, it should be documented (at least in the code) that it seems
> not to actually do anything for scale_factor > 1.0.
> This is a tough problem. I spent 5 days to prepare an available test
> environment which is almost done yesterday. My test environment covers
> the following operating systems:
> - Mac OS X 10.7.5
> - Mac OS X 10.8.5
> - Mac OS X 10.8.5
> - Mac OS X 10.10.5
> - Mac OS X 10.11.5
> - mac OS 10.12.6
> I have confirmed that on 10.7 and 10.8 the value of scale_factor can
> be larger than 1.0(scale_factor = 10.0 works. scale_factor = 20.0, the
> ffmpeg using 2.4GB memory and freezing), the maximum value is unknown
> but i think is infinate :)
Please add this to the documentation and limit the scale_factor range to 0.0 to 1.0.
Add a small note to the documents and a complete short explanation directly in the code.
> I have compared the images which scale_factor range from 1.0 to 4.0
> captured in 10.8, the images which scale_factor greater than 1.0 are
> not clearer than 1.0. They are simply scaled larger.
> From 10.9 and later, the value of scale_factor is limited to maximum
> 1.0. I think Apple had recognized that the value larger than 1.0 is
> not useful.
Just for completeness, this has nothing to do with superresolution or similar so the output is never expected to be "more sharp" after upscaling.
Values > 1.0f seem to be a perfectly valid desire like they are for the scale filter...
You still don't answer to my question about scale_factor == 0.0f.
If this technically works correctly, you should add a warning whenever the output image becomes smaller than 1x1 pixels.
If this does not technically work correctly, you have to catch that case and do proper error handling.
More information about the ffmpeg-devel