[FFmpeg-devel] [PATCH] AVFoundation: Add -pixel_format option
sfan5
sfan5 at live.de
Wed May 21 16:46:27 CEST 2014
Am 20.05.2014 23:57, schrieb Carl Eugen Hoyos:
> sfan5 <sfan5 <at> live.de> writes:
>
>>> since AVFoundation provides transparent images for 32 bit
>>> RGB it has to be mapped to RGB0 to work at all. (If a
>>> user ever protests that his alpha channel disappears, we
>>> will have to find a solution.)
>> I've changed the mapping as suggested.
>>
>> (patch attached)
>> @example
>> -ffmpeg -f avfoundation -i "default" out.mpg
>> +ffmpeg -f avfoundation -pixel_format bgra -i "default" out.mpg
> I believe the example does not work anymore or am I wrong?
>
> Thank you, Carl Eugen
Yes, you are right, I corrected the example.
Am 20.05.2014 22:59, schrieb Thilo Borgmann:
> Am 20.05.14 21:40, schrieb sfan5:
>> Am 19.05.2014 11:16, schrieb Thilo Borgmann:
>>> Am 17.05.14 18:19, schrieb sfan5:
>>>> ON 11.05.2014 19:34, Carl Eugen Hoyos wrote:
>>>>> sfan5 <sfan5 <at> live.de> writes:
>>>>>
>>>>>>>> + { AV_PIX_FMT_BGRA, kCVPixelFormatType_32BGRA },
>>>>>>> This should be AV_PIX_FMT_BGR0: The camera cannot
>>>>>>> record an alpha channel, the fourth channel is (or at
>>>>>>> least can be) 0, so it should be ignored.
>>>>>>> Same for the other 32 bit rgb formats.
>>>>>> Isn't AVFoundation a generic API for video sources?
>>>>>> (not only cameras)
>>>>>> There might be other devices that can record RGBA.
>>>>> I can't really answer this but since AVFoundation
>>>>> provides transparent images for 32 bit RGB it has
>>>>> to be mapped to RGB0 to work at all.
>>>>> (If a user ever protests that his alpha channel
>>>>> disappears, we will have to find a solution.)
>>>> I've changed the mapping as suggested.
>>> Have you also tried querying for device capabilities like I suggested?
>>> http://article.gmane.org/gmane.comp.video.ffmpeg.devel/177722
>>>
>>> -Thilo
>> I haven't tried this yet but I will look into it when I have time and send a
>> seperate patch if it works.
>>
>> By the way: The -pixel_format patch should be ready for merge now.
> The code looks good enough. However the current behaviour in case of specifying
> an unsupported pixel format is not.
>
> I would try to fix that but these days my spare time for working on it is rare.
> Whoever fixes it first, it should be adressed before merging.
>
> -Thilo
I've fixed this and also added a listing of which pixel formats are
supported.
It looks like this:
[avfoundation @ 0x7fd94181dc00] Selected pixel format is not
supported by video input
[avfoundation @ 0x7fd94181dc00] Supported pixel formats:
[avfoundation @ 0x7fd94181dc00] uyvy422
[avfoundation @ 0x7fd94181dc00] yuyv422
[avfoundation @ 0x7fd94181dc00] 0rgb
[avfoundation @ 0x7fd94181dc00] bgr0
[avfoundation @ 0x7fd94181dc00] rgb24
[avfoundation @ 0x7fd94181dc00] rgb555be
[avfoundation @ 0x7fd94181dc00] rgb565be
[avfoundation @ 0x7fd94181dc00] rgb555le
[avfoundation @ 0x7fd94181dc00] rgb565le
[avfoundation @ 0x7fd94181dc00] yuv444p
[avfoundation @ 0x7fd94181dc00] yuv422p16le
[avfoundation @ 0x7fd94181dc00] yuv422p10le
[avfoundation @ 0x7fd94181dc00] yuv444p10le
(new patch is attached)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-AVFoundation-Add-pixel_format-option.patch
Type: text/x-patch
Size: 6979 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140521/043f328a/attachment.bin>
More information about the ffmpeg-devel
mailing list