3

I need to run JavaFX application on Raspberry Pi. Application contains MediaPlayer objects.
Since Oracle's Java for ARM doesn't contain javafx package, I have installed Gluon JavaFX port for ARM. Unfortunately, all sample videos I play through application have swapped colours (seems that red and blue channels swapped). I tested with videos from different sources. On PC on Oracle's JRE application plays video with correct colours. Sample video
Since Gluon's JavaFX port uses gstreamer0.10-ffmpeg, I also tested GStreamer on Raspberry: gst-launch-0.10 playbin uri=file:///sample.mp4, however, video colours were correct, so it seems to be Gluon JavaFX port bug. Anyone could help to fix or find a workaround?

Sample class for testing:

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {
        Media pick = new Media(Paths.get("sample.mp4").toUri().toString());
        MediaPlayer player = new MediaPlayer(pick);

        MediaView mediaView = new MediaView(player);

        StackPane root = new StackPane();
        root.getChildren().add(mediaView);
        Scene scene = new Scene(root,300,250);

        primaryStage.setScene(scene);
        primaryStage.show();

        player.play();
    }
}

EDIT: I've tried multiple other options to display video on java application. For others who need to display video on Raspberry, check out VLCJ library. VLC displays correct colours and even works smoother than JavaFX MediaPlayer.

Simonas
  • 301
  • 2
  • 12

0 Answers0