Tag Archives: osx

Selecting Python version in MacPorts

List installed versions:

port select --list python

Select the preferred version, e.g.

sudo port select --set python python27

For more info:

port help select

Start OS X in Safe Mode

Set safe mode:

sudo nvram boot-args="-x"

Reset:

sudo nvram boot-args=""

Recover lost administrator password in OS X (Lion)

Restart the computer in single user mode:
Restart and hold Cmd+s

fsck -fy
mount -uw /
rm /var/db/.applesetupdone
reboot

After reboot is completed, go through the wizard. Open System Preferences –> Users and Groups –> reset password of the previous (original, non-root) user.

Reboot and login to the original user.

Useful ffmpeg Commands

Create a FLV video from images:

ffmpeg -r 20 -b 1800000 -i /path/to/myimages%03d.jpg  /Users/macbook/Desktop/out.flv
ffmpeg -s 600x400 -r 20 -b 1800000 -i /path/to/myimages%03d.jpg  /Users/macbook/Desktop/out.flv

Extract images from a video:

ffmpeg -i myinput.avi -r 30 -f image2 folder/myimage%04d.png

Extract images from a video with a fractional frame rate and same image quality:

ffmpeg -i /path/to/myvideo.mov -r 1/2 -sameq outputimages%03d.jpg

Resize + convert (order is important):

ffmpeg -i /path/to/inputvideo.mp4 -s 200x150 /path/to/outputvideo.mov

Convert for ZS4 Video Editor:

ffmpeg -i /path/to/inputvideo.mov -vcodec rawvideo /path/to/outputvideo.avi
ffmpeg -i /path/to/inputvideo.mov -acodec pcm_s16le -vcodec rawvideo /path/to/outputvideo.avi

Display duration:

ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 /path/to/sound.aiff

Create video with sound from images + audio file:

ffmpeg -framerate 24 -start_number 1 -i screen-%04d.tif -i 02.aiff -c:v libx264 -r 24 -pix_fmt yuv420p -c:a aac -strict experimental output.mp4

Loop x times and export:

for i in {1..10}; do printf "file '%s'\n" input.mp4 >> list.txt; done
ffmpeg -f concat -i list.txt -c copy output.mp4

Change aspect ratio by cropping:

ffmpeg -i input.mp4 -vf "crop=in_w*3/4:in_h" -strict -2 out4x3.mp4