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

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

Greetings video geeks! 😎

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).

Sony P-Series running 10.10 Meerkat Ubuntu

Sony P-Series
(specifically: win7 era P788K, 8″ 1600×768 display, 2B RAM, GMA 500 graphics, 64GB SSD)

I got this supercute mini-laptop last year

I had been using Ubuntu linux Lucid (10.4) and just upped to Meerkat (10.10). (Both were Netbook Edition).
I’d never gotten video acceleration to work before and was stuck w/ ~1-5 fps video most of the time.

Doing the widely suggested:

sudo add-apt-repository ppa:gma500/ppa && sudo add-apt-repository ppa:gma500/fix && sudo apt-get update && sudo apt-get install poulsbo-driver-2d poulsbo-driver-3d poulsbo-config

bricked my vaio 8-( well, i mean, it gave me root login w/o X/windows ability but… 8-p)
but 2-3 apt-get remove, reinstalls, hunting google later, found the apparent saviour (I did 1000mb from 2000mb recommended here):

sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem=1000mb acpi_osi=Linux"
sudo update-grub

booted clean! *immediately* got ability to use proprietary vaio accessory to output VGA to external monitor (a first!) and brightness up/down hotkeys working. (brightness to work even at all!)
but best of all, video and appearance *and everything* (moving windows, starting applications) was *so much faster* visually!

cmd-line video playback with:
sudo apt-get remove mplayer
sudo apt-get install gnome-mplayer gecko-mediaplayer

so this is *all* i have done, aside from starting w/ vanilla install (with just a few changes to help w/ SSD instead of HD) of lucid upgraded to meerkat.
(personally, i’m still working on getting suspend/resume to work (seems to work but the display doesn’t come back on — been like this the whole time) and to get hibernate to work — prolly will go with some kinda memory stick to dump to)

UPDATE!

suspend/resume working now with change to suggested “gma500 fix”

sudo add-apt-repository ppa:gma500/ppa && sudo add-apt-repository ppa:gma500/fix && sudo apt-get update && sudo apt-get install poulsbo-driver-2d poulsbo-driver-3d poulsbo-config

I think this additional suggestion may have fixed sleep/resume (but it’s possible it was just the gma500/fix related packages in live above:

sudo mv /usr/lib/pm-utils/sleep.d/99video /usr/lib/pm-utils/99video