[FFmpeg-user] rgb8

Reindl Harald h.reindl at thelounge.net
Wed May 31 10:16:15 EEST 2023



Am 31.05.23 um 09:14 schrieb Michael Koch:
> Am 31.05.2023 um 08:56 schrieb Paul B Mahol:
>> On Wed, May 31, 2023 at 8:28 AM Michael Koch 
>> <astroelectronic at t-online.de>
>> wrote:
>>
>>> Am 31.05.2023 um 08:15 schrieb Kieran O Leary:
>>>> On Wed 31 May 2023 at 06:18, Michael Koch <astroelectronic at t-online.de>
>>>> wrote:
>>>>
>>>>> Am 30.05.2023 um 22:53 schrieb Paul B Mahol:
>>>>>> On Tue, May 30, 2023 at 8:32 PM Michael Koch <
>>>>> astroelectronic at t-online.de>
>>>>>> wrote:
>>>>>>
>>>>>>> Am 30.05.2023 um 20:28 schrieb Reindl Harald:
>>>>>>>> Am 30.05.23 um 20:21 schrieb Michael Koch:
>>>>>>>>> ffmpeg -f dshow -video_size 1280x800 -framerate 5 -pixel_format 
>>>>>>>>> rgb8
>>>>>>>>> -i video="ASI178MM Camera (ZWO Design)" -f rawvideo -frames 1 -y
>>>>>>>>> test.raw
>>>>>>>>>
>>>>>>>>> Then I did read this file, assuming that the pixel format is gray:
>>>>>>>>>
>>>>>>>>> ffmpeg -s 1280x800 -pixel_format gray -f rawvideo -i test.raw -y
>>>>>>>>> gray.png
>>>>>>>>>
>>>>>>>>> The result looks correct. Is it possible to do this in one command
>>>>>>>>> line? I mean just tell FFmpeg that the pixel format isn't rgb8 but
>>>>>>>>> gray, without making any modifications to the data?
>>>>>>>> parameters before the input file are *input params*
>>>>>>>>
>>>>>>>> so why don't you change "-pixel_format rgb8" to "-pixel_format 
>>>>>>>> gray"
>>>>>>>> in the first command line when you say it works in the second one?
>>>>>>> When reading from the camera, the pixel format must be rgb8 because
>>> this
>>>>>>> is the only format supported by the DirectShow driver. All other 
>>>>>>> pixel
>>>>>>> formats give error message.
>>>>>>>
>>>>>> Yes, looks like buggy code, the rgb8 is actually gray and not color.
>>>>> Is it possible to get correct gray data from the buggy driver in one
>>>>> FFmpeg command line? I mean the data can only be read from the 
>>>>> driver as
>>>>> rgb8. Is it possible to tell FFmpeg that it's actually gray? It 
>>>>> works as
>>>>> a two-step process with an intermediate raw file, but I'd like to 
>>>>> do the
>>>>> same thing in one command line in realtime.
>>>>
>>>> I’m not as familiar with this kind of usage but does adding “-pix_fmt
>>> gray
>>>> “ as an output option not work for you?
>>> Then FFmpeg does convert from rgb8 to gray, which gives wrong noisy
>>> output. Because the data is already gray. It's only incorrectly labeled
>>> as rgb8.
>>>
>>>
>> Once I push extractplanes commit you will be able to extract r/g/b
>> component from rgb8.
>> And after that is just matter of using mergeplanes and geq filters.
> 
> Couldn't this be simplified with a new filter "set_pixel_format" which 
> tells FFmpeg to interpret the data as a different pixel format, without 
> making any modifications to the data?
> In my case the data is already correct. It's only labeled incorrectly.

"-pixel_format rgb8" as input parm tells ffmpeg exactly that


More information about the ffmpeg-user mailing list