Sunday, November 25, 2012

Pogoplug Arch Linux glibc update error

I have not updated Arch Linux on my Pogoplug for a period of time. When I finally tried to update it, I encountered dreaded glibc: /lib exists in filesystem error. I have tried all resources that I could find and was not able to update glibc. I was able to update all packages including linux by making symlink to usr/lib but not the glibc itself.

The funny thing is that I already had later glibc which was recommended on the archWiki site, but nothing worked. At the end I used -f flag on pacman command line and that broke the system. Do not use --force flag as it WILL break your system.
Fortunately for me I keep all important data on a drive which is separate from my system drive. I unmounted the data drive and  re-installed linux following original instructions. This time it went smooth as I already discovered and documented all pitfalls.

The best outcome without upgrading glibc would be achieved by following  these instructions. You will get linux installation error but everything else will install correctly. At this point you should uninstall linux but do not reboot! Next make symbolic link:
ln -s /usr/lib/modules /lib/modules
After this reinstall linux and it should install without any errors. Now you can reboot. You should have an updated system but with older glibc. If you know how to update glibc please post it in the comments.

After killing my system with --force, I simply deleted all data from my system drive and reinstalled from scratch. This took me less time then I spend on doing all of the experiments to fix the glibc error. The rolling distribution is not so "rolling" after all. You can get it in to a state in which it is not upgradable by simply lapsing your upgrades for a period of time.

Sunday, November 18, 2012

TPU Case for Galaxy 4.2

The Galaxy Player 4.2 cases are not as numerous as cases for iPod, to put it mildly. Finding a case for the player is a bit of a task. I purchased a black TPU case from eBay since nothing I wanted was available. I wanted to write a little description of this case so people looking for a case would have some point of reference.

I would like to get a soft silicon case, just like I have for iPod. The silicon case provides good protection for the device without adding too much of a bulk. Most importantly silicon case protects the device from breaking if it falls on a hard surface because of the relatively thick rubber around the device.

The TPU case is not the same quality as the silicon case that I have. It is not a bad quality case just not in the same league. The case is part shiny, part mate. Most of it is mate. The sides have nice roll-on texture providing for secure grip. The back has cut out for the camera, left side has a cut out for the strap and the bottom has two cut outs - headphones and USB connector. The cut outs are not 100% accurate. Some more accurate some less. The USB is the least accurate of all and the case prevents USB connector from fitting securely in to the hole. This is my biggest gripe with this case.

The case fits snugly over the device and does not add much to the dimensions. It protects device well from scratches and minor drops. The speaker grills are exposed and can be damaged so one needs to be careful when the device is in this case. The glass is mostly unprotected as the ridge in the front of the case is not very high.

The TPU case is easy to put on and take off but will not come off by itself. It is scratch resistant and looks good on the device. It is very inexpensive and provides good value for the money. I personally would prefer a different case but this is OK case to buy and I would recommend it in the absence of better alternatives.

Update after some use.

After using this case for a month or so, it stretched a little bit and now  it is easier to insert and remove the player. The case protected player well and the only inconvenience is that the include USB cable does not fit with the case on. I have to take out the bottom of the player from the case to securely insert the cable.

Friday, November 16, 2012

Samsung Galaxy 4.2 after a month of use

I am still very happy with my new Galaxy 4.2 player. It is much more pleasant to use than iPod touch and functionality is great.

The player is excellent as an alarm clock during travel. The speakers are very loud and unlike iPod it never locked up during the month while trying to sound alarm. I only wish to be able to select one of the World times as primary when traveling. When I move about the airports it would be useful.

The video playback is excellent and the battery seems to last a long time. I played over an hour of video and the player used only 5% of the battery. I know it is not linear but there is enough battery for a cross country trip on the plane.

Wifi seems to use battery more aggressively but it is not a problem for me since I do not browse web on this device. GrooveIP works really well and I could make calls without any problems. I had a problem with Cisco Webex calls but that is about it.

Book reading is great. The FBReader is way better app than anything on iPod. Combine this with bigger and more readable screen and you got a winner. Galaxy Note probably is a better reader but it is much bigger so portability looses.

For $5 I doubled the flash by installing 8GB card and now I have enough storage to keep more hours of video than I can watch on a single charge. I used class 4 Patriot flash and it works fine for streaming videos.

I also used camera to snap images of a document when copier was not available. This worked very well and images are readable and usable. For this exercise I used fluorescent light and was most concerned with images being readable. For this purpose device works very well. I am sure that the camera is far from the SLR quality but it meets my expectations.


Performance has not been any issue so far in any of my use cases. I am very happy with my purchase and would definitely recommend this player vs iPod touch. I finally removed the pile of junk that is iTunes from my computer.

Thursday, October 18, 2012

