[FFmpeg-user] V360 stabilization
Paul B Mahol
onemda at gmail.com
Fri Oct 2 23:01:21 EEST 2020
On Fri, Oct 02, 2020 at 07:59:12PM +0200, Michael Koch wrote:
> Am 02.10.2020 um 10:10 schrieb Paul B Mahol:
> > On Thu, Oct 01, 2020 at 11:40:57PM +0200, Michael Koch wrote:
> > > Am 01.10.2020 um 22:11 schrieb Paul B Mahol:
> > > > On Tue, Sep 29, 2020 at 10:54:54PM +0200, Michael Koch wrote:
> > > > > Hello all,
> > > > >
> > > > > I've programmed a C# workaround for stabilization of 360° videos. The
> > > > > procedure is as follows:
> > > > >
> > > > > 1. FFmpeg: From each frame of the equirectangular input video, extract two
> > > > > small images which are 90° apart in the input video. I call them A and B
> > > > > images.
> > > > >
> > > > > 2. C# code: Analyze the x and y image shift from subsequent A and B images.
> > > > > Calculate how the equirectangular frames must be rotated (yaw, pitch, roll)
> > > > > to compensate the image shifts. This part wasn't easy. Two rotation matrices
> > > > > and one matrix multiplication are required. Write the results to a *.cmd
> > > > > file.
> > > > >
> > > > > 3. FFmpeg: Read the *.cmd file and apply the rotations with the v360 filter.
> > > > > The output video is stabilized.
> > > > >
> > > > > For details and source code please have a look at chapter 2.78 in my book:
> > > > > http://www.astro-electronic.de/FFmpeg_Book.pdf
> > > > >
> > > > > If anyone wants to implement this in FFmpeg, please feel free to do it.
> > > > Better upload DNG files that do not decode with FFmpeg.
> > > In this message
> > > http://ffmpeg.org/pipermail/ffmpeg-user/2020-August/049681.html
> > > you find a link to many DNG images which FFmpeg can't decode correctly.
> > > There is no error message, but the result is much too dark with low
> > > saturation.
> > Use correct player like mpv, which does not ignore color_trc.
>
> A player? The output is a jpg image and it's too dark.
Yes, player, ffmpeg is not correct in conversion. Because swscale is old
and ignores color_trc metadata that is required for correct display.
Use zscale instead for converting pixel formats.
>
> ffmpeg -i input.dng output.jpg
>
>
> > > I did convert a RAW image from a Canon 6D to DNG with Adobe DNG Converter
> > > V12.4. FFmpeg is unable to decode this DNG image. See this message for
> > > details:
> > > http://ffmpeg.org/pipermail/ffmpeg-user/2020-August/049738.html
> > > You can download the DNG image here (I will delete it from my webspace in a
> > > few days):
> > > www.astro-electronic.de/IMG_3459.dng
> > >
> > > I did also try a RAW image from a Canon 5D-MK4 with the same negative
> > > result.
> > >
> > > A friend gave me a DNG image that was written by his Pentax K5 camera. Same
> > > negative result.
> > >
> > > Summary: I did try DNG images from 4 different sources and in 4 of 4 cases
> > In my testcases, 30 out of 30 DNGs decoded just fine.
>
> Did any of your 30 DNGs come from Adobe DNG converter V12.4, or from a
> Pentax K5 camera?
No, as that converter tends to create invalid DNG files.
But thanks for uploading only one DNG file, I added support for it.
>
> 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