Help - Search - Members - Calendar
Full Version: Cmd line tool for changing offset of FLAC files?
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
torben
I'm looking for a tool that could be run from the command line, and could recursively change drive offset of multiple FLAC files, something like this:

flac_modify -o 6 */*

End result would be the same flac files but with modified offset. Are you aware of something that could do the trick?
A_Man_Eating_Duck
i don't see how you can do this without reripping.

e.g.
if you adjust the flac and take away 6 samples at the start you will be missing the 6 samples at the end.

chromium
Moreover, what is the point? Will you enjoy the audio more if you could do that?
iGold
I think it's impossible to change drive offset in FLAC files without reencoding.

What I do then I need to change it (I'm using Linux and shntool package):
- decode .flac files to .wav
- create .cue file for the tracks (shntool cue *.wav > img.cue)
- join .wav files in one big .wav image (shntool join *.wav, it creates joined.wav)
- if drive offset is positive (it meens I need cut off first N*4 bytes of audio data and add the same amount of zero data at the end) I use something like:
CODE
head -c 44 joined.wav > img.wav
tail -c $((<wav_size>-44-4*<drive_offset>)) joined.wav >> img.wav
dd if=/dev/zero bs=4 count=<drive_offset> >> img.wav
where <wav_size> is size of .wav image in bytes, and <drive_offset> is positive offset of drive where disc was ripped.
- if drive offset is negative the algorithm is a bit more complex:
CODE
head -c 44 joined.wav > img.wav
dd if=/dev/zero bs=4 count=<drive_offset>
tail -c $((<wav_size>-44)) | head -c $((<wav_size-44-4*<drive_offset>)) >> img.wav
Note: you need use absolute value as <drive_offset>, not negative.
- if you wish you can check tracks by ARcue.pl, just edit img.cue and change "joined.wav" to "img.wav", then run ARcue.pl img.cue
- remove unused .wav files (decoded .flac tracks and joined.wav)
- split img.wav back to tracks (shntool split -f img.cue img.wav), remove img.wav & img.cue
- encode back to .flac, tag, rename.

It's possible to write a shell script to do this in one command, even with copying FLAC comments from old files to new but this is a task for someone else smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.