Samsung Galaxy Player 4.2 review

I wanted to dump my iPod Touch for a very long time. My main use for this player was reading books and listening to the NPR podcasts. I hate iTunes with passion and wanted to rid myself of Apple and iTunes.

I went ahead and bought Galaxy 4.2  after some research. After using it for about 2 weeks all I can say that it is infinitely better than the iPod at least from my point of view. It is better in all of the tasks for which I used my iPod.
The FBreader (ebook reader) is much better than Megareader I used on iPod. There is just no comparing the two. The screen of the Galaxy is larger, and has better viewing angles. The battery life is comparable and it probably can go for a week or so on one charge if reading for about an hour a day. Over all very good experience.
The music player is just as good the the Galaxy and the sound quality is better to my ears. There is also FM radio which works very well.
Included applications are very good and you can just use the device out of the box without any installing many additional applications. The simple task manager is included together with a few very popular games and synchronization apps. Also included chat, IM and navigation software. I have not even tried all of the apps that came with this device.
Galaxy handles various video formats but I only tried Divx and mp4 files so far. It also can decode high resolution videos which my iPod could not. It saves some transcoding time.
The device comes with the wall charger and uses micro-usb connector for charging and my cellphone charger does work. This saves me the trouble of having an extra charger when traveling.
I purchased a TPU case from eBay and a screen protector from Amazon and would highly recommend for anyone to do the same. The player body is plastic and would probably suffer if dropped on a hard surface. I would prefer a softer silicon case as I had for my iPod but unfortunately the selection of cases for this player is very limited. The screen protector is OK but somehow not as good as the one I had on iPod. It was a wet install and it came out a bit wrinkly at the end but this is in no way Galaxy's fault. So far the only issue I found with this device is that the third party accessories are not as numerous as for iPod.
The battery in this device is user replaceable so there is no frustration of replacing the battery like with iPod, also storage is expandable via MicroSD card. If you are watching movies or using a lot of large games this would definitely help. So far I have not tried this feature since I am mostly reading books on the Galaxy.
Some online reviews complained about device performance. I compared it to the Galaxy Nexus phone and there is a slight difference but it is not large. I have not noticed any problems or slowdowns. The user interface is smooth and applications start fast. The video and audio playback is perfect. The browser is very usable, just as good as on the Nexus and way better than on the iPhone 4S. It is just more usable because of the larger screen. Because of the slower single core CPU battery life is better on the Player than on the Galaxy Nexus phone. I am definitely willing to compromise performance for better battery life but other people may have a different opinion.
If you want to replace your iPod and like me do not want to get an Android phone that you have to charge every day, the Galaxy Player is an excellent device. I only had to install 2 applications to make it completely perfect for me - GrooVe IP and FBreader.

MPEG-4 (Xvid or Divx) on Roku

In my earlier post I wrote that Roku can decode MPEG-4 encoded files. This is only partially correct. The Roku can decode some of the MPEG-4 encoded files just fine but some other files produce heavy stuttering during panning scenes. The reason is unknown to me as of yet.
The problem files should be transcoded in to h264 using ffmpeg or Handbrake. Using ffmpeg and veryfast or ultrafast preset video can be transcoded very quickly at about 10x of real time playback rate on the Phenom x4 9750.
Most of the MPEG-4 encoded files however can be decoded on Roku without any problems as long as you convert them in to the mp4 container and re-encode the audio. The file size will be smaller when it is transcoded  to the h264 but if you want to save time and for "watch once" content the MPEG-4 option is good.

Thursday, October 11, 2012

Roku BIF files

Your Roku supports pretty cool way to do trick modes - the bif files. I think this is Roku specific mode because I have not seen anyone else doing this. The bif file is essentially archive of the frames in jpeg format with an index at the beginning of the archive. Each frame is taken periodically, every 10 or so seconds. Roku SDK contains a biftool utility for Linux and Windows and also a document describing internal format of the bif file. This document is very basic but it gives an initial understanding. I think a Python script would be more useful and more portable since it would run on any system and would provide the source code to fix any bugs.
To create bif file you need to extract frames from your video and save them in to jpeg files. Each file is named as a number starting from zero, i.e. 00000000.jpg, 00000001.jpg, etc. The number in the name signifies the position in the index of the bif file. The position is multiplied by the interval that you provide when generating the frames and when creating the bif file. For example if your interval is 10 seconds and your file name is 00000023.jpg the frame would be located at 230 seconds in to the video. When you navigate in your video, Roku would show frames from the bif file corresponding to current position in the video. The effect is pretty neat but it has problems. The first problem is that it is hard to achieve a good precision in this manner. The generated frames do not correspond to the key frames and when you start your video it is usually a few seconds off the displayed frame, I would say within 10 seconds. The second problem is that the process to generate bif file takes time and I am not sure if it is worth the effort.

