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:

#!/bin/sh
/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}' \
vlc:quit
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
/dev/disk0
#: 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
/dev/disk1
#: type name size identifier
0: Resident Evil Extinction *7.6 GB disk1
/dev/disk2
#: 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

Drive Type: CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-R, DVD-RW, DVD+R, DVD+RW
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:
[[access][/demux]://]URL[@[title][:chapter][-[title][:chapter]]]

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

Comments

  1. Why not use Handbrake? Because they stopped supporting OSX 10.4 (Tiger). I spent the odd hours over a couple evenings trying to use handbrake, mplayer, mencoder, etc. ...only to find that the trusty copy of VLC which was already installed could do it all :)

    Note, there was an issue which prevented me from using VLC's gui 'export' wizard. It would fail to produce audio in the transcoded video. I recalled a comment I'd run across about libvorbis being limited to 2 channels. -Which is why I wound up figure out VLC's command line syntax.

    ReplyDelete
  2. Thanks for posting the script garrett. Well done and very useful.

    A few notes for anyone who uses this: when you save the script in a text file (using textedit in your apps folder), add the .sh suffix.

    ./ will run a script, so when you open a terminal you need to navigate to where you saved the script. if you dont want to worry about finding it, just save the script in your user folder.

    Last, you can simply drag the file you want to convert into the terminal window instead of typing the path, which is very useful if there are spaces in the path and name. Example ./vlc2xo.sh (type a space then drg the file into the window, hit return and let it run)

    Cheers to garrett for posting the script and figuring out the command line syntax!

    —Chris

    ReplyDelete

Post a Comment

Popular posts from this blog

Raku: Setting up Raku (for Contributors)

Raku: Advent of Code 2020 - Day Twelve

Raku: Advent of Code 2020 - Day Ten