pssturges wrote: 
> Any ideas if it would be possible to make the edit as a find and replace
> or something similar in my script? I've never done hex editing.
Hex editing is just editing a file as a series of bytes and altering
values by typing in hex value of a byte (e.g. 0x41 instead of 'a') -
commonly done on binary "files" such as disk sectors or executable
files.
Hex editing is needed on the m4a files as the change is precise & low
-level and couldn't be done with a text editor.

Scripting a change is hard because most tools for hex/binary editing are
not geared to be used in scripts.  I found a tool "bbe" which is a
binary version of sed.  It is readily available for many distros.

This command line edits a file called "input.m4a" and changed output is
called "output.m4a".
The file input .m4a MUST have the file header at the start so you must
either use " -movflags faststart" in the ffmpeg command or qt-faststart
afterward on the m4a file.

The bbe command that will change the 16bit field to 24 bits is below. I
have only tested this on two file. It is a byte sequence search &
replace and I have limited to search to first 800 bytes in the file to
avoid any accidental changes in audio stream. Pattern delimiter in
search is "/" - they are hard to see.


Code:
--------------------
    
  bbe --block=0:800 -e 
"s/\x00\x48alac\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x10\x00/\x00\x48alac\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x18\x00/"
 -o output.m4a input.m4a 
  
--------------------


A "colour" version of the pattern to show the parts - first part matches
a sequence starting with the green "alac" tag sequence (length 0x0048) 
which has the 0x10 value to be replaced by 0x18 - no other changes in
bytes between red "/"
s/\x00\x48alac\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x10\x00/\x00\x48alac\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x18\x00/


------------------------------------------------------------------------
bpa's Profile: http://forums.slimdevices.com/member.php?userid=1806
View this thread: http://forums.slimdevices.com/showthread.php?t=102059

_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter

Reply via email to