Non english character in filename opening a mp4 file

Hello everyone, it's my first post here and I try to search the forum first but didn't find anything useful or related. Here is the simple code:

import processing.video.*;
Movie movie; 

void setup() {
    size(1280, 800);
    selectInput("Select a music to play:", "folderSelected");
}
void movieEvent(Movie movie) {
    movie.read();
}

void draw() {
    if (movie==null)
    {
        ;
    }else
    {
        image(movie, 0, 0, width, height);
    }
}

void folderSelected(File selection) {
    if (selection == null) {
        println("Window was closed or the user hit cancel.");
    }else {
        String a = selection.getAbsolutePath();
        movie = new Movie(this, a); 
        System.out.println(a);
        movie.loop();
    }
}

However, when the filename contains non english character, the mp4 failed to play. Is there any solution to this kind of question ? I try to use System.setproperty but failed.

Answers

  • What was the error message?

  • Hmm Interesting I don't see any error message in the console, it just stuck at there. Maybe it's my system setting ? So this code should work with any kind of character,right ?

  • When you selected the file with the non-English character you should have got some output from line 24 or 26.

    If you got no output then swap lines 27 and 28 and try again.

    Tell us what happened and post the output, otherwise we are just stumbling in the dark.

    Statements like

    I try to use System.setproperty but failed.

    and

    it just stuck at there

    are useless because they don't provide enough information about what you tried and where it stuck. Please try to be more informative.

  • I see. Sorry that I didn't make the things clear enough.

    Here is the video that I select: Relaxing Piano_ Studio Ghibli Complete Collection スタジオジブリ宮崎駿リラクシング·ピアノ音楽.mp4

    It's located under my Download Document

    I add a snapshot what happened when I run the code.

    test

    Sorry that I censored my username.

    The output is at line 28:C:\Users\XXXX\Downloads\Relaxing Piano_ Studio Ghibli Complete Collection スタジオジブリ宮崎駿リラクシング・ピアノ音楽.mp4

    Which maybe informing me that it does successfully read the file, but the canvas is blank, the movie is not running.

    The console didn't output any exception too.



    Here is another video that I use for testing: The great detective knows.mp4

    It's also located under my Download Document

    Here is the snapshot what happened when I run the code.

    test1

    I still get the same output from line 28:C:\Users\XXXX\Downloads\The great detective knows.mp4

    But now the mp4 can play,so the canvas can see the picture.

    That's why I find out that I can't deal with video with filename containing non-english character.

    If there's anything ambiguous, I will try my best to clear it out.

    Thx for the help so far.

  • Answer ✓

    Couple of things to try ...

    C:\Users\XXXX\Downloads\Relaxing Piano_ Studio Ghibli Complete Collection スタジオジブリ宮崎駿リラクシング・ピアノ音楽.mp4

    Does this file work with other mp4 viewers? (Double click on the file in Windows explorer and see what happens)

    Try changing the filename to use English characters only and see if that works with Processing. If it does then it is probably something to do with the character encoding i.e. ASCII, UTF8, UTF16 etc.

  • Well, this file can be opened using Windows media player.

    The file can be played if you change the name.

    I thought processing use UTF8 in all the string processing stuff.....

    Is there anyway to let the Movie object use UTF8 encoding ?

  • Answer ✓

    I am not very knowledgeable in the area of character encoding standards, the only time I bothered with it was when I created the Steganos library.

    I thought processing use UTF8 in all the string processing stuff.....

    AFAIK Processing uses the Java String class and this should handle these encodings transparently so I don't know what to suggest. Perhaps someone more knowledgeable in this area can help.

Sign In or Register to comment.