Tuesday, June 23, 2009

Transcoding video for OLPC XO using VLC on OSX

This is more a note to myself than anything else, but perhaps someone else will find it useful? I certainly find it useful to transfer DVDs over to the kids' OLPC XOs running teapot's Ubuntu intrepid distro for XO.

On OSX using VLC, the following will transcode a video stream/file down to something that will play well without skipping on an OLPC XO 1.0. I.e., a theora/vorbis file named w/ the ogg extension using a 320x240 resolution at 15fps. -You'll wind up with an out.ogg file in the current working directory.

Open an editor and save the following to a file named vlc2xo:

/Applications/VLC.app/Contents/MacOS/VLC -I dummy -vv "$1" \
--sout='#transcode{width=320,height=240,scale=1,vcodec=theo, \
vb=768,acodec=vorb,ab=64,channels=2,deinterlace, \
audio-sync}:standard{access=file,mux=ogg,dst=out.ogg}' \
Make it executable: chmod 755 vlc2xo.sh

Now, you'll be able to open terminal and execute the script with an argument specifying the file or input stream to be transcoded. Examples:

./vlc2xo dvdsimple:///dev/rdisk1
./vlc2xo /Volumes/MyExternalDrive/movies/FoTR/FoTR.iso
./vlc2xo /Volumes/MyExternalDrive/movies/RoTK/

Note: in the first example, dvdsimple is used to avoid dvd navigation issues. Also, you can use diskutil list to get a list of disk devices and enumerate over them using diskutil info [identifier] to identify the dvd drive. Once you identify the /dev/disk#, use /dev/rdisk# w/ the same #. If you know or figure out why we need to reference rdisk# instead of disk#, drop me a comment, I'd like to know...

scruffy:~ ggoebel$ diskutil list
#: type name size identifier
0: GUID_partition_scheme *298.1 GB disk0
1: EFI 200.0 MB disk0s1
2: Apple_HFS Scruffy 297.8 GB disk0s2
#: type name size identifier
0: Resident Evil Extinction *7.6 GB disk1
#: type name size identifier
0: FDisk_partition_scheme *298.1 GB disk2
1: Windows_NTFS Tramp 298.1 GB disk2s1

(and if the dvd's label isn't enough to identify the dvd device...)

scruffy:~ ggoebel$ diskutil info /dev/disk1
Device Node: /dev/disk1
Device Identifier: disk1
Mount Point: /Volumes/Resident Evil Extinction
Volume Name: Resident Evil Extinction

File System: UDF
Partition Type:
Bootable: Not bootable
Media Type: DVD-ROM
Protocol: ATAPI
SMART Status: Not Supported

Total Size: 7.6 GB
Free Space: 0.0 B

Read Only: Yes
Ejectable: Yes
OS 9 Drivers: No
Low Level Format: Not Supported

Media Type: DVD-ROM
Erasable: No

Note: The last example works when pointing to a directory containing the VIDEO_TS and AUDIO_TS directories from a ripped dvd.

The VLC documentation for the format for a stream is:
Stream MRL syntax:

URL syntax:
[file://]filename Plain media file
http://ip:port/file HTTP URL
ftp://ip:port/file FTP URL
mms://ip:port/file MMS URL
screen:// Screen capture
[dvd://][device][@raw_device] DVD device
[vcd://][device] VCD device
[cdda://][device] Audio CD device
udp://[[<source address="">]@[<bind address="">][:<bind port="">]]
UDP stream sent by a streaming server

Sunday, June 7, 2009

Catalyst::View::Mason Documentation ne Implementation

I've got an old gentoo Apache mod_perl Mason site which I maintain for work. Mostly it is used for mining data from our less than desirable issue tracking system (Soffront Track) in order to help make realistic guestimates of what we can deliver and when.

It is running on an old quad xeon box that we'd experimented with, and decided not to use in production. Since work is a "Microsoft" shop, it has long been an item on my todo list to move it over to a windows box... but for some reason, I've never really gotten around to it.

However, a couple years back I did do the least amount of work necessary to get it to run in a windows w/ Catalyst::View::Mason environment. I've changed laptops a couple times since then, Perl 5.10.0 was released and Catalyst 5.8.

So last week, I reinstalled the latest version of all of the above on my laptop so I could take my work with me on the go.

I found that I had to add:
__PACKAGE__->config(use_match => 1);

to my ...::View::Mason.pm for backward compatibility.

What was slightly annoying, is that while this was ultimately easy enough to find and fix... it isn't what the README says (http://cpansearch.perl.org/src/FLORA/Catalyst-View-Mason-0.17/README):

Use "$c->request->match" instead of "$c->action" to determine which
template to use if "$c->stash->{template}" isn't set. This option is
deprecated and exists for backward compatibility only.

Currently defaults to 1, to avoid breaking older code, but new code
should always set this to 0.

(more later... my plane is boarding...)