[FFmpeg-user] Why is format=rgb24 required after maskedmerge?

Michael Koch astroelectronic at t-online.de
Wed Aug 19 11:37:32 EEST 2020


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.

Michael



More information about the ffmpeg-user mailing list