Displaying articles with tag linux
Posted by hank,
Thu Aug 07 02:49:00 UTC 2008
So, you have your Jailbroken iPod Touch or iPhone with 2.0 firmware running OpenSSH, and you have MxTube 1.5 or better, of course. What if you want one of those pesky videos that YouTube deletes all the time, like Paris Hilton For President? Or maybe you want a full movie on your iPod without having to sync to iTunes since you’re stuck in Linux Land. Well, here’s how:
Download the video
This can be done lots of ways, but somehow obtain a version of the video that ffmpeg can read. It can be just about any format. Let’s assume that we get a file called paris.flv.
Convert the video
ffmpeg -i paris.flv -b 500000 -s 176x144 -ac 1 -ab 64000 paris-high.mp4
This will make a nice movie for us to play. Let’s put it on the iPod:
scp paris-high.mp4 root@ipod:/var/mobile/Media/MxTube/
Make the Thumbnail
We need to grab a frame from the middle of the movie. Let’s use mplayer for that!
mplayer -vo jpeg -frames 1 -ss 30 paris.flv
This will make a file called 00000001.jpg. Let’s put that in the right spot:
scp 00000001.jpg root@ipod:/var/mobile/Media/MxTube/paris.thm
Add the video to the Library
Edit /var/mobile/Library/MxTube/VideoLibrary.plist on the iPod. Make a new dict entry in the list like so:
<dict>
<key>author</key>
<string>hank</string>
<key>duration</key>
<string>01:50</string>
<key>high</key>
<string>/var/mobile/Media/MxTube/paris-high.mp4</string>
<key>id</key>
<string>64ad536a6dQ</string>
<key>thumbnail</key>
<string>/var/mobile/Media/MxTube/paris.thm</string>
<key>title</key>
<string>Paris for President</string>
</dict>
Just fill in the right filenames for the thumbnail and movie like you used above. Also, change the author to yourself or the original director, and the duration accordingly. Keep the id something random. Also, you can change the display title as the last option there.
Other Pro Tips
Keep in mind that if you want to be able to delete the movie from the interface, you need to change the ownership on all the files to mobile:mobile using chown.
Results!
Well, it totally works, with sound even.


Good luck!
Tags: linux
Posted by hank,
Wed Aug 06 01:37:00 UTC 2008
Idea
I wanted to put images on my iPod Touch without using iTunes since, as most of us know, there is no good way to use it from Linux. It turns out there is a magic directory on the iPod Touch where it saves images from Safari. I simply looked at how it saved them, and applied it on my box here at home.
Requirements
- Jailbroken iPod Touch (I used WinPWN), with OpenSSH installed and working (the root password is alpine)
- Firmware 2.0 (Though, 1.x may work, I just haven’t tried it)
- A Linux box with a bash shell
- Cool images
convert and mogrify from ImageMagick installed
Method
These instructions might work for the iPhone as well. YMMV
All of your images must be in the format IMG_XXXX.YYY where XXXX is a number < 9999, and YYY is either JPG or THM (THM is a thumbnail). To rename our files, I use a simple trick I outlined in my last post:
EII=4; for i in *.jpg; do ls $i; \
NEWNAME=IMG_00`printf "%02d" $EII`.JPG; \
echo Renaming $i to $NEWNAME; \
mv $i $NEWNAME; EII=`expr $EII + 1`; done
That will rename all the JPEG files in order from 4 to, in my case, 62. Now, I have to make the thumbnails:
for i in `ls *.JPG | cut -d '.' -f 1`; do \
convert $i.JPG -resize 75x75! $i.THM; \
done
The 75x75! part makes sure they are exactly those dimensions. You end up with something like the following:
IMG_0004.JPG IMG_0016.JPG IMG_0028.JPG IMG_0040.JPG IMG_0052.JPG
IMG_0004.THM IMG_0016.THM IMG_0028.THM IMG_0040.THM IMG_0052.THM
IMG_0005.JPG IMG_0017.JPG IMG_0029.JPG IMG_0041.JPG IMG_0053.JPG
....
Now, note that the iPod can only display images under 100KB (to my knowledge). If your high-res image is too large, it will just display the magnified 75x75, which is really ugly. So, make sure all your images fit that description, and if they don’t, mogrify -resize them until they do (or take other measures as necessary). I used this:
mogrify -resize 400x *.JPG
All my images turned out to be between 30 and 90 KB. This also keeps the aspect ratio, unlike the 75x75!.
Now, SSH into your iPod (if you can’t do this yet, google it). You should have the following file:
/var/mobile/Media/DCIM/.MISC/Info.plist
Open this file in vi, and observe the plist>dict>integer part of the hierarchy:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastFileGroupNumber-100</key>
<integer>62</integer>
</dict>
</plist>
So, I put 62 in there since the last image I have is numbered 0062. It’s a very simple idea. Now, just load them onto the iPod:
scp IMG_00* root@ipod:/var/mobile/Media/DCIM/100APPLE/
Let’s have a look from the iPod console!
HanksTouch:/var/mobile/Media/DCIM/100APPLE root# ls
IMG_0002.JPG IMG_0014.THM IMG_0027.JPG IMG_0039.THM IMG_0052.JPG
IMG_0002.THM IMG_0015.JPG IMG_0027.THM IMG_0040.JPG IMG_0052.THM
Beautiful. Now, to test it…
Tags: linux
Posted by hank,
Wed Aug 06 00:34:00 UTC 2008
I made a cool one-liner in bash today that renames files sequentially. Here’s an example that takes all the JPEGs in a directory and renames them in order:
EII=4; for i in *.jpg; do ls $i; \
NEWNAME=IMG_00`printf "%02d" $EII`.JPG; \
echo Renaming $i to $NEWNAME; \
mv $i $NEWNAME; EII=`expr $EII + 1`; done
Pretty cool, huh? This is in relation to my next post. Keep watch…
Tags: linux
Posted by hank,
Fri Jul 04 00:26:00 UTC 2008
The new July 2nd version of Flash Player 10 for Linux finally fixes the HTML overlay bug that we’ve been seeing for years. You can now see things on top of the flash elements on the page, like so:

Get it now!
Update
After trying it with YouTube and TheSixtyOne, and seeing some lame bugs, I decided to go back to Flash 9 and face the music on overlays.
Tags: linux
Posted by hank,
Mon May 26 19:52:00 UTC 2008
I decided after reading this article, I decided to try out SWFDec instead of Adobe Flash Player. I shied away from Gnash early on since it didn’t support many newer features of Flash, and it didn’t work with YouTube. But, apparently, SWFDec works with YouTube (I just tried it), and according to the article above, my browser may use less resources now. We’ll see.
Update
Well, it turns out it crashes on my TheSixtyOne player on the right! Time to try Gnash…
Update 2
Experiment over. The OSS Flash solutions completely fail at playing the flash audio on the right. Once they get just a little more compatible, I’ll try again.
Tags: linux
Posted by hank,
Sat Mar 22 12:27:00 UTC 2008
I wanted to speed up package downloading to set up my apt-proxy today in Gutsy, so I decided to find the correct way to find the fastest Ubuntu mirror. It’s actually done like so (stolen from here):
- Click on “System | Administration | Software Sources”
- Under “Ubuntu Sotware” tab, choose “Other” in the “Download from” list box.
- Choose your country and then click “Select Best Server” and choose the recommendation.
This automatically updates the /etc/apt/sources.lst file. The same utility can also be reached from the Synaptic Package Manager, through “Settings | Repositories”.
In action:

It says mirrors.rit.edu is the best one for me. Makes sense.
Tags: linux
Posted by hank,
Sat Dec 01 17:56:00 UTC 2007
If you, like me, were having issues like the following:
Depends: libpango1.0-0 (>=1.18.3) but 1.18.2-0ubuntu1 is to be installed
The solution is adding this to your /etc/apt/sources.list:
deb http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ gutsy-updates main restricted
Apparently, they only put the new libpango libraries into gutsy-updates. That’s kinda lame IMHO.
Tags: linux
Posted by hank,
Sat Nov 24 19:46:00 UTC 2007
So, I have all these JPEGs, and I want to know which ones are corrupt (specifically, ones that end prematurely). qiv will spit out the following to STDERR when it finds one:
Premature end of JPEG file
So, this is nice, except it’s entirely unscriptable. The solution I found was using the following script to the display the images in sequence:
perl -e 'for(glob("*.png *.jpg")){$output = `qiv "$_" 2>&1;`; if($output =~ /Premature/){print $_, "\n";}}'
All this does is mix STDERR with STDOUT for a qiv of the file, and check the output for the word “Premature”. If it finds the word, it prints the filename. Simple.
The only problem is that qiv doesnt have a way to just check whether a JPEG file is corrupt (and if there is a command line utility that does, please let me know). To make it go thru the list, I wrote this little gem:
while(true); do xte "key q"; done
All this does is send the q key to the Xserver infinitely. All I have to do is put focus on the first qiv window to make it and all subsequent qiv windows receive q’s. So, just run it, and click on the window. Then there are lots of flashes, and eventually that perl script will print out the names of the bad files. It’s totally ghetto, but it’s the best I’ve got right now. The point of this post is to hopefully find new ways to do this more programmatically.
Tags: linux
Posted by hank,
Sun Nov 11 02:07:00 UTC 2007
Notice that I can do a -g for a progess bar! Yay! Now for an action shot:
hank@rofl:~/tmp/coreutils-6.7$ cp -g coreutils_6.7-1_i386.deb /nexus/mod0/www/deb/binary/
coreutils_6.7-1_i386.deb | 48% | 3.2 MiB | 118 KiB/s | ETA
Continue Reading
Tags: linux