HTML5 video update
So I was trying to improve the video playback situation at home on the Nexus 10. I ordered up a 5Ghz Wifi base station and tried it out on Friday. To say its wall penetration is poor is an understatement. It turned out to be almost half of the 2.4Ghz frequencies. On the plus side there is nobody in my area on 5Ghz, I get the whole band to myself.
However the sticking point was that it kept failing for me when switching between the 2.4ghz base station and the 5Ghz base station (different physical boxes). I finally figured out the problem was down to the switch, it stores the local MAC address of where the devices IP address is, when that suddenly changes the switch wasn’t keeping up. Rebooting the switch cleared the cache but that’s not a practical solution.
This also lead me to an idea of why do I need to use a DLNA client to watch videos over the network when HTML5 video is on modern mobile devices. So I knocked up a webpage with a video player and played a video on the Nexus 10 and Google Chrome. Awesome, I then added some directory browsing via PHP. I ran into a couple of stumbling blocks:
1, PHP treats symbolic links differently to folders or files (a link could be either)
2, AVI files are not a good container format, they don’t support seeking in the HTML5 video player (mp4’s or webM is the preferred choice)
So I tried coding around the link problem (which I half fixed last night) and I created a bash script to convert my AVI files to mp4. The MP4 was fun since some of my AVI files had been encoded with AC3 audio, whereas that isn’t supported officially in MP4. My TV could play the video but not the sound, the Nexus could play it perfectly… I updated the script to re-encode the audio using avconv, when it copies the video to mp4:
avconv –I kids-playing-football.avi –vcodec copy –acodec libfaac kids-playing-football.mp4
I put this into a bash script and started it running (I’ll post the script later). I’ve not had problems with any of the files yet. They play nicely on my mobile devices and TV. The MP4 container certainly has made things better in terms of seeking through a video.