facebook / transform360

Transform360 is an equirectangular to cubemap transform for 360 video.
Other
1k stars 240 forks source link

Speed optimisation for transform360 filter. #54

Open cutechaos opened 6 years ago

cutechaos commented 6 years ago

Currently I am using the following commands to convert my input video. It is taking 1 min 8sec for a 25 sec video to convert. I am running it on a 8 core Intel xeon processor. The CPU is only being utilized at 40-50 percent.

ffmpeg -i input.mp4 -vf transform360="input_stereo_format=MONO :cube_edge_length=512 :interpolation_alg=cubic :enable_low_pass_filter=1 :enable_multi_threading=1 :num_horizontal_segments=32 :num_vertical_segments=15 :adjust_kernel=1" output.mp4

According to my requirement it should run in the original video length or faster (1x + speed). I tried looking at what each of these options do but didn't get much information on them. Can you point me in the correct direction please.

With out any kind of optimisations I want you to just input a equirectangular mp4 file and output a cubemap mp4 file. Size of the file is not the constraint, time taken to process it is.

What are the disadvantages of using something like this command

ffmpeg -i input.mp4 -vf transform360="input_stereo_format=MONO :cube_edge_length=512 :enable_multi_threading=1" output.mp4

I just want to input a file a equirectangular file and want a cubemap output with as much less operations on it as possible and as fast as possible. As long as there is no significant quality difference it doesn't matter.

In between an interestin project where this became the bottle neck. So, any kind of useful reply is hugely appreciated.

kcircnc commented 6 years ago

Transform360 is not designed for realtime filtering. The expected speed of processing should be lower than 30 fps. If you are targeting realtime transformation (and don't care that much about quality) I'd recommend you use transform_v1 instead of transform360. This should give you 100+ fps:

ffmpeg -i input.mp4 -vf transform_v1="input_stereo_format=MONO:w_subdivisions=4:h_subdivisions=4:max_cube_edge_length=512" output.mp4

(btw the shorter command you give should have the same performance to the longer one. The omitted options will be filled with default values that will make the two command similar.)

kcircnc commented 6 years ago

If you must use Transform360, disabling loss pass filter (enable_low_pass_filter=0) would boost the fps to 30+

Ncurls commented 5 years ago

why i just get 13 fps not 100+ fps when i use transform_v1 as your line. My machine is macbookpro 2018 and the vedio is 8k mono download from https://www.youtube.com/watch?v=4V1egGOQNhE

屏幕快照 2019-05-05 下午4 31 24
Ncurls commented 5 years ago

@kcircnc