Saturday, December 8, 2012

Handling file names with spaces in shell scripts

I decided to write this post after looking on the net for the solution to this problem. There are many recommendations but most of them are ether incorrect or involve convoluted methods like creating temporary files.
Disclaimer: I am by no means a shell scripting guru so take my advice with the grain of salt and try it for yourself. This information is relevant to bash, I do not use other shells.

The problem

You want to pass a number of files to your shell script and process each file in some way. Obvious approach is to use for loop and place processing of the file inside of the loop, something like this:

files=$*
for file in $files ; do
  process-file "$file"
done


Note the quotes around the $file variable. These are used to ensure that if the file name has some spaces, the file name is processed correctly.  Placing double quotes around the variable will ensure that spaces in it will be treated as a part of a single file name rather than multiple file names separated by spaces. If none of your file names contain spaces, the code above is perfectly workable.
The for command breaks list in the files variable using field separator which normally includes space. So in the code snipped above file will be assigned portions of the file names if the file names contains spaces. One solution recommended on the net is to modify field separator to exclude space, but this creates other problems.

The solution

The actual solution is very simple and based on often overlooked statement in the bash man page. If you omit in statement, the for command executes list once for each positional parameter that is set. So reworking above snipped as indicated below gives you the code which works correctly:


for file ; do
  process-file "$file"
done


The snipped above worked in all of my scripts. The only issue might arise when you do not pass file names on the command line. In this case function can be used or positional parameters may be reassigned using set command.

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.

Monday, September 17, 2012

WDTV subtitles from DLNA server

So far I could not figure out how to stream external subtitles from DLNA server. However WDTV supports MKV container and subtitles can be embedded in to the video file. To do this use mkvmerge tool from the mkvtoolnix set. Obtain the srt subtiles for the content you want to watch and then run following command to merge the subtitles and the video in to one mkv file:

mkvmerge.exe -o output.mkv input.mp4 input.srt

This will produce the mkv file that can be streamed over DLNA and your WDTV will be able to display the subtitles. Roku on the other hand can not display subtitles from the MKV container and needs an external file. Given that Roku often crashes when playing or navigating in the MKV file, you would need to keep a separate mp4 file and a srt file for the playback on Roku.

WDTV Live again

I took my replacement Roku back to Costco and decided to give WDTV Live a second try. The box arrived from Amazon and I was excited to to open it and start comparing it to Roku (again).


The WDTV box is obviously larger than Roku but that does not bother me. Ether box is small enough to be placed somewhere near your TV.  The WDTV is also more power hungry than Roku, it has a larger power supply and runs much warmer. The WDTV is noticeably warm on touch even when in the off state. The box is running Linux and clearly does not power off, other than turning off the video output and the led. Nether does Roku but the chip it uses is less power hungry.

After spending 2 days with the WDTV, I am back to thinking that Roku has more polished product, despite all of the shortcomings. But let me describe things in order.
Configuring WDTV box takes about the same time as Roku - you need to configure network and your TV output format. The WDTV has few more customizable options that allow you to set various things but over all experience is close. The WDTV does not have any downloadable apps so the configuration ends here.
We only have Hulu Plus so I registered box with the Hulu site and tried watching some content. The Hulu app on WDTV is somewhat different from the Roku version. Queue display is different and also the WDTV app allows you to set the bitrate, which is a great feature! Roku app often stutters because the bitrate of the content is too high and there is no way to get it down. When I run in to this problem I will try to compare the two boxes and post my observations.
The local content playback is the area where WDTV suppose to shine. It does play any format that I have tried. It played all the MKV files, that caused Roku to reboot, without any problems. There were however few issues.
First problem was to get Windows7 to share the files. This task should become simpler to accomplish with Windows7, in reality it was more complicated than XP. For some reasons after enabling Home Group sharing the WDTV still did not see the the directories. Eventually after some fiddling with the settings, the box could see the shares and play the videos. It worked OK for the lower bitrate videos but somehow higher bitrate made it stutter. I assume the problem is with Windows networking being too chatty. Same videos over DLNA worked just fine.
The second problem is finding a good DLNA server. I have tried every free DLNA server running on Windows that is listed on Wikipedia. I wanted a small footprint DLNA server since at the base of DLNA is just a simple web server. Most of the servers are large and some of them are unstable. When the DLNA server crashes the WDTV box gets very unhappy! The menu is completely unresponsive and the only reasonable solution is to pull the power plug.
At the end I settled on two candidates - PS3 Media Server and Serviio. Both seem to behave more or less OK although both use copious amounts of memory, with Serviio being a little smaller.
One thing I wanted to mention in conclusion - I could not get external subtitles to work with the DLNA server. If subtitles are important to you Roku seems to be easier to get working with the external subtitles.
I will keep this blog updated on my experience with WDTV over the next few weeks.

