Change Windows type line endings to Mac

To convert files from windows (or DOS) type line endings to UNIX or Mac flavor use “flip”

Convert DOS or Windows line endings to Unix or Mac

flip -d <filename>

Convert Unix line endings to Windows

flip -u <filename>

To install flip on Mac:

sudo port install flip

To install flip on Ubuntu Linux

sudo apt-get install flip

How do you know your line endings are DOS or Windows flavor? Open your text file with a plain text editor. If you see a “^M” at the end of every line then your line endings are DOS/Windows.

From the flip Usage instructions

Usage: flip [-t|-u|-d|-m] filename[s]
   Converts ASCII files between Unix, MS-DOS/Windows, or Macintosh newline formats
      -u  =  convert file(s) to Unix newline format (newline)
      -d  =  convert file(s) to MS-DOS/Windows newline format (linefeed + newline)
      -m  =  convert file(s) to Macintosh newline format (linefeed)
      -t  =  display current file type, no file modifications

Encode PSP video with ffmpeg from command line

For various reasons, incompetence being high on the list, I cannot get fffmpegX to encode a decent video for PSP. It always comes out with a poor aspect ratio or the sound is out of sync or it doesn’t play on the PSP. I must have tried to use ffmpegx at least a dozen times without any decent results.

So, I figured the next best way is to encode PSP video using ffmpeg from the command line on my mac. I was getting a lot of error messages like Unknown codec 'libxvid' and Unknown codec 'libaac' and just about any other video codec I tried. If the codecs are unknown that means they may not be enabled in your install of ffmpeg. To add codecs to your ffmpeg, I suggest you re-install ffmpeg using port install.

Ports is the easiest way to manage ffmpeg on Mac OS X. A great explanation to install ffmpeg using ports can be found in this article — HOWTO install and use FFmpeg on Mac OS X Leopard » Hay Kranen

Taking his commands, I added +faac and +faad to my ffmpeg installation.

port install ffmpeg +gpl +lame +x264 +xvid +faac +faad

Originally I had installed ffmpeg without any extra codecs (port install ffmpeg). That is the wrong way to do it. To have a fully usable ffmpeg you need to add various codecs like libaac, libxvid, and libx264 as listed above.

Second, you encode the video. The only command that I found to work for me was at Robert Swain’s PSP video guide.

ffmpeg -i INPUT -acodec libfaac -ab 128k -ar 48000 \
-s WIDTHxHEIGHT -r FRAME_RATE -vcodec libx264 -b BIT_RATE \
-flags +loop -cmp +chroma \
-partitions +parti4×4+partp8×8+partb8×8 \
-me_method umh -subq 6 -trellis 1 \
-refs 2 -bf 1 -coder 1 -me_range 16 -g 300 -keyint_min 25 \
-sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 4M \
-bufsize 4M -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 21 \
-threads 0 OUTPUT.mp4

I don’t know what half of this stuff is but I do know you replace the ALLCAPS stuff with your own settings. I had success with these parameters for a 16:9 source video:

 -s WIDTHxHEIGHT = 368×208
 -r FRAME_RATE = 29.97
 -b BIT_RATE = 500kb (or 500000)
 -bt BIT_RATE = (I deleted this piece)

Textile Module for Drupal 6

As of this writing the Textile module is not available for Drupal 6. The latest current downloadable version is for Drupal 5.x.

Rather than downloading a full tar or gz file, there is a patch available. Drupal 6 Patch. Here’s how to do it. Works for Linux and Mac

  • Patch the files (cd into your textile dir)

patch < textile.info_.6.patch
patch textile.install < textile.install.6.patch
patch textile.module < textile.module.6.patch

Syndicate content