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

FFmpegFrameGrabber.load(myFile) .. start() crashes in Version 1.5.8 when using a filename with special characters #1945

Closed
HagiHagi opened this issue Nov 25, 2022 · 5 comments
Labels

Comments

@HagiHagi
Copy link

If i try to load a filename with special characters (excample: Mic Macs Raphael Beau 07 Ca déroule_44100_16_2.wav) my java program crashes without a comment.
In version 1.5.7 all is fine.
I use java 8.202 and I packaged the software with oracles's jpackager. When the software runs inside the IDE (Netbeans 8) everything works, but if I run the installed software on Windows 10 it crashes without a comment.
If I do the same but using javacv_platform-1.5.7 all works fine.

The crash occurs at the code sequence:
FFmpegFrameGrabber myGrabber = FFmpegFrameGrabber.load(Mic Macs Raphael Beau 07 Ca déroule_44100_16_2.wav);
myGrabber.start();

@saudet
Copy link
Member

saudet commented Nov 25, 2022

There's nothing in JavaCPP or JavaCV that changed with regards to strings, but it's possible FFmpeg changed something. Could you try to see if you can open files with avformat_open_input() and a BytePointer using different encodings? It's possible they standardized on UTF-8 or something.

@saudet
Copy link
Member

saudet commented Nov 25, 2022

Yes, it looks like they standardized on UTF-8:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=37787f261639c53998487400e874741c17e85fc6
Please try to use UTF-8 encoding for the filename instead of the platform default.

@HagiHagi
Copy link
Author

Thank you very much.

Yes, the problem is the encoding.

I use Oracle's JDK 8.202
When I start the software in the IDE (Netbeans UTF-8 is set) file.encoding is UTF-8!
When I pack, install and run the software with Oracle Packager on Windows, the file.encoding is the Windows OS encoding cp.... (ansii).
The solution is to make sure the file encoding is UTF-8, this is done by starting the jar with:

java -Dfile.encoding=UTF-8 and and -Dsun.jnu.encoding=UTF-8 mySoftware.jar

Now it works fine!

saudet added a commit to bytedeco/javacpp-presets that referenced this issue Dec 21, 2022
@saudet
Copy link
Member

saudet commented Dec 21, 2022

I've pushed a fix for this in commit bytedeco/javacpp-presets@ae2a14e. With that, you shouldn't need to modify the encoding for the whole application. Please give it a try with the snapshots and let me know if you are still having any issues: http://bytedeco.org/builds/

@saudet
Copy link
Member

saudet commented Jun 6, 2023

Version 1.5.9 has been released with the fix! Thanks for reporting

@saudet saudet closed this as completed Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants