Tag Archives: geek

new “php-htm-mode” for emacs — intermixed PHP, HTML, JS, and CSS using multi-modes

I finally formalized, cleaned up, and packaged up my current emacs editing setup for files with intermixed PHP, HTML, JS/javascript, and CSS code all in the same file.  It uses an existing but rarely used technique called “multi-mode” and sets “trigger points” for switching the “major mode” of the buffer as your cursor moves through the code.

A nice thing about this approach is that you can always glance down anytime you are editing to see which mode you are in (or the emacs lisp code *thinks* you are in).  You can also fork/edit the single “.el” lisp file to add/update the triggers for various modes.

https://github.com/traceypooh/php-htm-mode

Screenshot:

screenshot of php-htm-mode

screenshot of php-htm-mode

Posted in linux, macosx, technical | Tagged , , , , , , , | Leave a comment

How to turn Time Machine from disk with many partitions to single partition (logically “extending” Time Machine partition)

The high-level answer is:  

  • use macosx Disk Utility
  • make a .dmg of Time Machine partition (to another disk)
  • wipe out disk
  • restore .dmg
  • extend partition to full size (or whatever size you want) of disk

Detailed steps:

  1. backup one last time with Time Machine
  2. turn off Time Machine via preferences
  3. open Disk Utility (builtin mac app)
  4. select the partition where your Time Machine backups are
  5. hit the “New Image” icon in top bar — use the default options (with “.dmg” suffix, no encryption)
  6. save the .dmg to another disk that has space (this takes awhile)
  7. once that’s done, you can re-partition using Disk Utility the disk that originally had your Time Machine partition on it.  (WARNING THIS WIPES OUT ENTIRE DISK AND ALL PARTITIONS!)  Select each partition on the disk and hit the [-] icon near the bottom of the partition list.  BE VERY CAREFUL AND MAKE SURE YOU HAVE IDENTIFIED THE RIGHT DISK!
  8. your disk is now empty…
  9. repartition the disk however you like — since Time Machine uses its own subdir, I suggest partitioning the disk to a single partition, full extent of the disk
  10. with the emptied disk still selected, hit “Restore” button/tab to the right
  11. find the .dmg you made previously as your Source
  12. drag the emptied partition (where you want Time Machine backups to go) to the Destination
  13. hit the “Restore” button (bottom right)
  14. it will ask you to approve scanning/verifying .dmg (yes/OK)
  15. (this takes awhile)
  16. resize your restored Time Machine partition to full disk (or whatever size you want)
  17. turn back on Time Machine backups
  18. approve the question about “disk has moved…”

PS: you can also you this technique to move an entire set of Time Machine backups from one disk to another disk (without losing all your backups!)

Posted in macosx | Tagged , , , , | Leave a comment

simple way to make h.264 mp4 web and iOS/mobile playable video mp4 files for linux and macosx using ffmpeg

Greetings video geeks! 8-)

At my job, I’ve updated the process and way we create our .mp4 files that are shown on video pages on archive.org

It’s a much cleaner/clearer process, namely:

  • I opted to ditch ffpreset files in favor of command-line argument 100% equivalents. It seems a bit easier for someone reading the task log of their item, trying to see what we did.
  • I no longer need qt-faststart step and dropped it. I use the cmd-line modern ffmpeg “-movflags faststart”

Entire processing is now done 100% with ffmpeg, in the standard “2-pass” mode
As before, this output .mp4:

  • plays in modern html5 video tag compatible browsers
  • plays in flash plugin within browsers
  • works on all iOS devices
  • makes sure the “moov atom” is at the front of the file, so browsers can playback before downloading the entire file, etc.

Here is an example (you would tailor especially the “scale=640:480″ depending on source aspect ratio and desired output size; change or drop altogether the “-r 20″ option (the source was 20 fps, so we make the dest 20 fps); tailor the bitrate args to taste):

  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 1 -acodec aac -strict experimental stairs.mp4;
  • ffmpeg -y -i stairs.avi -vcodec libx264 -pix_fmt yuv420p -vf yadif,scale=640:480 -profile:v baseline -x264opts cabac=0:bframes=0:ref=1:weightp=0:level=30:bitrate=700:vbv_maxrate=768:vbv_bufsize=1400 -movflags faststart -ac 2 -b:a 128k -ar 44100 -r 20 -pass 2 -acodec aac -strict experimental -metadata title=’”Stairs where i work” – lame test item, bear with us – http://archive.org/details/stairs’ -metadata year=’2004′ -metadata comment=license:’http://creativecommons.org/licenses/publicdomain/’ stairs.mp4;

Happy hacking and creating!

PS: here is the way we compile ffmpeg (we use ubuntu linux at work, but this script works on macosx, too).

Posted in linux, video | Tagged , , , , , , | Leave a comment

convert yuvj420p to yuv420p (chrome playable!) mp4 video (eg: canon/nikon video)

hooray!

found a nice (video lossless, best i can tell) way to convert the video from cameras like my Canon ELPH SD1400,
which is *already* h.264 video + PCM mono audio

to a new mp4 container with aac audio. that part’s easy/cake w/ ffmpeg — but the trick to get the h.264
video part to play in chrome browser and/or with a flash plugin is to get the flagged “yuvj420p” colorspace pixels
to be considered “yuv420p”. it seems like the former is >= 8 bits-per-pixel and has a range wider than the 256 values;
while the later is 8 bit per pixel. ( brief info/notes/background )

at any rate, finally found this nice post:

https://blendervse.wordpress.com/2012/04/02/waiving-the-fullrange-flag/

which refers to this modified MP4Box/gpac tree, to switch the “fullrange” color-related flag off:
https://github.com/golgol7777/gpac

and then, voila! i have a nice little script where i can convert my canon ELPH videos to a html5 video tag and flash plugin compatible mp4:


#!/bin/bash -ex

IN=${1:?"Usage: [input video] [output video]"};
OUT=${2:?"Usage: [input video] [output video]"};

# make a hacked version of "mp4box" that can toggle a colorspace-related flag in our video!
if [ ! -e $HOME/scripts/mp4box ]; then
(git clone https://github.com/golgol7777/gpac.git && cd gpac) || \
( cd gpac && git reset --hard && git clean -f && git pull && git status );

./configure --enable-pic --static-mp4box --enable-static-bin
make -j4;

# bonus points: make a *static* binary so if we change linux/OS versions, dont hafta worry!
cd applications/mp4box;
gcc -o $HOME/scripts/mp4box -static main.o filedump.o fileimport.o live.o -L../../bin/gcc -lgpac_static -lm -lpthread -ldl -lz
fi

# demux
ffmpeg -y -i "$IN" -an -vcodec copy video.mp4;
ffmpeg -y -i "$IN" -vn -acodec copy audio.wav;

# convert yuvj420p to yuv420p the cheater way (for chrome and flash plugin playback!)
rm -fv tmp.mp4;
$HOME/scripts/mp4box -add video.mp4#:fullrange=off tmp.mp4

# convert wav audio to aac
ffmpeg -y -i tmp.mp4 -i audio.wav -acodec libfaac -ac 1 -ab 256k -vcodec copy t2.mp4;
qt-faststart t2.mp4 "$OUT";
rm -fv video.mp4 audio.wav t2.mp4 tmp.mp4;

Posted in video | Tagged , , , , , | 2 Comments

google maps upgrades to 8-bit “hi-res” today 8-)

Santa Monica never looked so beautiful!

Posted in pictures | Tagged | 1 Comment

natively compiling ffmpeg, mplayer, mencoder on MacOS Lion (with x264!)

OK, I’ve revamped my script to compile these tools:
ffmpeg
ffrobe
qt-faststart
mplayer
mencoder

on MacOS Lion, using the heads of the trees, with direct encoding support for:
x264
vpx / WebM

http://archive.org/~tracey/downloads/macff.sh.txt

A nice recent update to ffmpeg is the ability to decode/read Apple ProRes, too!

Posted in video | Tagged , , , , | 2 Comments

Laundry for The Empire

20111027-185327.jpg

Should be a fun Halloween!

(they don’t come in black, as pictured 8-)

Posted in pictures | Tagged , | Leave a comment

ifone2 lockup



boom

Posted in pictures | Tagged | Leave a comment