Saturday, September 8, 2012

Roku: review after few months of use

We have used our Roku XS devices for a few months and there are few things I wanted to say.

The honeymoon is over

 I liked this device initially but as I used it more and more my opinion about it plummeted. Now the initial good impression is completely displaced by its problems and quirks. For starters there are a lot of problems with the hardware and the software. My first Roku XS remote is died within a week and I took the device back to Costco for a replacement. My second Roku XS was rebooting randomly when in the sleep mode and not booting back after that without power cycle. I took that one back to Costco too. I did not even unpack the replacement Roku and will take it back this weekend after more frustrations with the current unit.

Roku problems

Where do I begin? 
Automatic updates to the software - this has to go. Roku updates itself to the new version of the software without any way to revert back. The new software at times is worse than the previous but there is no way to stop the update. If you find a good version of the software you can't keep it on your device. The bottom line is that this feature will bite Roku (the company) in the rear one day.

HuluPlus - we have been using this service to watch TV after dropping the satellite. The app is bad from usability standpoint and also the service is slow. I have no problems with their content, if one does not like the content, one does not have to subscribe. I do have a lot of problem with their inability to deliver it. Half of the movies that I tried from Criterion collection fail to play smoothly. Hulu states that I need 3Mb/s service for HD quality. Well, I have 19Mb/s at all times and I want to watch SD. There is no way to select SD on Roku and videos do not play well. The transition between commercials and content often result in macroblocking for a few seconds. Browsing content is also terrible as it is very slow on the Roku app. The app itself is huge memory hog and does not stop running when you exit from it. Because of this all other apps suffer when Hulu is started.

Codec and container support on Roku is terrible. They should fire the QA department and get a new one. The only codecs they claim to support is the h264 and the WMV. That is a blatant lie. WMV is not well supported and a lot of videos do not play and worse cause Roku to lockup and reboot after watchdog is expired. Same with the container support. The mp4 container is OK. Files are recognized and played correctly most of the time, except some files produce lipsync problems which can not be fixed by transcoding. PC plays these files just fine but not Roku. The mkv container is also on the list of supported containers but this is a blatant lie as well. The files in the mkv container often cause Roku to lockup and reboot and even if the file can be played, seeking in the file causes reboots. This is my biggest problem with Roku.

Roku also claims that device supports subtitles. Technically it is true but the support is very finicky as the file must be formatted just right. VLC has no problems with the file but Roku will not play it if it is encoded in Unix format or has no empty line at the end or numbers do not start with 1 or many other reasons.

Another bad miss is absence of the parental control, as well as the inability to select applications that are loaded on the specific device under the same account. If application was removed from one device it will be removed from another linked to the same account.

Now to the general content selection. It is true that Roku has many more channels than say WDTV or a networked DVD player but most of the channels are junk, just like your cable or satellite. Hulu, Netflix, Amazon are available on most of the other devices so Roku does not get any credit here. On other devices the quality of streaming is better however. The other channels like HBOGO require subscription to the HBO on cable?! If I have a subscription to cable why would I need Roku to watch it? Private channels do add to the selection but they come and go - stop working for no reason and then start working again. Of course most of them are not getting paid but then why bother?

The user interface on the device is too simplistic and often fails to respond to the remote. I am not sure if this is app problem or in general Roku problem but with closed source system we will never know.

At the end the only app I really like is MyMedia which allows you to stream content from your PC. That app works OK and you can stream your pictures movies and music collection to the TV. It is also open source so you can modify the app or the server and add the features that you want.

Conclusion

Would I recommend Roku after a few months? Maybe, most likely not. If you want to play movies that you took with your camera or ripped from DVDs, the answer is HELL NO. If you want to watch Netflix or Hulu, the answer is maybe. I would get a networked blue-ray for that. For the same $100 you will get more functionality.
Roku is clearly used the wrong chip for their product! They should have used a chip that is capable of playing many more formats. Even the same Broadcom can supply a number of chips that are much more capable. In any event they should test the software better to make sure simply playing a file to the device would not cause a reboot!

Thursday, August 16, 2012

Getting the most out of your Roku

So you bought a Roku2 box and wondering how to get the most use out of it. In this post I will try to share my experience and thoughts on the subject.

My first recommendation would be to get a Pogoplug classic for $30 and install ArchLinuxARM on it. Then install MyMedia server on your new Pogoplug and enjoy streaming content from your local network. Pogoplug and MyMedia are perfect match for your Roku. If you have kids who wants to watch DVDs over and over this setup makes a lot of sense. Just rip your DVDs and place them on your Pogoplug server and your kids can enjoy them any time without trashing your disks. The server can also be used for backup of your computers if the drive has enough space.

Hulu is one of the options to get your TV programming. It has a lot of foreign programming, Korean and Australian being predominant. It also has Criterion collection movies. Hulu application is pretty bad as far as software is concerned. It does not throttle bit rate and on the slower connections video stutters a lot. I wish Hulu addressed these problems since the only people who suffers are paying customers. At the end Hulu is not that expensive and may be worth it if you want to cut the cable.

Crackle is another good option. Content is so so but the application is OK enough and I did not have any problems playing videos. The only problem is that advertizements are not as well integrated and the ad experience is worse than on Hulu. For free though one can't complain.

The other option is to download content using Bittorrent client. I would recommend qBittorrent but there are no shortage of clients. A lot of new content already encoded in h264 format which Roku can play. If however your content is encoded in divx, you would have to transcode it in to the h264. Hanbrake is one of the best applications to do this. Just select Normal profile and off you go. The application is very easy to use and produces videos that have no problems with Roku. Just make sure not to use Mkv container. Although Roku claims to support this container, it has lots of problems playing and navigating the content, and often crashes.

If your kids like PBS shows, most of them can be downloaded with a little patience and know-how. Rtmpdump would be the application to use for downloading and Wireshark is the application to use for capturing the show URLs. I downloaded and transcoded for Roku whole seasons of Fetch and Cyber Chaise. I am surprised why PBS does not put these seasons on the web for everyone to download or maybe just for people who make donation.

Over all Roku can keep you entertained just enough, especially if you are not addicted to the TV.

Sunday, July 22, 2012

Ebooks vs paper books

I was reading ebooks long before they were popular and long before there were any ebook readers on the market. My first reader was Sony Clie with various reading applications. My favorite app was Plucker. Reading ebooks is much more convenient for following reasons:
  • You can read anywhere, given that your reader is compact. Bored standing in line at the store? Pull out your device and start reading.
  • You can read just a few pages at the time when you got a spare moment. The reader remembers where you are and ready as soon as you power it on.
  • You never run out of books to read. Even the old Clie with 16MB of memory could easy hold 10s of books.
  • It is easy to make notes with the right application or even without it if you get a little creative.
  • You don't need to have light while reading in bed if your device has a backlight.
There are of course some downsides:
  • You can't read on the plane during take off and landing.
  • Your device battery can run out if you forget to charge it.
Of course Clie is no longer practical and there are much better devices available. I currently read on iPod touch 2G which I received as a gift. iDevices have very poor ebook reader applications especially after demise of Stanza. Notable exception is MegaReader but it is still missing a lot of features and the font rendering is not accurate. If you have apple device this is the one I would recommend. iBooks is slow and huge. Most of the main stream readers are not configurable to be pleasant to use on the small screen.
Android platform has much better selection. All of the applications that I have tried were very good. FBreader was my favorite but they all very good. My next device is going to be Android powered, most likely one of the Samsung media players or possibly 7" tablet. I have tried 8" Visio but it is too heavy and too big to be useful on the go.
If you are avid reader and not sure if you want to read ebooks, give it a try and you will not regret it.
For managing your ebooks and converting them for your device Calibre is a perfect application. It is actively developed and getting better every day.

Monday, July 9, 2012

Checking root filesystem on ArchLinux

My shiny new ArchLinux on the Pogoplug was complaining about root filesystem not being clean. I tried usual approach of placing /forcefsck file in the root folder and rebooting. Although the file was removed at the next boot the filesystem check still complained.

I went to the IRC to the #arch-linux-arm channel which is recommended on the website, but no one appears to know how to do this on the running system. The only recommendation that I got, was to take out the drive and put it in to another Linux box. Well, this being a USB flash drive makes it possible to do so. But imagine an internal disk and this quickly becomes less than practical solution.

