FFmpeg 保留 360 视频方向

FFmpeg 保留 360 视频方向

我正在使用 FFmpeg(版本 2022-03-24)将 Rylo 相机录制的双鱼眼 360 视频转换为等距矩形格式。我的目标是在 PC 上批量拼接视频,而不是使用 Rylo Android 应用程序,并避免在手机上处理大型视频文件。目前,我已经以可接受的质量水平进行了拼接。

我在转换过程中丢失的是 Rylo Android 应用程序处理相同原始双鱼眼源文件时保留的“始终直立”方向。我认为双鱼眼源 .mp4 文件包含一些 Android 应用程序能够读取的元数据。如何确保 FFmpeg 拼接同一个源文件时处理相机方向数据?

换句话说,当我录制 360 度视频并将相机横着或倒着旋转时,Android 应用程序会始终将输出与底部的地面拼接在一起。当我使用 FFmpeg 处理视频时,这种情况不会发生,因此当相机放在自拍杆上时,后期处理会很繁琐,我必须不断手动调整方向。无论我将自拍杆放在哪里,我都希望视频保持直立。

请参阅所附图片和链接的视频示例。

在此处输入图片描述

如果您好奇的话,以下是我用来将原始 Rylo 视频文件转换为等距矩形的命令。我使用滚动方法来设置初始方向。我在此请求中要求在此之后保持方向。

REM Create a merge map for blending the edges between the front and rear cameras.
ffmpeg -f lavfi -i nullsrc=size=2016x2016 -vf "format=gray8,geq='clip(128-128/(6)*(180-192/(2016/2)*hypot(X-2016/2,Y-2016/2)),0,255)',v360=input=fisheye:output=e:ih_fov=192:iv_fov=192,format=rgb24" -frames 1 -y mergemap.png

REM Convert the video from dual fisheye to equirectangular while applying the mergemap created in the first step.
ffmpeg -i RYLO0054.MP4 -i mergemap.png -profile:v High -pix_fmt yuv420p -lavfi "[0]format=rgb24,split[a][b];[a]crop=ih:iw/2:0:0, v360=input=fisheye:output=e:ih_fov=192:iv_fov=192:roll=90[c]; [b]crop=ih:iw/2:iw/2:0,v360=input=fisheye:output=e:yaw=180:ih_fov=192:iv_fov=192:roll=90[d]; [c][d][1]maskedmerge,format=rgb24" -y RYLO0054_eq.MP4 

REM Here is a simpler single-line command that doesn't blur the seam lines.
REM If you have an answer you respond using this format as an example.
ffmpeg -i RYLO0012.mp4 -vf v360=dfisheye:e:ih_fov=192:iv_fov=192:roll=-90 -y RYLO0012_eq.mp4

以下是视频示例 https://youtu.be/l1Evob6MQvA

编辑:从原始 Rylo .mp4 文件添加了 ffprobe 输出。 ffprobe 输出图像

相关内容