The process

The process itself is pretty simple but may involve getting Roku SDK. You  would need to register with Roku and download Roku SDK that contains biftool.exe utility. There is also bif file generation tools that sold online but I have not tried them. You would also need to download ffmpeg but most of people who stream to Roku from PC would already have ffmpeg.
There is also a Python tool that generates bif file. Search for makebif.py and you will find this tool. It works just as well as the tool from Roku but you loose some control if you do not know how to program Python.
The first step is to generate frames from the video file over the regular intervals. Lets assume 10 second interval for this example but you can adjust your interval to what you feel is appropriate. Create a directory to contain you images and run the following command:
ffmpeg.exe -i video.mp4 -f image2 -r 1/10 -s 240x180 directory/%08d.jpg
I encountered a problem with the later version of ffmpeg - the first few images are generated at a very short interval. This causes all remaining images to be off by a few seconds. To remedy this problem first few images should be removed and the rest should be renamed accordingly. Shell script would do the job.
Next step is to run the biftool.exe to generate the bif file:
biftool.exe -t 10000 directory 
The -t parameter indicates interval between images in milliseconds. There are other parameters that can be passed to the biftool but they do not seem to work. This will create a file named direcotry.bif which is the resulting bif file. You need to rename this file in to a video.bif to match the name of your mp4 file. Now load up your video in MyMedia player or your other favorite player and enjoy. During the fast forward operation the images would be displayed instead of a simple progress bar.

The conclusion

I am not sure if the process is worth the effort if you want to watch a video just one time. It may be worth the effort for your kids videos or something that you want to keep and will watch over and over again. I also think that the biftool from the Roku SDK is pretty poor and the python version is much better, especially if you can modify it. The python version can be made to automatically delete first few images and can be fixed if any problems are found. At the end the process and the result was fun to try. If you are in to organizing your video collection this maybe something that would be useful to you.

Thursday, September 27, 2012

Encoding content for Roku 2 and MyMeida

There are many sources on the Internet that explain how to encode content for Roku 2. Unfortunately most of the sources are obsolete and use outdated versions of tools. I will try to share my experiences in this post.

The simplest way to encode content for Roku is to use Handbrake. The current version 0.9.8 includes Normal preset which works well with Roku. The High preset also works but sometimes produces out of sync video and audio. It also takes significantly longer time to encode with the High preset. Selecting MP4 container and leaving all other options in their default state works well and gives reasonably fast encode with good quality video. Please note that Normal preset does not support multichannel audio by default.
Encoding with ffmpeg is a little bit more involved but gives a great deal of control over encoding time as well as encoding quality. This is example command line that works with ffmpeg version 20120924-git-bbe9fe4:
ffmpeg.exe -i "video.avi" -acodec libvo_aacenc -ab 128k -ac 2 -vcodec libx264 -preset veryfast -profile main -crf 18 -threads 0  -y "video.mp4"
This will produce video compatible with Roku but the bit rate would be on the higher side. To decrease bit rate different preset can be used. Following presets are available - ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. Start with medium (default) and go faster until the balance between encoding speed and bit rate is satisfactory. You can also use high profile but it will slowdown your encoding. When using high profile specify -level 4 option because Roku does not support anything above level 4:
ffmpeg.exe -i "video.avi" -acodec libvo_aacenc -ab 128k -ac 2 -vcodec libx264 -preset veryfast -profile high -level 4 -crf 18 -threads 0  -y "video.mp4"
Faster presets generate larger files and slower presets generate smaller files. Try it out to see which one works well with your computer and gives you smallest file in an acceptable time. The veryslow and placebo presets together with high profile do not work with Roku and cause macroblocks and frozen picture during decode

To my surprise Roku can also decode MPEG-4 Part 2 (Xvid). Any avi file that is encoded with this codec can be quickly converted in to MP4 file without re-encoding the video. Audio most likely has to be re-encoded but this takes much less time than video encoding. Roku only supports AAC audio and Xvid files usually contains MP3 or AC3 audio. To convert compatible Xvid file use this command:
ffmpeg.exe -i "video.avi" -acodec libvo_aacenc -ab 128k -ac 2 -vcodec copy -threads 0 -t 120 -y "video.mp4"
To test if your file would work without completely converting it use -t 120 command line switch. This would convert first 120 seconds of video and allow you to test it out with your Roku. Remove this switch from command line after you satisfied that the resulting video works. Xvid was and still is a very popular codec and people accumulated a lot of content encoded with this codec. DivX codec should also be compliant with MPEG-4 Part 2 but I have not tried converting this type of files as I have none.

