video_export_processing icon indicating copy to clipboard operation
video_export_processing copied to clipboard

NoSuchFieldError: frame error - On alpha processing versions

Open danieltorrer opened this issue 4 years ago • 8 comments

Newer processing releases have dropped the use of PApplet's frame. Trying to export a video using any of the examples now shows this message NoSuchFieldError: frame

The change was introduced in this version: https://github.com/processing/processing4/releases/tag/processing-1271-4.0a2 so any version before that should be fine. The release notes mention remove the java.awt.Frame object from PApplet but I cant find the commit yet (i'll update here when I found it)

Seems that .frame is used once here: https://github.com/hamoid/video_export_processing/blob/master/src/com/hamoid/VideoExport.java#L486 could it be that removing that reference makes the library work again in newer versions?

More info about the removal of frame: https://github.com/processing/processing4/issues/54

Processing 3.x works fine

danieltorrer avatar Jun 17 '21 07:06 danieltorrer

Thank you for the detailed report. .frame is used to open a dialog.

I worked on an update but it's not finished and didn't take the source with me. Will only get access to it in 2 weeks.

I wonder if someone would like to adopt this project or at least help with the code. I should ask in the forum. For the last years I've been maintaining it for others as I now use OPENRNDR which comes with easy creation of video files.

hamoid avatar Jun 17 '21 10:06 hamoid

Thanks, I realized that the dialog is shown when FFMEPG is not set, so I set it using v3.X and then I opened processing in version v4. This time I got another error, but I guess that's progress haha

I could help into looking at the recent breaking changes so the library works again in v4.0.0. I'll post my findings

I'm actually currently using your processing->p5 w/ intelli j -> p5 w kotlin -> openrndr migration guide because of openrndr's "native" capabilities for exporting videos.

danieltorrer avatar Jun 17 '21 18:06 danieltorrer

The following code works:

import javax.swing.JOptionPane;
String r=JOptionPane.showInputDialog(null, "What?", "Hmm..", JOptionPane.QUESTION_MESSAGE);
text(r, 9, 9);

Therefore I think I could replace

JOptionPane.showMessageDialog(parent.frame,

with

JOptionPane.showMessageDialog(null,

I will try that.

hamoid avatar Sep 08 '21 09:09 hamoid

JOptionPane.showMessageDialog(null,

Did that fix work on your testings ?

I know you're busy trying to rewrite the whole library in Kotlin (and probably other things ^^ ). I wanted to implement the fix and/or try to see if I could find a solution if that wasn't enough. But I actually have no clue how to compile the library from the source. I'm kind of stuck because i'm using a library that would not work in processing 3 and that one who would not work in processing 4 haha. I think I might just stick to exporting png and make a local script to turn them into video.

rsepierre avatar Nov 19 '21 09:11 rsepierre

Hii :) I'm very sorry about taking forever... I work on it like twice a year XD

I just pushed this new branch:

https://github.com/hamoid/video_export_processing/tree/kotlinGradle

with some instructions. I quickly tested it in Processing 3 and 4 and it worked. I hope it can help someone!

Cheers! :)

hamoid avatar Nov 19 '21 10:11 hamoid

For anyone trying to make the Video Export library work today on processing4 and avoid the NoSuchFieldError: frame and don't know how to compile a library from the source here's a hacky way to make it work: I'll use paths that are correct for me, I will let you change them according to your computer/platform.

  1. Install the VideoExport library as you would usually

  2. Look inside the C:\Users\hi\Documents\Processing\libraries\VideoExport\library folder and copy jna-platform.jar and jna.jar. -> Paste them into G:\sandbox\mySketchFolder\code\

  3. Look inside C:\Users\hi\Documents\Processing\libraries\VideoExport\src\com\ folder and copy the VideoExport.java file -> Paste it into G:\sandbox\mySketchFolder\

  4. In that VideoExport.java file replace JOptionPane.showMessageDialog(parent.frame, with JOptionPane.showMessageDialog(null, ( the fix mentionned above by @hamoid )

  5. Remove import com.hamoid.*; from your sketch (will automatically be imported as it is inside the sketch folder

rsepierre avatar Nov 19 '21 10:11 rsepierre

Hii :) I'm very sorry about taking forever... I work on it like twice a year XD

I just pushed this new branch:

https://github.com/hamoid/video_export_processing/tree/kotlinGradle

with some instructions. I quickly tested it in Processing 3 and 4 and it worked. I hope it can help someone!

Cheers! :)

aha, you replied 10 second before I share my hack. Thank you for this. I'll leave it up as it might still be valuable to some !

rsepierre avatar Nov 19 '21 10:11 rsepierre

:-)

I just added a jar to test, in case someone for some strange reason doesn't want to build it themselves XD

hamoid avatar Nov 19 '21 10:11 hamoid