-
-
Save riophae/f5694fd2952cb64982689b971ca6ec79 to your computer and use it in GitHub Desktop.
Script to strip various iTunes atoms from purchased AAC files via AtomicParsley.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# usage: stripiT.rb | |
# the original files will be OVERWRITTEN. | |
# Script to remove extraneous/unwanted atoms from iTunes purchased files by way of AtomicParsley. | |
# Output should be comparable to the atoms left over after reencoding the file in iTunes itself. | |
# I only care about songs, so I have no clue how well this applies to video files | |
# Some information taken from: https://code.google.com/p/mp4v2/wiki/iTunesMetadata | |
# atoms to remove: | |
# moov.udta.meta.ilst.apID # apple account email address | |
# moov.udta.meta.ilst.ownr # apple account username | |
# moov.udta.meta.ilst.atID # artist-track ID | |
# moov.udta.meta.ilst.cnID # iTunes Catalog ID | |
# moov.udta.meta.ilst.geID # genre ID | |
# moov.udta.meta.ilst.plID # playlist ID (identifies album) | |
# moov.udta.meta.ilst.sfID # iTunes store identifier (location/number) | |
# moov.udta.meta.ilst.cprt # copyright information | |
# moov.udta.meta.ilst.flvr # bitrate/video size information? | |
# moov.udta.meta.ilst.purd # date purchased | |
# moov.udta.meta.ilst.rtng # Explicit/Clean information | |
# moov.udta.meta.ilst.soal # Album sort name | |
# moov.udta.meta.ilst.stik # media type information | |
# moov.udta.meta.ilst.xid # vendor xID | |
# moov.udta.meta.ilst.----.name:[iTunMOVI] # some embedded plist thing, contains filesize and flavor. | |
# moov.trak.mdia.minf.stbl.stsd.mp4a.pinf # purchase information? | |
# Notes: | |
# [pinf] contains personal info, such as the name attached to the apple account. | |
# It requires --DeepScan to remove. | |
# [apID] contains the email address attached to the itunes account used to purchase. | |
# [purd] contains date/time of purchase | |
# [sfID] contains store information, including the country it was purchased in. | |
# Download AtomicParsley from here: | |
# https://bitbucket.org/wez/atomicparsley/overview | |
def processFile(f_path) | |
command = "AtomicParsley \"#{f_path}\" --DeepScan --manualAtomRemove \"moov.trak.mdia.minf.stbl.stsd.mp4a.pinf\"" | |
["apID","ownr", "atID","cnID","geID","plID","sfID","cprt","flvr","purd","rtng","soal","stik","xid ","----.name:[iTunMOVI]"].each {|atom| | |
command += " --manualAtomRemove \"moov.udta.meta.ilst.#{atom}\"" | |
} | |
command += " -W" | |
process = IO.popen( command ) | |
while ( status = process.gets ) | |
puts( status ) | |
end | |
end | |
path = File.expand_path('.') | |
if File.directory?(path) | |
Dir.glob("#{path}/*.m4a").each do |f_path| | |
puts("Processing: " + f_path) | |
processFile(f_path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment