Posts

batch convert MOV files to mp4

 If like me you prefer to not have any MOV files due to their size, you want to convert them to mp4 video. #!/bin/sh # -r = frame rate # -f = output format # -i = input file name # -s = aspect ratio/frame size # -crf = constant rate factor # -pix_fmt yuv420p = quicktime compatible quality="" if [ "$1" == "-d" ] ; then echo "Downscaling quality to 480x360 at 15fps" quality="-r 20 -s 480x360" fi if [ "$1" == "-i" ] ; then echo "Downscaling for old iphone and similar" # for i in `/bin/ls` ; do ( echo $i ; ffmpeg -i $i -threads 0 -strict experimental -f mp4 -vcodec libx264 -vpre slow -vpre ipod640 -b 1200k -acodec aac -ab 160000 -ac 2 -s 480x320 iphone-$i ) ; done quality="-vpre slow -vpre ipod640 -b 1200k -acodec aac -ab 160000 -ac 2 -s 480x320" fi for i in `/bin/ls | grep .[mM][oO][vV]` ; do ( echo "Converting QuickTime file to MP4: "$i nn=`echo $i | sed -e s/\.[Mm][Oo][vV]/\

Remapping keys

Sometimes keys annoy you and you keep typing incorrectly, e.g. from being used to a Windows keyboard or similar. Plus CAPS LOCK is pointless. In my case I kept hitting right alt instead of right command. So I made right alt to also be a command key. hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E6,"HIDKeyboardModifierMappingDst":0x7000000E7}]}' That's all it takes. List of keys here: https://developer.apple.com/library/archive/technotes/tn2450/_index.html#//apple_ref/doc/uid/DTS40017618-CH1-TNTAG8 Command syntax is here: https://developer.apple.com/library/archive/technotes/tn2450/_index.html

Erasing firmware password

Image
On some occasions, like myself, you may be forgetful, and forget what you set your bootup ("firmware") password to. Unfortunately for you, if you boot in recovery mode using Command-R, it still wants you to remember your original password to erase the old one.  The proper way to do this is to take the computer to Apple with proof of purchase and they will do it for you. However, if like me you only buy their much older machines due to their upgradability, you may find that you don't have proof that you bought it in an apple store, e.g. second hand, or you lost the proof years ago. So, how do you reset it? The answer unfortunately, is with great difficulty. This blog page tells you how. Please note that I disclaim responsibility for the below - if you blow up your Macbook it's your fault. Do not follow these instructions. I followed these: https://blog.wzhang.me/2017/10/29/removing-mac-firmware-password-without-going-to-apple.html However, they are not 100% clear on al

Create encrypted disk image or normal disk image on the command line

 I find that the disk utility GUI app is unreliable so I prefer to create disk images on the command line. This is also more efficient if you want to create more than one and don't want to click 100 times to do it.  hdiutil create -size 150m -encryption -type SPARSE -fs HFS+ disimagename.sparseimage If you don't want encryption, remove the -encryption part If you don't want the image file to be size-flexible, remove the word SPARSE and change the extension from .sparseimage to .dmg Obviously, the size 150m means 150 megs. You can change that to g for gigs etc. If you want to encrypt from a specific source folder, use: hdiutil create -encryption -stdinpass -srcfolder source_folder encrypted.dmg This will create the image file out of the folder "source_folder" Without encryption: hdiutil create -srcfolder source_folder not_encrypted.dmg

Force mac to let you create an account

1. Remove the drive 2. Place the drive in another machine 3. Navigate to /var/db  delete the file .AppleSetupDone Alternatively type sudo rm  / var / db /.  AppleSetupDone

How to mark a mac drive as bootable

  bless --mount /Volumes/Macintosh\ HD/ --setBoot assuming the drive name is "Macintosh HD"

Chunk validation failed

When installing Mac OS from the command-R internet recovery boot up, you can use command-L to show the logs. Sometimes you will find that the installation does not happen and you see an error "Chunk validation failed". Apparently this means your SATA cable or hard drive is faulty.  https://apple.stackexchange.com/questions/258522/mountain-lion-reinstall-failure