My Assistant
![]() ![]() |
FLAC support unicode? |
Sep 9 2006, 10:31
Post
#1
|
|
|
Group: Members Posts: 10 Joined: 15-August 06 Member No.: 34062 |
I am a newer for FLAC. I am using FLAC to convert wave files into flac. But if the filename or directory contians Chinese, the tools told me "Error: can not open input file F:\audio\---------------".
FLAC does not support UNICODE? I need to re-complile the FLAC project? Thanks. |
|
|
|
Sep 9 2006, 12:02
Post
#2
|
|
|
Group: Members Posts: 826 Joined: 29-September 04 Member No.: 17374 |
Hi, currently flac tools do not support unicode filenames. But you can work-around this limitation with this script:
QUOTE (flac.cmd) @echo off set encoder="C:\Program Files\flac-1.1.2-win\bin\flac.exe" set tempfile=%random%%random%%random%%random% type "%1" | %encoder% -8 - -o "%~d1%~p1%tempfile%" ren "%~d1%~p1%tempfile%" "%~n1.flac" Copy this to a text file and rename it to "flac.cmd", change the path to flac.exe (marked with green color). Then you will be able to use flac.cmd like this: Examples: F:\audio>flac.cmd 你好世界.wav this will encode to F:\audio\你好世界.flac output file. F:\>flac.cmd \audio\你好世界.wav this will also encode to F:\audio\你好世界.flac This post has been edited by Egor: Sep 9 2006, 12:50 |
|
|
|
Sep 9 2006, 18:54
Post
#3
|
|
![]() Group: Members Posts: 367 Joined: 16-November 03 Member No.: 9867 |
Not true.
I use flac 1.1.2 on linux and unicode (utf-8) works like a charm. I do not use Asian characters, but quite a few Easter European that are not part of the normal ASCII. Maybe Windows is different, I dunno. Triza |
|
|
|
Sep 10 2006, 04:19
Post
#4
|
|
|
Group: Members Posts: 830 Joined: 3-November 05 Member No.: 25526 |
I've had problems with special characters, though some of them work, so I don't believe the FLAC tools support Unicode, at least on Windows.
|
|
|
|
Sep 10 2006, 04:29
Post
#5
|
|
![]() Group: Members Posts: 2526 Joined: 25-July 02 From: South Korea Member No.: 2782 |
Not many command-line encoders seem to support Unicode filenames on Windows; if some characters from the filenames are not in your codepage, you'll get problems.
I'd use foobar2000's converter together with flac.exe to encode using %s %d. (Using pipes seems to create minor problems with seektables.) -------------------- http://blacksun.ivyro.net/vorbis/vorbisfaq.htm
|
|
|
|
Sep 10 2006, 04:42
Post
#6
|
|
|
FLAC Developer Group: Developer Posts: 1526 Joined: 27-February 02 Member No.: 1408 |
I need to make a FAQ out of this but haven't yet... the basic problem is windows' implementation of unicode filenames, which can only be supported via windows APIs (non-portable), and is different for different versions of windows. I searched quite a bit and even major projects like python have rejected supporting unicode filenames because of the complexity of it (at least when I looked).
unicode filenames on pretty much any other system are not a problem. Egor's solution for windows is best I think. Josh |
|
|
|
Sep 22 2007, 08:06
Post
#7
|
|
![]() Group: Members Posts: 161 Joined: 1-December 06 Member No.: 38270 |
Is lack of Unicode support still a problem using Vista?
This post has been edited by MiSP: Sep 22 2007, 08:18 |
|
|
|
Sep 22 2007, 08:28
Post
#8
|
|
|
Group: Members Posts: 826 Joined: 29-September 04 Member No.: 17374 |
|
|
|
|
Sep 22 2007, 15:57
Post
#9
|
|
![]() Group: Members Posts: 161 Joined: 1-December 06 Member No.: 38270 |
Try the workaround mentioned above, or use foobar2000 - it has full Unicode support and some compatibility tricks for commandline encoders like flac.exe. I use the following script found here on the forums (with slight modifications) for recoding FLAC files to the newest version installed: CODE @echo off set encoder="C:\Program Files\FLAC\flac.exe" for /r "." %%d in (.) do (cd %%d & for %%f in (*.flac) do %encoder% --best -V -f "%%f") What I'm after, is making this script also work with unicode names (currently I get the "invalid argument" error). I'll try the workaround described above. Can foobar easily recode all of the FLAC files in my music library fully automatically, just like this script can? Edit: Tested, didn't work. I made a flac.cmd containing exactly what is described above (except for the path), and I used the script above using flac.cmd instead of flac.exe. I got the following error: CODE ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate Type "flac" for a usage summary or "flac --help" for all options Edit #2: I can't help thinking that the two scripts must be merged. Can someone do this for me? I have little knowledge of such scripting... I want the settings and the recursive functionality of the script I mentioned, and the unicode support of the workaround script. This post has been edited by MiSP: Sep 22 2007, 16:39 |
|
|
|
Oct 3 2007, 19:49
Post
#10
|
|
![]() Group: Members Posts: 161 Joined: 1-December 06 Member No.: 38270 |
Bump for great justice! Is anyone able to merge the two scripts mentioned above? I haven't found out how to do it...
|
|
|
|
Nov 24 2007, 20:56
Post
#11
|
|
![]() Group: Members Posts: 161 Joined: 1-December 06 Member No.: 38270 |
Anyone? I just added a few songs to my collection with Unicode filenames, but have not been able to merge the two scripts above...
This post has been edited by MiSP: Nov 24 2007, 20:56 |
|
|
|
Jun 27 2011, 19:41
Post
#12
|
|
|
Group: Members Posts: 10 Joined: 26-June 11 Member No.: 91861 |
Try the workaround mentioned above, or use foobar2000 - it has full Unicode support and some compatibility tricks for commandline encoders like flac.exe. I use the following script found here on the forums (with slight modifications) for recoding FLAC files to the newest version installed: CODE @echo off set encoder="C:\Program Files\FLAC\flac.exe" for /r "." %%d in (.) do (cd %%d & for %%f in (*.flac) do %encoder% --best -V -f "%%f") What I'm after, is making this script also work with unicode names (currently I get the "invalid argument" error). I'll try the workaround described above. Can foobar easily recode all of the FLAC files in my music library fully automatically, just like this script can? Edit: Tested, didn't work. I made a flac.cmd containing exactly what is described above (except for the path), and I used the script above using flac.cmd instead of flac.exe. I got the following error: CODE ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate Type "flac" for a usage summary or "flac --help" for all options Edit #2: I can't help thinking that the two scripts must be merged. Can someone do this for me? I have little knowledge of such scripting... I want the settings and the recursive functionality of the script I mentioned, and the unicode support of the workaround script. Did anyone ever help you figure out how to merge these files? I am having a similar problem with my audio files. I'm hoping that you are still a member of this forum so you can help me out if you had success. I'm having a ton of trouble trying to solve this. I'm wanting this fixed so that I can use a specific audio to play on my outdoor speakers. Thanks for your help. |
|
|
|
Jul 12 2011, 08:59
Post
#13
|
|
![]() A/V Moderator Group: Moderator Posts: 1761 Joined: 30-April 02 From: Slovenia Member No.: 1922 |
Did anyone ever help you figure out how to merge these files? I am having a similar problem with my audio files. I'm hoping that you are still a member of this forum so you can help me out if you had success. I'm having a ton of trouble trying to solve this. I'm wanting this fixed so that I can use a specific audio to play on my outdoor speakers. Thanks for your help. the workaround is to specify the code page of the current system (that is what i do), the bat file may look like: CODE ::flac.bat @ECHO OFF chcp chcp 1250 flac.exe --keep-foreign-metadata "%%1" that would also skip the piping. This post has been edited by db1989: Jul 12 2011, 11:44
Reason for edit: removing gigantic quote
-------------------- PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung |
|
|
|
Aug 27 2011, 08:03
Post
#14
|
|
|
Group: Members Posts: 4 Joined: 27-August 11 Member No.: 93315 |
I had a similar problem a few years back. I had trouble using Unicode in Linux. The trouble I had was mainly related to the use of Asian characters and did fail at most times. And back then I used it on windows and some of the problems were solved just like that and I have been using windows ever since. The characters especially Asian ones doesn’t seem to come up with any more complaints and most of the problems were gone after I started using windows.
|
|
|
|
Mar 18 2012, 22:37
Post
#15
|
|
![]() Group: Members Posts: 1 Joined: 17-March 12 Member No.: 97870 |
To MiSP, whitejason and everybody who is having similar problem )
I could to offer my own version of a workaround to solve the problem with file names in Unicode on Windows. This is exactly as requested in the messages above -- slightly improved recursive script from the MiSP's post combined with the script by Egor. In my edition of the script the basic settings are in a separate section at the beginning (Adjustable parameters). There should be specified the actual path to the flac executable. Moreover, there are settings for the extensions of the source and destination files and a set of options for the encoder. In addition, during the process script prints the current working directory and names of the files which are being encoded at the moment. In my opinion, it's better than seeing only the progress for the current file, which displays flac, not knowing which particular file is re-encoded now. Now a few words about the behavior of the script. The script traverses the subtree rooted at the current directory. In each directory of the subtree, the script enumerates all files with the extension "%srcext%" and passes them through a pipe to the encoder. The result flac writes to a temporary file with a name consisting of the name of the script and the current timestamp. If the processing was successful and the temporary file has been created, it is moved to a file with the same name as the original and the extension "%dstext%". If extensions of the input and the output files are the same, then the original file will be replaced by the newly created. To change this behavior is enough to specify an output file extension different from the original, such as "reenc.flac" or something along the same lines. Below is the current version of the script (reflac.cmd), which has all the functionality described above and requires no additional tools to work: CODE ::
:: This script is a wrapper for the flac command-line tool :: to ensure proper handling of file names in unicode when transcoding :: --------------------------------------------------------------------- :: :: The script transcodes all the files with the given extension :: in the current directory and all subdirectories. If the specified :: extensions of source and destination files are the same :: the original files will be replaced by the resulting. :: :: Before use, you should specify the correct path to the flac :: executable (in adjustable parameters section). In that section :: can also be specified the extensions for the input and output :: files, as well as set of options for the encoder. :: --------------------------------------------------------------------- :: reflac (mar 2012 by jar) :: @echo off setlocal enabledelayedexpansion :: :: Adjustable parameters :: --------------------------------------------------------------------- set "encoder=с:\program files\flac\flac.exe" set "options= --best --verify" set "srcext=flac" set "dstext=flac" :: :: Print the header and create a line for underscore subheaders :: --------------------------------------------------------------------- echo. echo %~n0: transcoding all the .%srcext% files in the current subtree set "maxcol=79" for /l %%i in (1, 1, %maxcol%) do (set "uline=!uline!-") :: :: Traversing the directory subtree transcoding each target file :: --------------------------------------------------------------------- for /r %%d in (.) do ( set "dir=%%d" set "dir=!dir:~0,-2!" pushd "!dir!" set "hasfiles=" for %%f in (*.%srcext%) do ( if not defined hasfiles ( echo. echo %uline% echo directory: !dir! echo %uline% set "hasfiles=true" ) set "timestamp=!time:.=!" set "timestamp=!timestamp::=!" set "timestamp=!timestamp: =0!" set "tempfile=%~n0-!timestamp!.tmp" echo. echo processing: %%f --^> *.%dstext% echo %uline% type "%%f" 2>nul | %encoder% %options% -o "!tempfile!" - if exist "!tempfile!" ( move /y "!tempfile!" "%%~nf.%dstext%" ) ) popd ) endlocal This post has been edited by jar: Mar 18 2012, 22:54 -------------------- just jar
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 3rd May 2015 - 04:30 |