I found that Roku MKV support is very poor when streaming over the network. The device often crashes when starting video playback or trying to seek within the content. When played from the USB stick there are no such problems. To avoid any issues it is best to convert mkv files in to mp4 which can be done without re-encoding video and audio in most cases. You need to make sure that your mkv file contains h264 video and AAC audio. You can do this by using ffprobe which is a part of ffmpeg package. You can convert container with ffmpeg or mp4box tool. Following command line works with ffmpeg:
ffmpeg.exe -i "video.mkv" -codec copy "video.mp4"

Stay tuned for more Roku information.

Sunday, September 23, 2012

Handbrake Lipsync and Roku

I occasionally have lipsync problems with Roku when encoding videos with Hanbrake. Handbrake does not appear to give you any control over audio or video delay. In theory, if the source is correctly synchronized the output should be synchronized as well. In practice that works only with VLC but not with Roku.
I found that the profile selection affects lipsync the most. I am not sure why that is, but Roku handles high profile poorly as far as audio synchronization goes. I performed several tests and all of them came out with the same result - audio is ahead by about 1 second. VLC plays these videos correctly but in Windows Media Player lipsync is off the same way as Roku. This can serve as a test - if WMP plays video correctly, Roku will too.
What is interesting that the "Preview" does not show any issues in WMP or VLC, therefore checking just preview alone would not help. You would need to encode about 10 minutes of video to judge correctly.
If you are encoding lower quality file, it does not make sense to encode in high profile as the source is already low quality. If you want to preserve quality as much as you can, adjust "Quality" slider in the "Video" tab to 18-19. You will get a bit better quality at the expense of the file size.
At this moment my recommendation would be to stick with "Normal" preset when encoding for Roku, especially for lower quality content.

Saturday, September 22, 2012

WDTV Live has many problems

Today I sent WDTV Live device back to the store. It was an easy decision and I understand why it was returned the first time around. Below is incomplete list of problems that were encountered during the week WDTV was in my possession.

The avi files do not play well over DLNA or Samba share. To be honest, some files do play but most  stutter. The high bitrate mp4 files do not play well at all. Roku plays these same files without any hitch. The wmv files also hit and miss. Some do play really well, some do not play at all.

User interface is very clunky and slow. If the DLNA server crashes, the box completely freezes or becomes so unresponsive that it is useless. At this time the box must be rebooted to bring it back in to the working state.

Different video controls are available depending on the type of the video file which makes the UI inconsistent. The mp4 files and the mkv files can be positioned to a time point, the wmv and the avi files cannot. Files or all types can be fast forwarded but the max speed is only 16x and it seems much slower than that in practice.

Hulu application is much worse than the one on Roku. This is one of the most used services in our household because we do not have cable so it is important that Hulu app works. With WDTV  only few shows can be played and then application needs to be restarted in order for it to work. The ad insertion on Roku is almost like in broadcast tv. On WDTV the ads buffer separately and there is a significant pause before and after the ad. It makes duration of the show to be almost as long as over the cable. The only useful feature of WDTV Hulu app is that one can force maximum bitrate . The app on Roku is much newer version than the WDTV and that may explain the difference.

The "channel" selection on WDTV is  much smaller than on Roku and the box looses big in this respect. The server software for Roku is very simple, MyMedia being an excellent server. The server software I used for WDTV was the PS3 Media Server. This server is very reasonable but it gets huge after running for a while and has to be restarted. It also takes a bit of knowledge to configure this software correctly. Live transcoding mode supported by this server does not work well on my quad core Phenom so I have to transcode offline which negates some of the convenience.
At the end I could not figure out a format that would be well supported by both Roku and WDTV and as a result each file should be encoded in two formats. If you would like to watch content on both devices the size of your library would double.

Given all of the above my derision was to standardize on Roku boxes to minimize size of the library and improve over all experience. Too bad no company can figure out how to do networked media player correctly.

Tuesday, September 18, 2012

Update on WDTV subtitles and more

I have been trying to get WDTV subtitles working with mp4 format so I don't have to keep separate format for Roku. So far I learned a few things. First is that WDTV does not appear to understand internal subtitles inside mp4 container. I was able to multiplex subtitles using ffmpeg as well as mp4box. In both cases VLC was able to play subtitles but WDTV was not. The second thing I learned is that Roku does not appear to understand multiplexed subtitles ether. This fact is apparently documented on Roku forums and elsewhere online. The third thing I learned is that WDTV is pretty bad at playing mp4 files. Somehow the playback is very choppy and the video freezes a lot. Monitoring consumed bandwidth I found that it is very low and is not enough to play the content smoothly. Converting the file in to mkv container without transcoding, fixed all playback problems. The bandwidth consumption became much more even and video played without any issues. This was a bit surprising as Roku played the same mp4 file rather well.