Showing posts with label Creative Zen. Show all posts
Showing posts with label Creative Zen. Show all posts

Sunday, December 28, 2008

libmtp #2

To give libmtp a fair chance I downloaded the lastest released version, compiled and installed it, and retried. I must say the process went smoothly -

./configure
make
sudo make install
./hotplug.sh

(it seems the fedora 8 rpm for libmtp is very old... still I'm avoiding moving from linpus on the aspire one... I was however impressed yesterday by a fedore 10 vmware image... hmm.. q-emu on linpus perhaps?)

The updated mtp-sendtr now prompts for meta-data which is nice. I found giving an empty album name resulted in a seg fault... however, after being more forth-coming with meta-data, it worked!

Starting program: /usr/local/bin/mtp-sendtr u2.avi u2.avi
libmtp version: 0.3.3

PTP: Opening session
u2.avi,u2.avi,(null),(null),(null),(null),(null),(null),00,0,0
Sending track u2.avi to u2.avi
type:avi,8
Title> U2
Album> U2
Album artist> U2
Artist> U2
Writer or Composer> U2
Genre> rock
Track number> 1
Year> 2004
Length> 228
Sending track:
Codec: Audio Video Interleave
Title: U2
Album: U2
Album artist: U2
Artist: U2
Writer or Composer: U2
Genre: rock
Year: 2004
Track no: 1
Length: 228
Storage ID: 0
Sending track...
Progress: 25604828 of 25604828 (100%)
New track ID: 94879
Album doesn't exist: creating...
success!
PTP: Closing session

Program exited normally.

The length I found using
[user@localhost ~]$ tcprobe -i u2.avi
[tcprobe] RIFF data, AVI video
[avilib] V: 29.970 fps, codec=XVID, frames=6856, width=320, height=240
[avilib] A: 44100 Hz, format=0x55, bits=16, channels=2, bitrate=128 kbps,
[avilib] 6856 chunks, 3659103 bytes, CBR
[tcprobe] summary for u2.avi, (*) = not default, 0 = not detected
import frame size: -g 320x240 [720x576] (*)
frame rate: -f 29.970 [25.000] frc=4 (*)
audio track: -a 0 [0] -e 44100,16,2 [48000,16,2] -n 0x55 [0x2000] (*)
bitrate=128 kbps
length: 6856 frames, frame_time=33 msec, duration=0:03:48.761

and simply converted it to seconds.

Perhaps I should give gnomad2 another try, with a later release of libmtp.

Creative Zen, libmtp, gnomad2

Today I've encountered a number of bugs (and unexpected features)... mostly whilst trying to get fast forward, rewind and duration to work on video files transferred to the Creative Zen. After spending a number of hours trying to re-encode the video files with different tools, switches and the like - some heavy googling revealed that the problem might lie with the method I was using to transfer the files onto the device!

A quick test, using Windows to transfer the files instead of Linux + libmtp showed that the transfer method was the problem. MTP is Microsoft's Media Transfer Protocol, and unfortunately (for me) it allows meta-data to be sent 'out of band', ie. not relying on the data embedded in the media files being transferred. The duration of a video clip is one such piece of metadata, and the Zen apparently relies on this metadata when seeking in a video file.

libmtp comes with an (example) tool 'mtp-sendfile' which I'd been using, as well as a 'mtp-sendtr' which perhaps is more appropriate, as it allows meta-data to be specified. Unfortunately it doesn't handle .avi files in the release I have at least.

In the process, of investigating the above, I managed to 'corrupt' data in the Zen, such that it thought all the videos on it were gone. A reboot of the device resolved this.

I then found a blog post http://tiagoboldt.net/blog/creative-zen-linux/ indicating that gnomad2 handles the meta-data correctly. It uses libnjb to communicate with the device (I'm not sure if this is a layer above mtp or beside). Unfortunately it behaved badly on my machine, crashing with a seg-fault, and leaving the Zen hanging.

libnjb is beautifully documented via doxygen, so perhaps I'll read up more on it, and even do some coding to get a working solution :)

Friday, December 26, 2008

Dependencies and video transcoding

Well it seems that I'd made one of the great Fedora no-nos and enable yum repositories for both livna and freshrpms.

This led to the problems below, whilst trying to install transcode -
ffmpeg-libs-0.4.9-0.42.20071121.lvn8.i386 from installed has depsolving problems
--> Missing Dependency: libx264.so.56 is needed by package ffmpeg-libs-0.4.9-0.42.20071121.lvn8.i386 (installed)
Error: Missing Dependency: libx264.so.56 is needed by package ffmpeg-libs-0.4.9-0.42.20071121.lvn8.i386 (installed)

I found an explanation here -
http://linux.derkeiler.com/Mailing-Lists/Fedora/2008-01/msg04547.html

And resolved it by disabling the livna repo, then -
[user@localhost ~]$ sudo yum erase ffmpeg-libs
This was installed from livna, and then re-install my video utilities from freshrpms -

[user@localhost ~]$ sudo yum install transcode
[user@localhost ~]$ sudo yum install dvdrip

[user@localhost ~]$ sudo yum erase libdvbpsi
[user@localhost ~]$ sudo yum install vlc

I was then able to reencode and resize videos for the Creative Zen as follows -

[user@localhost ~]$ transcode -i /mnt/nas/Music\ Videos/input.mpg -y xvid4 -o test.avi -Z 320x240 -w 768,100
(Transcode takes a plethora of options which probably need tweaking... that I'll try to get back to some time)

Connecting to the Creative Zen requires MTP (Media Transfer Protocol), so -

[user@localhost ~]$ sudo yum install libmtp libmtp-devel libmtp-examples

[user@localhost ~]$ mtp-sendfile test.avi test.avi

And surprisingly enough... it works!