HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: All_Wound_Up on 2021-10-19 22:12:11

Title: Is It Possible To Use "--output-prefix" With An Absolute Path?
Post by: All_Wound_Up on 2021-10-19 22:12:11
I can compress a wav file using an absolute path:

flac /data/all/temp/a/1.wav

If I try to put the output file in a different directory it throws an error:

flac --output-prefix=/data/all/temp/b/ /data/all/temp/a/1.wav

However, if I don't use an absolute path for the input file it does work:

cd /data/all/temp/a/
flac --output-prefix=/data/all/temp/b/ 1.wav

Here's the error:
Quote
1.wav: ERROR initializing encoder
       init_status = FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR
       state = FLAC__STREAM_ENCODER_IO_ERROR

An error occurred opening the output file; it is likely that the output
directory does not exist or is not writable, the output file already exists and
is not writable, or the disk is full.

Is that just something that's not supposed to work or have I made a mistake?
Title: Re: Is It Possible To Use "--output-prefix" With An Absolute Path?
Post by: danadam on 2021-10-20 17:06:49
In your example flac will try to write to

/data/all/temp/b//data/all/temp/a/1.wav

and it will fail because directory

/data/all/temp/b/data/all/temp/a

probably doesn't exist. In other words, flac doesn't strip the directory part from inputs before concatenating them with output prefix.
Title: Re: Is It Possible To Use "--output-prefix" With An Absolute Path?
Post by: All_Wound_Up on 2021-10-20 18:16:10
Ah, thanks very much! I'll just "cd" into the right directory each time then. Glad it's not me going crazy :-)