So I went to the "Internets" and did a search. As expected someone already asked this question and got a multitude of answers which helped me to put together a procedure. So here it goes:
  • Execute following command:
    fuser -v -m /
    This will give you a list of all processes having files open on the filesystem. Look for the processes that have F or f flags set. For example:
    root        182 .rce. dhcpcd
    root        197 frce. crond
    root        219 .rce. sshd
    ntp         226 Frce. ntpd
    So it looks like the crond and the ntpd have files open.
  • Shutdown these processes by using following command:
    rc.d stop ntpd
    Shutdown all of the processes that have files open on the filesystem.
  • Now you can remount filesystem using following command:
    mount -r -o remount  / 
    If you correctly shutdown all of the processes remount should complete without any error.
  • At this point you should be able to do a filesystem check:
    e2fsck /dev/sda1 or e2fsck -y /dev/sda1 
I hope that you found this post helpful and it saved you some time.

Saturday, July 7, 2012

Pogoplug after a few days

I had this device for several days and so far it works well. I replaced the original Pogoplug software with ArchLinuxArm. The box is much snappier than my original Cobalt Qube 2 with NetBSD 5.2. Of course it is much faster machine and with double the memory. The size of the device is also small and the case while funky looking is OK. I only wish it would open more easily so I could take a look inside.

ArchLinux appears to be well made distribution with the package manager that tracks dependencies. Startup scripts are easy to understand, unlike the latest Ubuntu. I am not sure why they keep changing startup scripts every year. I installed Python and Samba to run MyMedia server and to backup my data from the Windows PC. MyMedia server runs very well on this hardware. The menus come up fast and the videos and images served quickly enough. Over all it is very good box for the purpose.

I am getting another enclosure and will install Linux on the hard drive instead of the USB stick it is on now. I want to try to compile some software and to see how well this box would work for unix development. It probably would not be a speed daemon but it could work.

At this point I would recommend this device to anyone capable of installing Linux himself.

Wednesday, July 4, 2012

Linux on Pogoplug

I was tempted by the Pogoplug Family deal and got myself a Pogoplug  classic for $29.95. They advertise it as a "free device" with Pogoplug Family but in reality you are buying the device for the above sum. Don't forget to cancel the service after receiving the device. Otherwise it would be more expensive than actually buying the same device outright.
After getting the device I evaluated it for about a day. I got the grey version of the Pogoplug Classic with Marvel Chip, 256MB of ram and 128MB of flash. The device itself is snappy and works reasonably well. It recognized my USB hard drive and went to work on it, apparently indexing the content. I measured transfer speed and using my old router with 100Mbit Ethernet, the transfer speed is around 9MB/s which is not bad. The device is silent and consumes very little power.
The companion software on the other hand is terrible. It is very much useless for backup as one can not control what is being backed up. You can only specify the top directory and everything under that directory is backed up. I thought about using the drive feature to backup with Microsoft Sync Toy but somehow it makes for a very slow backups. This device appears to be made for a completely computer illiterate person who never used any NAS devices. It also requires connection to the Pogoplug servers and I would imagine opens files on your "cloud" to snooping by the company. Over all I found the "Pogoplug Cloud" concept is sorely lacking in the implementation department. It does not hold a candle to the simplicity of Dropbox or Google Drive.

I actually got this device to replace my very old Cobalt Qube microserver which is showing its age. In that role Pogoplug Classic performs really well.
Most people appear to have good luck with the Arch Linux Arm and that is what I decided to try. I used a Centon 4GB flash drive as my root drive and WD drive in USB enclosure as my data drive. Installation of Arch Linux Arm is very simple and described on the web page. The Pogoplug Classic model number is POGO-E02 which is one of the supported devices.
The installation went smoothly and the box appeared operational but it would not acquire  IP address. Due to the bug in the Ethernet driver and my old router the device kept disconnecting and reconnecting to the network. After some search I found the solution. If your Pogoplug appears to boot but fails to acquire IP address add following line to the dhcpcd.conf file : nolink. Linux, samba and python occupy around 740MB on the flash drive. I did not install git but instead use my custom copy of the MyMedia server.

Now my Pogoplug is booting Linux and can act as NAS device with up to 4 USB drives and can run MyMedia server for Roku. It is much snappier than my old MIPS box but obviously not as fast as my desktop. It is worth $30 in my opinion if you can install your own Linux on the device. Similar devices would easy cost north of $50.

If I decide later to change my mind and use the "Pogoplug Cloud", reverting back is as simple as removing the USB flash drive and rebooting the device. The original system is preserved in the flash along with the original uBoot bootloader.

