Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label mp3. Show all posts
Showing posts with label mp3. Show all posts

2009-07-21

HOWTO: generate .m3u playlist from .mp3 directory

Been trying to find a solution to this one for ages. Turns out it's stupidly simple - just dump the results of a find into a file.

#!/bin/bash
dir="$1"
echo "Create playlist for $1 ..."
if [[ $2 ]]; then list="$2"; else list="$1"; fi

pushd "$dir" 2>&1 >/dev/null
find . -type f -name "*.mp3" > "$list.m3u"
echo "Found these files:"
cat "$list.m3u"
popd 2>&1 >/dev/null

With or without the "./" prefix on each found file, the resulting .m3u files work on my Blackberry (and are found automatically), including nested folders and paths with spaces. To run the above, just do this:

$ ./m3u.sh "artist folder/disc folder" "playlist name"

2008-11-22

Is there a MIDP 2.0 Music Player that does Ogg?

Having switched from ubuntu to Fedora and from .mp3 to .ogg and .flac, I've been looking for a player for my Sony Ericsson W810i... at least until such time as I finally settle on a Blackberry.

Here's what I've tried...

  • jorbis 0.0.17 - unusable UI (won't play); sources provided (no precompiled binary) won't compile with anything less than JDK 1.3; my phone requires CDC-1.1/MIDP 2.0, so this one's a non-starter
  • jOggPlayer 1.1.6s - works on linux with .ogg; ugly UI; won't compile locally with CDC-1.1 (no JApplet class) or JVM 6.0 (missing kiwi.io.* classes in source bundle); precompiled binary won't install on phone
  • jlGui 3.0 - works on linux with .mp3 and .ogg; WinAmp-skinnable; requires JDK 1.4 (won't install on phone)
  • jlGui 2.x - requires JDK 1.3
Does anyone know of a good .ogg or .flac player for MIDP 2.0 devices? None of the ones I tried above work.

2008-09-29

From DVD to online Flash video with dvd::rip, FFmpeg, and JW FLV player

Last week I set myself the task of finally figuring out how to convert a DVD to Flash video, then to post it online. Turns out with the latest xubuntu 8.04, dvd::rip, FFmpeg, and the JW FLV player, it's quite straightforward.

Step 1: Convert a DVD to AVI file (.avi)

After a number of tests with dvd:rip 0.98.6 (installed .deb version: 1:0.98.6-0.0ubuntu1) and transcode 1.0.2 (installed .deb version: 2:1.0.2-0.8ubuntu7), I've settled on this configuration:

Storage
  • On the fly
Clip & Zoom
  • Autoadjust or No modifications (original size)
Subtitles
  • Activated for rendering
Transcode - Video
  • AVI/Xvid, 50 keyframes,29.97 video framerate
  • Single pass encoding, no deinterlacing
  • 1 x 850M (for 2hr DVD track)
Transcode - Audio
  • MP3 audio @ 128 kbit/s x 44100 Hz (required for .flv conversion)
  • Quality 2
  • Nice 0 or 19
  • No PSU core

I managed to rip a 2hr DVD track in about 4 hrs, resulting in an 850M AVI file. This was using my new Samsung 20X USB DVD-RW drive (TSSTcorp CDDVDW SE-S204N), writing to my Western Digital 160G USB bus-powered hard drive. Considering USB to USB read-and-write tends to be slow, I'd consider this pretty good performance, especially for a 1.6GHz machine with only 1.2Gb of RAM.

Here's the resulting .dvdrip-info file:

Step 2: Convert an AVI file (.avi) to Flash Video (.flv)

The next step is to convert your .avi to .flv using FFmpeg (installed .deb version: 3:0.cvs20070307-5ubuntu7.1+medibuntu1). There are lots of config options for this, but the simplest is this, where file types is determined from the input and output filenames. If your input file includes MP3 audio @ 128 kbit/s x 44100 Hz, you'll be able to convert to Flash Video (.flv):

ffmpeg -i input.avi output.flv

Step 3: Streaming Online

Finally, to post the video online, you can upload host it on your own site using the JW FLV Player. The site includes tons of examples including this one for creating a player with chapter, thumbnails, and decriptions. In addition to video, the player also works with audio files and still images, and can be skinned a number of different ways.

2007-04-19

DRM Packaging for Linux

In order to put .mp3s on my new SE W810i phone as ringtunes, I have to convert them first to .dm files. This is a pain, but it could be worse. So, I found SonyEricsson's DRM Packager, installed it, and it works great. Unfortunately, they only provide this tool for Windows and Mac.

So, naturally, it was time to write a Linux implementation. ;-)


Setting up the DRM Packager for use with Linux is easy. Packaging is faster on a native Windows system (seconds instead of milliseconds), but then you have to actually boot Windows, so overall it's still faster.

I'm currently using the following tools for converting MP3s to ringtunes:

  1. mp3 slicing: kwave sound editor, part of KDE (save as uncompressed .wav files)
  2. mpeg compression: lame or sneetchalizer (.mp3 or .mp4)
  3. DRM packaging: Sony Ericsson's DRM Packager tool -- details below (.dm)
  4. copying files to device: Konqueror, part of KDE (drag and drop from hard drive to usb device)

DRM packaging

  1. Download 'DRM Packager 1.35 - Windows' from Sony Ericsson's site.
  2. Install from Executable (using WINE) to default location, eg: ~/.wine/drive_c/Program Files/Sony Ericsson/DRM Packager/.
  3.   wine ~/DRMPackager-1.35-Windows.exe
  4. If your WINE instance doesn't use z: as the drive for the filesystem root (/), edit drmpack.sh and change to s: or whatever your WINE wants.
  5.   rootDir="z:"; # wine directory mapping
  6. Run drmpack.sh to convert a single file or recurse through a directory of .mp3 & .mp4 files, in order to generate .dm files. For syntax help, run w/o commandline options or read the source.
  7.   nickb@nickbdesk:~/ringtunes $ ./drmpack.sh tunes
    
      Processing directory /home/nickb/ringtunes/tunes ...
      Creating /home/nickb/ringtunes/tunes/neuroticfish_shortcommercial.dm ...
      Creating /home/nickb/ringtunes/tunes/neuroticfish_theyrecomingtotakemeaway.dm ...
      Creating /home/nickb/ringtunes/tunes/placebo_runningupthathill.dm ...
      Creating /home/nickb/ringtunes/tunes/placebo_postblue.dm ...
  8. If you prefer a GUI, use DRM Packager.desktop to launch the GUI tool using WINE, then browse for files to add to the GUI, and click 'Create DRM Content'. For Sony Ericsson W810i, DO NOT CHANGE THE DEFAULT SETTINGS! You can launch the GUI from the commandline with:
  9.   wine "c:\Program Files\Sony Ericsson\DRM Packager\DRMPackagerGUI.exe"
  10. If the GUI won't open, try copying MSVCP60.DLL into the DRM Packager install folder. If you don't have a Windows machine handy to grab this file from, Google for a site like http://www.dll-files.com/dllindex/dll-files.shtml?msvcp60 you trust and download it from there.

Tested with:

  • Sony Ericsson W810i phone
  • Sony Ericsson DRMPackager-1.35-Windows.exe
  • WINE 0.9.9-0ubuntu2
  • MEPIS Linux 6.0 (based on Kubuntu 6.06LTS)
  • Windows XP Pro SP2
  • Thinkpad T60p