multiple flat videos in a equirectangular projection - v360 filter
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer. I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged. This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task? Here is an example code with the result. The video in the example has a resolution of 1080p: ffmpeg -i BRAIN.mp4 -lavfi "\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \ [0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg output: https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa <https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa> zoomed: https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M <https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M> Thanks! All the best, denis
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote: transition from full opacity to no opacity. To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. Did not tried yet as I never needed to do stitching.
output: https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa < https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa> zoomed: https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M < https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M>
Thanks!
All the best, denis _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only.
How could I achieve that? How can I blurry just the borders?
Did not tried yet as I never needed to do stitching.
output: https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa < https://nextcloud.denispolec.de/index.php/s/8yF7rKdnB9HdJsa> zoomed: https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M < https://nextcloud.denispolec.de/index.php/s/fwdapyA8aGBdC2M>
Thanks!
All the best, denis _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders?
You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge. ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png Then use test.png as input for your script. Michael
Am 16.07.2022 um 22:12 schrieb Michael Koch <astroelectronic@t-online.de>:
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders?
You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge.
Thank you for your reply.
ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png
This works.
ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png
But ffmpeg says multiply filter doesn’t exist. I tried that: ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi blend=all_mode=multiply -frames 1 -y test.png output gets green. ffmpeg -f lavfi -i testsrc=size=1920x1080 -i mask.png -lavfi blend=all_mode=multiply -frames 1 -y test.png Works! If I take a video, the video output gets green.
Then use test.png as input for your script.
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org <mailto:ffmpeg-user@ffmpeg.org> https://ffmpeg.org/mailman/listinfo/ffmpeg-user <https://ffmpeg.org/mailman/listinfo/ffmpeg-user>
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org <mailto:ffmpeg-user-request@ffmpeg.org> with subject "unsubscribe".
Am 17.07.2022 um 12:09 schrieb Denis Połeć:
Am 16.07.2022 um 22:12 schrieb Michael Koch <astroelectronic@t-online.de>:
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders? You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge.
Thank you for your reply.
ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png This works.
ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png But ffmpeg says multiply filter doesn’t exist.
Get a newer version. The multiply filter was added not so long ago. Michael
Am 17.07.2022 um 13:54 schrieb Michael Koch <astroelectronic@t-online.de>:
Am 17.07.2022 um 12:09 schrieb Denis Połeć:
Am 16.07.2022 um 22:12 schrieb Michael Koch <astroelectronic@t-online.de>:
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders? You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge.
Thank you for your reply.
ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png This works.
ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png But ffmpeg says multiply filter doesn’t exist.
Get a newer version. The multiply filter was added not so long ago.
I am on an M1 Apple machine and it seems I have the latest stable version I can get: 5.0.1_3. --- ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.1.6 (clang-1316.0.21.2.5) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Input #0, lavfi, from 'testsrc2=size=1920x1080': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn Input #1, png_pipe, from 'mask.png': Duration: N/A, bitrate: N/A Stream #1:0: Video: png, rgb24(pc), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn [AVFilterGraph @ 0x131e085b0] No such filter: 'multiply' — brew info ffmpeg ffmpeg: stable 5.0.1 (bottled), HEAD Play, record, convert, and stream audio and video https://ffmpeg.org/ /opt/homebrew/Cellar/ffmpeg/5.0.1_3 (272 files, 48.4MB) * Poured from bottle on 2022-06-28 at 22:56:20 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/ffmpeg.rb License: GPL-2.0-or-later ==> Dependencies Build: nasm ✔, pkg-config ✔ Required: aom ✔, dav1d ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, lame ✔, libass ✔, libbluray ✔, librist ✔, libsoxr ✔, libvidstab ✔, libvmaf ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, opus ✔, rav1e ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, srt ✔, tesseract ✔, theora ✔, webp ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔, zeromq ✔, zimg ✔
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org <mailto:ffmpeg-user@ffmpeg.org> https://ffmpeg.org/mailman/listinfo/ffmpeg-user <https://ffmpeg.org/mailman/listinfo/ffmpeg-user>
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org <mailto:ffmpeg-user-request@ffmpeg.org> with subject "unsubscribe".
SPAM On Sun, Jul 17, 2022 at 7:54 AM Michael Koch <astroelectronic@t-online.de> wrote:
Am 17.07.2022 um 12:09 schrieb Denis Połeć:
Am 16.07.2022 um 22:12 schrieb Michael Koch <
astroelectronic@t-online.de>:
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com>
wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to
become
a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\
\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\
\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\
\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\
-q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small
[0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders? You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge.
Thank you for your reply.
ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png This works.
ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png But ffmpeg says multiply filter doesn’t exist.
Get a newer version. The multiply filter was added not so long ago.
Michael
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Please don't top-post. On 7/17/2022 4:26 PM, Jim Hollingsworth wrote:
SPAM
What's spammy about the response?
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
If you don't want to be on the ffmpeg list, just unsubscribe- the instructions are in every message. z!
On Jul 17, 2022, at 5:49 PM, Carl Zwanzig <cpz@tuunq.com> wrote:
Please don't top-post.
On 7/17/2022 4:26 PM, Jim Hollingsworth wrote: SPAM
What's spammy about the response?
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
If you don't want to be on the ffmpeg list, just unsubscribe- the instructions are in every message.
z!
Lol, you top posted not to top post Z!
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On 7/17/2022 5:15 PM, morgan holly via ffmpeg-user wrote:
Lol, you top posted not to top post Z!
No, I did not. Adding a note above the quote does not make for top-posting. z!
Am 17.07.2022 um 12:09 schrieb Denis Połeć:
Am 16.07.2022 um 22:12 schrieb Michael Koch <astroelectronic@t-online.de>:
Am 16.07.2022 um 20:57 schrieb Denis Połeć:
Am 16.07.2022 um 11:46 schrieb Paul B Mahol <onemda@gmail.com>:
On Sat, Jul 16, 2022 at 11:22 AM Denis Połeć <denis.polec@gmail.com> wrote:
Hello, I wouldn't call myself a beginner, but I still need a little bit to become a pro. :) I have a question that might be easy to answer.
I am working on a script to bring multiple flat videos into a equirectangular projection by using v360 filter. I have the problem that the edges of the input are very jagged.
This did not lead to a good result when I play the equirectangular projection in a 360 player. I have also already tried different interpolation modes, which does not lead to a better result. Does anyone have an idea how I can avoid that? Is there a better way to do this task?
Here is an example code with the result. The video in the example has a resolution of 1080p:
ffmpeg -i BRAIN.mp4 -lavfi "\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw='0':alpha_mask=1[fg1];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:alpha_mask=1[fg2];[fg2][fg1]overlay[a];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:alpha_mask=1[fg3];[fg3][a]overlay[b];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:alpha_mask=1[fg4];[fg4][b]overlay[c];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=45:alpha_mask=1[fg5];[fg5][c]overlay[d];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=45:alpha_mask=1[fg6];[fg6][d]overlay[e];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=-45:alpha_mask=1[fg7];[fg7][e]overlay[f];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=-45:alpha_mask=1[fg8];[fg8][f]overlay[g];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-45:alpha_mask=1[fg9];[fg9][g]overlay[h];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=90:roll=-45:alpha_mask=1[fg10];[fg10][h]overlay[i];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=-90:roll=45:alpha_mask=1[fg11];[fg11][i]overlay[j];\
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=180:pitch=45:alpha_mask=1[fg12];[fg12][j]overlay[k];\ \
[0]v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=90:alpha_mask=1[fg13];[fg13][k]overlay[l];\ [0]drawbox=w=1:h=1:color=black,v360=input=flat:output=e:id_fov=45:w=5120:h=2560:yaw=0:pitch=-90:alpha_mask=1[fg14];[fg14][l]overlay" -q:v 4 -vframes 1 -y test11.jpg
Your filtergraph is extremely inefficient with that many cascaded overlays and gives poor results. For proper stitching borders need to have small transition from full opacity to no opacity.
To add small transitions with opacity on borders could use blurring filters for example on alpha plane only. How could I achieve that? How can I blurry just the borders? You could apply some preprocessing to your input video, before you feed it to your script. The trick is to multiply all pixels at the edges by 0.5. This can be done with a white mask which has gray pixels at the edge.
Thank you for your reply.
ffmpeg -f lavfi -i color=color=white:size=1920x1080 -lavfi drawbox=color=gray:t=1 -frames 1 -y mask.png This works.
ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi multiply=offset=0 -frames 1 -y test.png But ffmpeg says multiply filter doesn’t exist.
I tried that: ffmpeg -f lavfi -i testsrc2=size=1920x1080 -i mask.png -lavfi blend=all_mode=multiply -frames 1 -y test.png
output gets green.
Convert the pixel format of both inputs to RGB24 before using the blend filter. Multiply makes no sense in YUV format. Michael
participants (6)
-
Carl Zwanzig -
Denis Połeć -
Jim Hollingsworth -
Michael Koch -
morgan holly -
Paul B Mahol