Friday, June 29, 2012

Inkjet change of mind

All of the good things I said about that HP printer? Well, I take them all back. I honestly do not know how people live with inkjets. I own a Brother laser printer and before that I had Oki. Nether one gave me so much grief  or was so high maintenance as this HP!
We print very little in our house. The older generation is out of school and the younger does not print that much yet. This causes constant ink problems with this printer! I can turn off laser printer for a year and after I turn in on, it will print perfectly. If I turn off inkjet for a year chances are that I would not be able to print when I turn it back on. The ink will dry out and/or the head will clog. It happened several times already and I am getting annoyed.
I  had to unclog head again recently and it cost me two refills and hours of time. The ink runs out in the worst possible moment, just when I need to print something.
To say something good about this printer - the scanner still works OK. That is the extent of the good things.
I would not recommend inkjet at all, unless you have to print in color all the time. After my supply of ink runs out I am selling this junk and getting myself a new laser all in one!

Friday, March 16, 2012

Roku2 vs WD TV Live

I recently picked up Roku2 at Costco. I figured that we can try using it for streaming some media from the internet and the PC. My initial impressions were not very good because of the defective remote. The remote would lock up about twice a day and I had to remove and replace the batteries and that was very annoying. Other than that device was OK but it did not support many formats. After talking to the Roku customer support person I returned device to Costco and got WD TV Live which a lot of people liked. After using Roku2 and WD TV for a week each I formed my opinion.

In streaming from the internet Roku wins hands down. It has many more channels, some even very good. If you only want to use Netflix and Hulu, WD TV is OK. If you want more choices Roku2 is your box! It has bunch of educational channels like Khan Academy and MIT Open Courseware.

If you want to stream variety of formats locally WD TV could be a better choice if you do not want to transcode. Since I occasionally had to transcode video for iPod, I already had Handbrake and has no trouble transcoding for Roku. Roku only supports H264 and VC1 codecs and only few containers, while WD TV supports a large selection of codecs and containers.

To stream locally with WD TV you can use DLNA server or just use windows sharing. Windows sharing is dangerous to use over wifi since my network is not secured. All DLNA servers that I used are huge and clunky. At the end I used ps3mediaserver which after running overnight grew to 1GB in size. There is NO REASON why a glorified web server should be that large.
To stream to Roku, one also has several choices. I tried two - Rocksbox and MyMedia. Rocksbox is pretty good and works well. It costs $15 after a month trial period. It works together with the monogoose webserver or any other webserver that you can configure. The monogoose server is light, small and fast. It is very easy to configure.
MyMedia server has its own server solution written in Python and the source of the Roku app is included. I liked that approach since I could add features and fix any problems, not that it had any. At the end I went with MyMedia and it works very well. Memory footprint starts under 10MB and grows to around 15MB after running for a while. The server is responsive and supports multiple Roku units.

In the user interface department Roku2 wins with the large margin. User interface is fast, responsive and intuitive. WD TV is very far behind. You can tell that this product was done by the company with no experience in user interfaces. UI is sluggish, progress indicators are absent in the few notable places. You think that box is hung but after a few long seconds it comes alive and does its thing. The WD TV is never actually hung but I thought several times that it did.

WiFi performance is much better on Roku2. When away from the router WD TV had trouble with the streaming and video would often freeze. Roku never had any problems.

So over all my preference is Roku2. The only area that falls short is a media format support. Given fast computer and handbrake it is not a huge problem. On my quad core AMD Phenom PC 1 hour SD movie is transcoded in about 6-7 minutes. This machine is about half speed of modern i5 or i7 machine.

WD TV power consumption about twice that of Roku2. Not that it matters much since both boxes consume under 10W. Roku2 consumes under 3W when running and less than 2W when screen saver is running. KillaWatt could not detect any energy being used by Roku2.

The only area WD TV box is better than Roku2 is the media format support. If you are not willing to transcode your media but instead willing to live with clunky and slow interface, WD TV is your box. If you want many free and good internet channels, willing to transcode and like good interface experience, go with Roku2.

Costo bundle of Roku2 XS contains 2 months of Hulu and a HDMI cable. Given that the price of the bundle is lower than just a Roku box elsewhere, it is a very good deal. Do not forget a complete Angry Birds game which comes with this Roku box.

WD TV Live went back to the store and I bought a new Roku2 unit at Costco. This unit does not have the problem with the locking up remote and I am very happy with it.