Audiobook files with the .m4b extension are being reported as FileType M4A which is correct, but FileTypeExtension is also m4a which is clearly wrong.
Would I not be correct in thinking that FileTypeExtension should actually be set from the file name?
FileTypeExtension is the extension derived from the FileType. The idea is that this could be used to rename the file to add an extension if it didn't have one.
- Phil
Is there actually a way to tell the difference? From what I can tell online, there isn't any difference between m4a and m4b. The m4b extension only exists to let iTunes know that it needs to keep track of what you've listened to (bookmarks).
Quote from: StarGeek on January 01, 2020, 01:09:53 PM
Is there actually a way to tell the difference? From what I can tell online, there isn't any difference between m4a and m4b. The m4b extension only exists to let iTunes know that it needs to keep track of what you've listened to (bookmarks).
Yes, I believe they are the same format and iTunes just uses the extension as an indicator that it's a book.
Quote from: Phil Harvey on January 01, 2020, 01:06:04 PM
FileTypeExtension is the extension derived from the FileType. The idea is that this could be used to rename the file to add an extension if it didn't have one.
- Phil
That doesn't make any sense to me as that makes it redundant since on all files I looked at, both tags are the same (except for case). Seems to me that FileTypeExtension ought to be the extension taken from the file, or is there another tag for that?
In the end I extracted it myself from the filename, but if it already existed as a tag it would save an extra step - and failed script until I discovered the discrepancy and inserted my own fix.
The FileType tag isn't the same as the extension for some files. For example:
% exiftool t/images/ -filetypeextension -filetype -T | sort | uniq
a Mach-O static library
aa AA
aae AAE
afm AFM
aiff AIFF
ape APE
avi AVI
bmp BMP
bpg BPG
btf BTF
cr2 CR2
cr3 CR3
crw CRW
dcm DICOM
dfont DFONT
djvu DJVU (multi-page)
dng DNG
docx DOCX
dpx DPX
dr4 DR4
dss DSS
dv DV
dylib Mach-O dynamic link library
eip EIP
eps EPS
exe Win32 EXE
exr EXR
fits FITS
flac FLAC
flif FLIF
flv FLV
fpf FPF
gif GIF
gz GZIP
hdr HDR
heif HEIF
html HTML
icc ICC
ics ICS
iiq IIQ
indd INDD
inx INX
iso ISO
itc ITC
j2c J2C
jp2 JP2
jpg JPEG
json JSON
lfp LFP
lnk LNK
m4a M4A
mie MIE
miff MIFF
mkv MKV
mobi MOBI
moi MOI
mov MOV
mp3 MP3
mpc MPC
mrw MRW
mts M2TS
mxf MXF
nef NEF
numbers NUMBERS
ods ODS
ogg OGG
opus OPUS
pcd PCD
pcx PCX
pdf PDF
pfa PFA
pfb PFB
pfm PFM
pgf PGF
pict PICT
plist PLIST
pmp PMP
png PNG
ppm PPM
ppt PPT
psd PSD
psp PSP
r3d R3D
ra RA
raf RAF
ram RAM
raw RAW
rm RM
rtf RTF
rw2 RW2
so ELF shared library
svg SVG
swf SWF
tif TIFF
torrent Torrent
ttf TTF
txt TXT
vcf VCard
vrd VRD
wav WAV
webp WEBP
wmv WMV
wtv WTV
x3f X3F
xcf XCF
xmp XMP
zip ZIP
This may make more sense if you realize that some different file types have the same extension. So if you want a unique FileType, it can't be the same as the extension for these files.
- Phil
Quote from: UKenGB on January 02, 2020, 12:43:56 PMYes, I believe they are the same format and iTunes just uses the extension as an indicator that it's a book.
One of the main uses of the
FileTypeExtension is to add/correct filenames that are either missing an extension, such as might be the result of a recovery program, or have an incorrect extension. If there's nothing about the file structure to differentiate between two similar file types, then exiftool can't tell if it's one file type or the other. You would have similar problems with programs like file (https://en.wikipedia.org/wiki/File_(command)) or websites where you upload a file to determine the file type such as CheckFileType.com (http://checkfiletype.com/)
Quote from: UKenGB on January 02, 2020, 12:49:13 PM
That doesn't make any sense to me as that makes it redundant since on all files I looked at, both tags are the same (except for case).
See above.
Quoteis there another tag for that?
No specific tag, but in some cases, such as renaming or using the
-o,
-w, or
-TagsFromFile options, you can use the
%e variable (see the
-w (textout) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut) for details). For other operations you can use
${FileName;s/.*\.([^.]*)/$1/} to just use the extension.
http://f16.eu/bits/wink200.jpg (http://f16.eu/bits/wink200.jpg)
@StarGeek commented whilst I was trying to find the "jpg" in the link.
I see that Firefox does identify the file as a gif but still plays it.
Filename extentions are quite dangerous. I pursuaded (just to see if I could) the person compiling the online telephone directory at work that the photo they had of me wasn't very nice and could they use this one. (It was a slightly different version as I didn't want to give the game away by it winking after only 2 seconds)
(http://f16.eu/bits/wink200.jpg)
Use [img]http://f16.eu/bits/wink200.jpg[/img] or click the (https://exiftool.org/forum/Themes/default/images/bbc/img.gif) button above the text box.
Quote from: StarGeek on January 02, 2020, 06:56:50 PM
Use [img]http://f16.eu/bits/wink200.jpg[/img] or click the (https://exiftool.org/forum/Themes/default/images/bbc/img.gif) button above the text box.
That shows the picture. But it doesn't show that the file extention is .jpg which is what I wanted to show.
Ah, yes of course. Another of my Homer moments.