[FFmpeg-user] Why is format=rgb24 required after maskedmerge?
Paul B Mahol
onemda at gmail.com
Wed Aug 19 17:34:53 EEST 2020
On 8/19/20, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 18.08.2020 um 14:35 schrieb Michael Koch:
>> Hello all,
>>
>> I have a question about this script:
>>
>> rem Create red and yellow videos 300x300
>>
>> c:\ffmpeg\ffmpeg -f lavfi -i color=red:size=300x300:duration=5 -y red.mp4
>> c:\ffmpeg\ffmpeg -f lavfi -i color=yellow:size=300x300:duration=5 -y
>> yellow.mp4
>>
>> rem Create a mergemap file 600x300
>>
>> c:\ffmpeg\ffmpeg -f lavfi -i nullsrc=size=300x300 -vf
>> "format=gray8,geq='clip(128-128/10*(180-200/150*hypot(X-150,Y-150)),0,255)',v360=input=fisheye:output=e:ih_fov=200:iv_fov=200,format=rgb24"
>>
>> -frames 1 -y mergemap.png
>>
>> rem Stitch two fisheye videos together to an equirectangular video,
>> with merging at the border
>>
>> c:\ffmpeg\ffmpeg -i red.mp4 -i yellow.mp4 -i mergemap.png -lavfi
>> "[0]format=rgb24,v360=input=fisheye:output=e:ih_fov=200:iv_fov=200[a];[1]format=rgb24,v360=input=fisheye:output=e:yaw=180:ih_fov=200:iv_fov=200[b];[a][b][2]maskedmerge,format=rgb24,format=yuv422p"
>>
>> -y out.mp4
>>
>>
>> This works fine and the output video looks as expected. My question is
>> why "format=rgb24" is required between "maskedmerge" and
>> "format=yuv422p". Normally two consecutive format conversions should
>> be unnecessary. But it doesn't work when I omit "format=rgb24". The
>> colors become wrong.
>
> It seems that v360 and maskedmerge change the pixel format from rgb24 to
> the planar gbrp pixel format.
> But why isn't it possible to convert gbrp directly to yuv422p, without
> an intermediate conversion to rgb24? Is this a bug?
>
> I suggest to add to the documentation that v360 and maskedmerge (and
> possibly also other filters) change the pixel format to gbrp. As a user
> I was assuming that the pixel format remains the same, unless noted
> otherwise in the documentation.
You are deeply confused about our filters.
Any filter can change pixel formats to one that they accepts thus gbrp
is picked instead of packed rgb, this is already documented
implicitly.
Your mergemap is produced in rgb24 pixel format and it only work with
rgb pixel formats otherwise you get wrong output from maskedmerge.
If it does not work with yuv444p pixel formats either than you have
bigger problem, otherwise it is giving bad output as yuv422p is
subsampled pixel format and thus you need to create different mergemap
equation per plane. As for 3rd and 2nd plane of yuv422p pixel format
have half of width and same height as first plane.
>
> Michael
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list