[FFmpeg-trac] #10912(undetermined:new): d_fov and h_fov not working well when converting equirectangular to rectilinear (v360)
FFmpeg
trac at avcodec.org
Tue Mar 19 01:49:11 EET 2024
#10912: d_fov and h_fov not working well when converting equirectangular to
rectilinear (v360)
-------------------------------------+-------------------------------------
Reporter: 0kajuna0 | Type: defect
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: v360, | Blocked By:
equirect, rectilinear |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug: When trying to convert a 360 frame from
equirectangular to rectilinear with the v360 filter, the d_fov (diagonal
field of view) works well, but h_fov (horizontal) and v_fov (vertical)
don't seem to produce the expected results. The image gets distorted. This
also happens if no fov is specified.
How to reproduce:
(tested with recent git master versions)
Equirectangular test file:
https://en.wikipedia.org/wiki/Equirectangular_projection#/media/File:Plate_Carr%C3%A9e_with_Tissot's_Indicatrices_of_Distortion.svg
No fov results in a distorted output
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear a.png
}}}
https://imgur.com/dxlo01O
d_fov results in correct proportions:
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125 b.png
}}}
https://imgur.com/Ti96A7o
Using h_fov and v_fov to output a different aspect ratio results in a very
distorted image
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:h_fov=56:v_fov=112 c.png
}}}
https://imgur.com/B0tJctX
We can try to correct this by specifying width and height, but the result
is still distorted
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:h_fov=56:v_fov=112:w=1440:h=2880
d.png
}}}
https://imgur.com/tl6CbJq
As a partial workaround, we can use d_fov and apply a roll and transpose
to output a correct vertical ratio
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:roll=90,transpose=1
e.png
}}}
https://imgur.com/XydgshW
This also works for converting the image back to equirectangular
{{{
% ffmpeg -i e.png -vf transpose=2,v360=rectilinear:e:id_fov=125:roll=-90
h.png
}}}
https://imgur.com/uNHThfJ
Another workaround is to use d_fov and trigonometry to define the output
resolution
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:w=1440:h=2880 f.png
}}}
https://imgur.com/evVUX5i
This allows us to output any ratio
{{{
% ffmpeg -i in.png -vf v360=e:rectilinear:d_fov=125:w=1440:h=1440 g.png
}}}
https://imgur.com/OC8pwQE
But unfortunately bringing that back to equirectangular breaks proportions
{{{
% ffmpeg -i g.png -vf v360=rectilinear:e:id_fov=125 i.png
}}}
https://imgur.com/TP8wXzF
Is this a bug or am I doing something wrong?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/10912>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list