HowTo: Quick-n-dirty extraction of date inside WAV
Posted: Mon May 23, 2016 3:32 pm
This HowTo describes how to extract the date/time information from inside a WAVE file (.wav), in case the file timestamp was lost.
NOTE: This only works, if the recording device or application wrote the date as metadata inside the WAVE file. This must not always be the case.
This approach uses only common tools, usually available out-of-the-box on any unixoid operating system (GNU/Linux, MacOS, etc).
Here's a one-liner:
NOTE: The Regular Expression "20[0-9][0-9]" only covers dates between 2000 and 2099. Adjust this accordingly.
The output may be a bit rough, since "grep" is intended for text, but now it dumps also binary data from the WAVE header:
Yet, you can see the date/time string (in YYYY.MM.DD notation):
This writes the results to "date.txt".
I've used this to retrieve the date of audio recordings on deleted files, extracted using "Scalpel" - so their file timestamp was lost.
NOTE: This only works, if the recording device or application wrote the date as metadata inside the WAVE file. This must not always be the case.
This approach uses only common tools, usually available out-of-the-box on any unixoid operating system (GNU/Linux, MacOS, etc).
Here's a one-liner:
Code: Select all
$ head -c 10000 *.wav | cat -v | grep -E "20[0-9][0-9]"
The output may be a bit rough, since "grep" is intended for text, but now it dumps also binary data from the WAVE header:
Code: Select all
WAVEfmt ^P^@^@^@^A^@^B^@DM-,^@^@^PM-1^B^@^D^@^P^@LIST.^@^@^@INFOICRD^K^@^@^@2016.05.12^@^@ISFT^N^@^@^@Lavf57.36.100^@data^PM-^U_
If you want to loop over several files, and list filename + "data block with date", you can2016.05.12
Code: Select all
$ for FILE in *.wav; do echo "File: $FILE"; head -c 10000 $FILE | cat -v | grep -E "201[0-9]"; echo ""; done >> date.txt
I've used this to retrieve the date of audio recordings on deleted files, extracted using "Scalpel" - so their file timestamp was lost.