Initial Linux support for the 5g video iPod - video sync using gtkpod / libgpod [Update]

My video iPod

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones

OK, so I spent some fun time playing around with my 5g video iPod — time for more serious action now.

I have created two patches today which add support for the video iPod to gtkpod, a GTK+ based, platform independent GUI for Apple's iPod.
These initial patches allow you to sync m4v video files to your iPod and watch them there. I will add support for all other video formats which work on the iPod, soon. The patches will be sent to the gtkpod maintainers, of course, in the hope that they can be included in the next release.

Note: This is pre-alpha, barely-tested code! Use at your own risk!

Installation instructions:

  • Get the current CVS version of libgpod. Apply the following patch: libgpod_5g_video_ipod_support.patch (Update: patch no longer needed). Compile and install libgpod.
  • Get the current CVS version of gtkpod. Apply the following patch: gtkpod_5g_video_ipod_support.patch (Update: patch no longer needed). Compile and install gtkpod.
  • Mount your iPod (USB cable): mount -t vfat /dev/sda2 /mnt/ipod
  • Start gtkpod (possibly as root, depending on your system) . Maybe you need to edit the settings and adjust the mount point for the iPod (/mnt/ipod is the default).
  • Click on the "Read" button to read in the iTunesDB from the iPod, click on "Files" to add a video file (e.g. this Apple commercial from 1977), click on "Sync" to upload the file to your iPod.
  • Quit gtkpod, unmount the iPod (umount /mnt/ipod), disconnect the USB cable.
  • Profit!!!1

I get a "Destroying mmap buffer" error every time I sync the iPod, but that's probably a gtkpod bug, and it's non-fatal anyways.

If you happen to own a video iPod, please test the patches and report whether they work! Thanks!

Update 2005-11-19: The libgpod patch is in CVS now (plus a bug which caused MP3s to appear in the "Movies" list is fixed now, too). So you don't need the libgpod patch anymore! I have updated the gtkpod patch (Update: patch no longer needed.), you should now be able to sync almost any video format (m4v, mp4, mpg, mpeg, avi, mov) to your video iPod.
Update 2005-11-24: The current libgpod/gtkpod CVS now contains all the features of my patches, so they are obsolete from now on.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

how to use the gtkpod

How do I open the file gtkpod? Am I supposed to find a way of opening this file on the net or what? Thanks for your help.

gtkpod

gtkpod is a Linux program, you have to install it on your Linux system, then start it like you do with any other program.

Uwe.

link broken

This link is broken, can you please post the script you use?

gtkpod

I don't use any scripts, the standard gtkpod download now includes my changes. Just use the latest gtkpod version...

Uwe.

How-to copy video file to an ipod 5G

I was wandering how to do this for a long time...

1) using GTKPOD create a PLAYLIST named "Videos"
2) put your file there
3) sync
4) enjoy

just wonder why i couldnt(and still cannot) find something like this in any readme file .... sad

Unable to unmount/eject iPod

Now that I am able to mount my iPod when it is connected directly to a USB port on my PC, I still need to unmount/eject it.

What happens now is that exiting gtkpod generates an error telling me that /mnt/ipod was not successfully unmounted. I tried:
[root@mainpc ~]# eject /mnt/ipod
eject: unable to eject, last error: Inappropriate ioctl for device

and
[root@mainpc ~]# umount /mnt/ipod
umount: /mnt/ipod: not mounted

The "Do Not Disconnect" message continues to flash on the iPod's screen.

The "umount" command works every time with my wife's iPod Mini. Do you know what else I can try? I can disconnect it while the "Do Not Disconnect" message is flashing on the screen, but that is asking for trouble.

Many Thanks,
-Jake

Ok, unmounting (as root)

Ok, unmounting (as root) should work if you quit gtkpod before trying to unmount (not sure about eject).

The "Do Not Disconnect" will be there forever, it doesn't change on Linux, regardless of whether the iPod is mounted or not. If the umount succeeded (check with "mount"), it should be safe to remove the iPod.

eject ipod

try "eject sda2",

it should work on every distribution.

gr, paul

Thank You.

Thank you for your help, Uwe. "umount" successfully unmounted the iPod, as verified by "mount".

Also, not like it matters, but the "Do Not Disconnect" disappears on my wife's iPod Mini. Sounds like different iPod HW behaves a little differently on Linux.

I really appreciate your help.

-Jake

Unable to mount video iPod 30GB

So here I am writing about something to which I was unable to find an answer anywhere else. My wife gave me a 30GB iPod with video and I am unable to mount it. My wife also has an iPod Mini, which automounts and works very well with gtkpod.

When trying to mount the video iPod as su:
mount -t vfat /dev/sda2 /media/ipod/
(the mountpoint corresponds to the mountpoint in gtkpod)

I get the following error:
mount: /dev/sda2 already mounted or /media/ipod busy

According to the "mount" command's output, the iPod is not mounted and there is no other device mounted at /media/ipod:
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
/dev/proc on /proc type proc (rw)
/dev/sys on /sys type sysfs (rw)
/dev/devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
/dev/shm on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
automount(pid2449) on /net type autofs (rw,fd=4,pgrp=2449,minproto=2,maxproto=4)nfsd on /proc/fs/nfsd type nfsd (rw)

What I know is that no other device is mounted to /media/iPod and the iPod is not mounted elsewhere. I am using gtkpod 0.99.4-2.

Any suggestions would be greatly appreciated.

Hm, strange. Are you sure

Hm, strange. Are you sure sda2 is correct? Plug in the iPod, then wait a few seconds, then type dmesg. There should be a line which says sda2 (or something else).

Also, try to quit gtkpod before mounting the device, and only start gtkpod after you have successfully mounted the iPod (just guessing)...

Uwe.

Checking dev location

Thank you for your response, Uwe. Per your suggestion, I typed in dmesg and here are the last few lines of the output:
usb 2-1.3: USB disconnect, address 4
usb 2-1.3: new full speed USB device using uhci_hcd and address 5
usb 2-1.3: not running at top speed; connect to a high speed hub
usb 2-1.3: no configuration chosen from 2 choices
usb 2-1.3: USB disconnect, address 5
usb 2-1.3: new full speed USB device using uhci_hcd and address 6
usb 2-1.3: not running at top speed; connect to a high speed hub
usb 2-1.3: no configuration chosen from 2 choices
usb 2-1.3: USB disconnect, address 6
usb 2-1.3: new full speed USB device using uhci_hcd and address 7
usb 2-1.3: not running at top speed; connect to a high speed hub
usb 2-1.3: no configuration chosen from 2 choices

As you can see I disconnected and tried reconnecting a few times, each time a different address was assigned.

I then tried:
[root@mainpc ~]# mount -t vfat /dev/hcd7 /media/ipod

Resulting in:
mount: special device /dev/hcd7 does not exist

Am I reading the dmesg output incorrectly?

-Jake

iPod device

Yes, I think you are ;)

The /dev/hcd7 is definately wrong, there's no such device (I guess you derived that from the "uhci_hcd and address 7", but that's wrong).

The "no configuration chosen from 2 choices" looks not so good, obviously the iPod is not really detected...

Here's what I see after 6-7 seconds after plugging in the iPod (it has to be turned on!):

usb 1-8: new high speed USB device using ehci_hcd and address 6
usb 1-8: configuration #1 chosen from 2 choices
scsi3 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 6
usb-storage: waiting for device to settle before scanning
  Vendor: Apple     Model: iPod              Rev: 1.62
  Type:   Direct-Access                      ANSI SCSI revision: 00
SCSI device sdb: 58605120 512-byte hdwr sectors (30006 MB)
sdb: Write Protect is off
sdb: Mode Sense: 6c 00 00 08
sdb: assuming drive cache: write through
SCSI device sdb: 58605120 512-byte hdwr sectors (30006 MB)
sdb: Write Protect is off
sdb: Mode Sense: 6c 00 00 08
sdb: assuming drive cache: write through
 sdb: sdb1 sdb2 sdb3
sd 3:0:0:0: Attached scsi removable disk sdb
sd 3:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete

I fiddled with my iPod quite a bit, I don't have a standard partition layout (I have /dev/sdb1 or something, you probably will have /dev/sda2 or something)...

The line you'll need to see is something similar to "sdb: sdb1 sdb2 sdb3"...

Does the iPod work otherwise? Does it work with other OSes?

HTH, Uwe.

Hub?

Yes, I do have sda1 and sda2. sda1 is mounted at /boot (I'm assuming that this is my hard drive) and sda2 is throwing up the 'already mounted or /media/ipod busy' error.

The iPod works otherwise. I tried it with iTunes on Windohs 2000 and it worked fine.

Something that I've noticed is that my dmesg output mentions a hub. My iPod was connected to a usb hub and that hub was the issue. I was able to mount the iPod successfully after connecting the iPod directly to one of the USB ports on my PC. Synching works.

Now I have another issue -- unmounting the iPod. I'll start a new thread about this one...

Thank you for your help, Uwe.

sda1 vs. hda1

Be careful, I think you mean /dev/hda1 is your hard drive, not /dev/sda1...

USB devices are usually called sda*, sdb* etc. Normal (IDE) hard drives are called hda*, hdb*, usually. However, there are exceptions (SCSI disks, for example)...

The iPod has multiple partitions, if I remember correctly, sda1 is the first (you cannot do much with that usually), hda2 should be the second one, which you can mount...

h.264 video support

The following patch adds h.264 video support. SourceForge CVS seems down, so I can't check whether it's already in there. I just imported a set of mp4 video files I'd created with Nero Recode on Windows, which gtkpod 0.99.2 was previously unable to import. Yay! :-)


--- src/mp4file-orig.c 2006-04-16 18:22:11.000000000 +1000
+++ src/mp4file.c 2006-04-16 18:21:31.000000000 +1000
@@ -159,7 +159,7 @@

trackId = MP4FindTrackId(mp4File, 0, NULL, 0);
trackType = MP4GetTrackType(mp4File, trackId);
- if (trackType && ((strcmp(trackType, MP4_AUDIO_TRACK_TYPE) == 0) || (strcmp(trackType, MP4_VIDEO_TRACK_TYPE) == 0)))
+ if (trackType && ((strcmp(trackType, MP4_AUDIO_TRACK_TYPE) == 0) || (strcmp(trackType, MP4_VIDEO_TRACK_TYPE) == 0) || (strcmp(trackType, MP4_OD_TRACK_TYPE) == 0)))
{
gchar *value;
guint16 numvalue, numvalue2;

http://www.cafuego.net/stuff/h264.patch.

Nice :) Will test later.

Nice :) Will test later. Please submit this to the gtkpod mailing list for inclusion in the application.

Uwe.

Turns out that although the

Turns out that although the file copies okay and plays okay, some meta info isn't parsed and stored properly. Notably, I had a file lasting -1900 minutes

Will submit patch.

Page not found

If I click on "libgpod_5g_video_ipod_support.patch" I come to a site "Page not found"... i cant download. can you please fix this?

The patches are gone!

The patches are no longer needed and hence removed. Just use the latest gtkpod.

create videos that can be played and seeked

Hi!

I now updated my ipod site http://home.c-otto.de/ipod/ to give hints on how to create and upload videos that not only can be played, but also be seeked :)

Have fun!

videos with seeking

Thanks a lot for the update. I'll try it out as soon as holiday stress permits ;)

whats about mikmodpodzilla

Whats about to port & optimize MikModPodzilla (http://ipodlinux.org/Mikmodpodzilla) for new ipod? ;-) I have iPod Video and want play modules, and more than 23 channels %)

Mikmod + iPodLinux

I haven't looked at the mikmod port for iPodLinux yet, but I'll definately do so. I already have quite a huge TODO list for iPodLinux stuff , expect first announcements and ports in a few days ;-)

Uwe.

Debian packages

Hi all!

I've ave packaged the latest version of gtkpod with Uwe's video support for Debian/Ubuntu. I'm sure both maintainers will update gtkpod soon, but in the meantime: http://www.alextreme.org/debian/gtkpod

Thanks Uwe for hacking this in, works like a charm! :)

alex

np

No problem, I was just scratching an itch ;-)

My experiences

Hello!
I wrote down all my experiences on how to use the new iPod with Linux.
Have a look at http://home.c-otto.de/ipod/
I will add new content as soon as I get it.
Ciao,
Carsten Otto

Superb

But you already knew that ;) thanks for the support man! You rock!

Thanks

Many thanks to you Uwe. After I had strugled a little bit to compile gtkpod from cvs on Fedora Core 4(with your patch included of course), everything worked just fine. Now, I was wondering how can I sync my photos via gtkpod?

Photos and gtkpod

As far as I know this is not yet supported by gtkpod, but work is being done in this direction...

Uwe.

encoding video

Hi, I went and bought an Ipod color 30g this weekend. Cool stuff. I figured out how to rip dvds to play on the ipod. I'm working on a webpage for that, and I'll post it here when I get it done.

any video file

With the ubuntu packages I can sync any video type. But from what I have tested so far I can only play the m4v file for that apple commercial above. Should it play other formats as well? If not, how do you recommend to do the reencode or reformat in linux?

Thanx for the patches, they are great.

Wich ubuntu packages did you

Wich ubuntu packages did you add to have video support ? i cant add videos yet :S

iPod video questions

Hi, you can upload any files you like (my patch allows a few common file name extentions), but the iPod will only play those which it supports. The rest will result in a black image, nothing will happen.

For converting you should be able to use mencoder, handbrake or ffmpeg, but I haven't yet tested either of them.

Uwe.

Converting videos for iPod on Linux anyone?

Very well, now we have a way to sync video to the iPod. However, anyone succeeded in converting a video on Linux for playback on the iPod? I've been struggling with mencoder so far, currently trying handbrake but have not had any luck so far. I'm aware of the required formats as prescribed here http://www.apple.com/quicktime/tutorials/creatingvideo.html but to no avail... Comments anyone?

iPod Linux video conversion

Hi, can you post a link to a sample video you're trying to encode? mencoder, handbrake, ffmpeg (and maybe others) should all work, I didn't try it myself, yet, though.

I'll report back here if I manage to convert something...

Uwe.

I have setup this small

I have setup this small webpage that explain how to convert files to an ipod video compliant video format using ffmpeg. Moreover, it is showing a command line that output a high quality video suitable to watch on your tv from the ipod...

www.boardhell.org/ipod_video

Works great for me

After wrestling a bit with CVS code that didn't compile even before the patches, everything patched cleanly and it works great for me. Nice job.

Send patches!

If you had to wrestle send me (jcsjcs at users dot sf dot net) the patches needed to get the CVS version to compile... Don't let everyone else do the same work all over again.

jcsjcs

New gtkpod patch

Thanks Adam! Make sure to upgrade to the latest CVS and apply the now updated patch, which allows you to upload almost any video file, not just m4v files...

HTH, Uwe.

any video file

Should this mean I can play any video type on my iPOD? I guess not, I've tried uploading a few videos mpeg, avi and m4v and only the last one works the other present a black screen if anything at all. I was using the ubuntu packages.

In anycase, been able to upload the m4v in linux is still great, thanx. How do you go around converting from other formats?

Conversion with ffmpeg

I was able to get video playing using the instructions on this page:
Converting video to play on your iPod with FFmpeg

Seeking didn't work though.
--
Ziga

scripted video conversion

i have slapped together a quick script for the video conversion

use at your own risk ;)

http://www.fiore-consulting.com/convert

and if anyone wants to tell me how to patch gtkpod please feel free to email me at my addy [dfiore@davefiore.com].

resolution

Had a look at your script. Seems useful. It should be noted though that 480 is not the maximum width of a video in the new iPod. The actual max is 480*480 (230400) pixels total. 608x256 for instance will work just fine, as 608*256 (155648) < 230400. Not that it shows up well on the iPod screen of course, but maybe with an AV-out cable ;)

Point being, you don't have to cram a 16:9 video into 480x480.

Script and gtkpod

Hi Dave, thanks for creating the script, will try it out soon. The patches are obsolete, just use the latest gtkpod CVS version...

HTH, Uwe.

iPod video format

Hi, you can upload any files you like (my patch allows a few common file name extentions), but the iPod will only play those which it supports. The rest will result in a black image, nothing will happen.

Uwe.

Hi! Can you tell me how good

Hi!

Can you tell me how good the new ipod works generally (transferring songs) with gtkpod nd synchronization of the calendar? does t already work with 0.94?

iPod and gtkpod

Hi, just mount the iPod, start gtkpod, click on the "Read" icon to load the information about which songs are already on the iPod, and then add more songs with "Files". Finally, click "Sync" to transfer the new songs to your iPod.

Calendar isn't supported yet, I think — but I might be wrong.

HTH, Uwe.

problem at compile time

I have at less 2 problems. The first is with itdb_shuffle_write from libgod which take 3 parameters in .h but only 2 are given (gchar* mp ??) and the second with lex (it seems). Any idea ?

We build ubuntu breezy packages

Hi there !
A friend build ubuntu breezy packages of libgpod cvs and patched-gtkpod cvs. You can found these packages on my website : http://www.badcow.homelinux.net/