[FFmpeg-user] Documentation for Ffmpeg remap filter

Evert Vorster evorster at gmail.com
Sun Aug 6 16:13:23 EEST 2017


Hi there.

I have been able to use ffmpeg to convert dual fisheye samsung gear 360
footage to equirectangular footage with ffmpeg.

The example program given in the manual does an OK job of what the remap
filter is capable of, however to really get the best from it the .pgm maps
needs to be created with something that takes lens chataristics into
account.

Passing the -c parameter to Panotool's nona generates the required
translation maps in .tif format, and then it's a doddle to convert to .pgm
with ImageMagick.

Is there a way to update the manual a little for other people who wants to
folow in my footsteps?

For the curious, here is the contents of the script that I use.
--------------------------------------------------------------------------------------
#!/bin/bash
#This will split, defish, blend and re-assemble Samsung Gear 360 video
map_dir="/data/Projects/RemapFilter"
ffmpeg -y -i "$1" \
-i $map_dir/lx.pgm -i $map_dir/ly.pgm -loop 1 \
-i $map_dir/Alpha-Map.png \
-i $map_dir/rx.pgm -i $map_dir/ry.pgm \
-c:v hevc_nvenc -rc constqp -qp 26 -cq 26 \
-filter_complex \
"[0:v]eq=contrast=0.8:brightness=-0.01:gamma=0.7:saturation=0.8[bright]; \
 [bright]split=2[in1][in2]; \
 [in1]crop=in_w/2:in_h:0:in_h[l_crop];\
 [in2]crop=in_w/2:in_h:in_w/2:in_h[r_crop]; \
 [3]alphaextract[alf]; \
 [l_crop]vignette=angle=PI/4.6:mode=backward[l_vignette]; \
 [l_vignette][1][2]remap[l_remap]; \
 [r_crop]vignette=angle=PI/4.8:mode=backward[r_vignette]; \
 [r_vignette][4][5]remap[r_remap]; \
 [l_remap]crop=in_w:1920:0:(in_h-1920)/2[l_rm_crop]; \
 [r_remap]crop=in_w:1920:0:(in_h-1920)/2[r_rm_crop]; \
 [l_rm_crop][alf]alphamerge[l_rm_crop_a]; \
 [l_rm_crop_a]split=2[l_rm_crop1][l_rm_crop2]; \
 [l_rm_crop1]crop=in_w/2:in_h:0:0[l_rm_crop_l]; \
 [l_rm_crop2]crop=in_w/2:in_h:in_w/2:0[l_rm_crop_r]; \
 [0:v][r_rm_crop]overlay=(1920-(2028/2)):0[ov1]; \
 [ov1][l_rm_crop_l]overlay=((1920+2028/2)-(2028-1920)):0[ov2]; \
 [ov2][l_rm_crop_r]overlay=0:0[out]" \
-map [out] -map 0:a "$1_Remapped.mp4"
--------------------------------------------------------------------------------------------
I hope this helps somebody.

Kind regards
-- 
Evert Vorster
Isometrix Acquistion Superchief


More information about the ffmpeg-user mailing list