Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video output is flickering badly after engrave #93

Open
eyaler opened this issue Jun 6, 2021 · 1 comment
Open

video output is flickering badly after engrave #93

eyaler opened this issue Jun 6, 2021 · 1 comment

Comments

@eyaler
Copy link

eyaler commented Jun 6, 2021

i am getting weird flickering when trying to apply engrave to a video
gmic.run('input /content/input.mp4 fx_engrave 0.5,50,0.8,40,0,0,0,10,1,0,0,0,1,0,50,50 output /content/gmic.mp4,24.800000')

what i tried:

  • made sure my code works ok when using other filters
  • made sure this issue happens also for other videos
  • tried both b/w engrave as above as well as the color option
  • made sure the issue happens also with the default fps, different fps, different codec (btw seems that gmic is not able to output with codec AVC1)
  • gmic-py 2.9.2 and 2.9.4a1
  • I ran engrave filter on video in ZART and did not see a similar issue

possible solutions:

  • perhaps engrave outputs more than one layer and they get interleaved with the frames and i should be doing some merging?
  • i know i can break the video to frames and apply it on the images however i timed it and running on video was ~25% faster.

colab to reproduce (just run it): https://colab.research.google.com/drive/1cUDQhdlMJZee8qYa9BZkWK4cxYfDSjqF?usp=sharing

video showing issue is attached (warning - heavy flickering!):

output.21.mp4
@eyaler
Copy link
Author

eyaler commented Jun 11, 2021

i had several issues going on here:

  1. i accidentally had 0.8 in my argument list where i wanted 0,8... this meant that the remainder of the arguments where off by one and i was actually always running the engrave with the color option. if you run it with out the color option it works out of the box for videos
  2. indeed for the color option you get two outputs for each frame. if you are working with images you can use the gui_merge_layers command to blend them. however for video this does not work as it would merge all video frames to just one. you need to iterate over pairs... but i did not find an easy way to do that.
  3. i ended up substituting the fx_engrave with fx_engrave_preview which takes care of dealing with multiple images.

i have few questions remaining open so i will leave the issue open for now:

  1. for a given filter how can one now how many output layers to expect?
  2. when running on videos what would be the canonical way to merge all per-frame outputs to single frames (without knowing the number of outputs per frame)
  3. seems that some filters can also change the number of output channels. how can i know what to expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant