[Libav-user] avformat_open_input() fails with unicode filenames of image files

Tim Hauke mail at tim-hauke.de
Fri Oct 5 22:25:09 CEST 2012


Hello,

I´m using ffmpeg libraries version 0.11.1 on Windows 7 for my 
applications. Now I´ve got a problem with avformat_open_input().
As arguments I hand over to this method a pointer to an AVFormatContext 
allocated with avformat_alloc_context() and a filename as char array 
encoded in utf8. Last two arguments are NULL. The filename is handed 
over from Java code as a JString via the Java Native Interface by using 
GetStringUTFChars().

So generally it works quite well. I´m using it with mp4 , avi, jpg, bmp 
and tif files. But when I try to open an image file (jpg, bmp, tif) 
whose filename contains other characters than from the ASCII charset, 
avformat_open_input() returns -2. For example when trying to open a file 
named with russian characters or filename that contains a german umlaut. 
I think -2 is the "no such file or directory" error code?

I can´t figure out, what the problem is. Video files (mp4, avi) are 
working anytime, no matter what unicode characters the filename 
contains. And image files are working as well, but just with ASCII 
characters in filename. But avformat_open_input() fails when renaming 
the same image file with no ASCII characters.

Can anyone help me? Thanks in advance.

Best regards - Tim


More information about the Libav-user mailing list