Thursday 29 March 2018

Scripts to extract audio from video clips or convert other audio formats to mp3

This is a great thing because I can put all these MP3 clips onto my phone and play this music wherever I go.


find . -type f -name "*.mkv" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -c:a libmp3lame -y "${FILE%.mkv}.mp3";' _ '{}' \;
The script goes through the current folder and all subfolders to find mkv files and extract the audio from them and save it into a mp3 file.

You can change the extensions in two places to find other types of video to extract from (it works with mp4 as well).

I set the MP3 tags with Puddletag but I found my Windows phone will not recognise m4a and wma files so the next step needed is to batch these files out to mp3 using ffmpeg.

Here is a script I tried to convert the wma files:

find . -iname "*.wma" -execdir bash -c 'NAME="{}" && ffmpeg -y -i "$NAME" -ab 192k "${NAME/.wma/.mp3}" ' \;
This does the trick with the wma files, producing mp3 files in the same directory as the original. The wma files were then backed up to another computer so that the media computer only has the mp3 files. 

Apart from whichever format the phone can read, Groove music player appears to suffer from the same technical limitation as Windows Media Player, in that the ID3 tags have to be just so right in order for it to properly classify music by albums and artists. Apparently if your tags do not set a genre it will just ignore the rest of the tags and classify the track as "Unknown Album" and "Unknown Artist" even though these tags are set to specific album and artist. So I have spent quite a bit of time playing with the tags to try to get Groove to recognise them and have managed to get it to finally start recognising all the albums I am trying to load onto it, which is a lot.

Sunday 25 March 2018

Why I hate the Google Nexus 5X

Well when I got this thing I thought it was going to be the greatest thing since sliced bread, a Google Nexus phone, with stock standard Android, a lot of available updates from Google, great spec and performance etc. Great hardware, well made quality product. Such a shame about the software though.

Unfortunately over time I have grown to hate the Nexus 5X because of some glaring design bugs in the version of Android shipped with it that Google have failed to remedy. In a respect that is what you get dealing with the likes of Google, Apple. Microsoft and the other majors like Facebook these days. These companies are so big and powerful they can just trample all over their customers by ignoring complaints and failing to fix issues. Because of the experience I will never pay more than $400 for a phone ever again. As it happens this one was just over $400 but Google is screwing their customers big time by charging Iphone-like prices for it's replacement the Pixel. Well I could choose from the Nokia or Moto models this time, probably go for Moto because our family debacle over the reissued 3310 has convinced me Nokia is not much or any better than some of these other outfits. 

So here are my pet hates about the Nexus 5X and why (apart from the huge price) I do not believe anyone should buy a Pixel as I doubt Android will be any better on it, it's not going to be a different interface than on the Nexus. About the only good thing about the Nexus is getting the regular Android updates. But one day Google will stop sending them, or else the battery will go down, and then it's time to throw the thing away and buy a new one. And my guess is that will happen by the end of this year.

Here are my pet hates about the Nexus 5X:
  1. The Do Not Disturb feature is extremely poorly designed as you have to click a Done button to save changes to the settings. If you forget to do this then the default is the timer doesn't click in to turn the phone back on after a certain time. So, because of a poorly designed user interface that is different from every other part of the phone (and from other Google products like Chrome) I have on many occasions accidentally left the phone on silent for days at a time without realising it.
  2. there is no way (unlike my old Nokia dumbphones) that you can put in a catch all timer to turn off DND after a certain time frame, just in case you forget. I have a timer that puts on DND automatically at night so that only phone calls and alarms work. But if DND is already one, this doesn't turn it off at the end of the timer period, even though it would normally if the DND function was previously off.
  3. On one occasion when the phone was set to total silence, an alarm went off on the clock and the phone sounded the alarm even though it was set to total silence.
  4. Sometimes even when you use the fingerprint sensor the phone makes you put the pin number in.
  5. If you restart the phone, when it comes back up, it will not start Android until you enter the Pin number. This is totally unlike every other phone I have ever had, where the phone comes back up to the lock screen. Again I have been caught out many times by this, not realising that Android had not started and therefore no calls or messages could be received.
  6. There is no SD card slot, so you are stuck with the 32 GB of internal memory. I would rather use that for apps and have an SD card for music and pictures so I don't have to worry about using all the internal memory.
  7. Even with the sophistication of Android there can be some app that for some reason is hogging all the CPU usage to 100% even when the thing is allegedly on standby in your pocket, and with it sucking your battery dry in a matter of hours, this has caused the phone to go dead without warning on occasions.
  8. It uses a USB-C cable which means I had to buy extra cables and can't rely on being able to connect a regular charger or computer cable to it.
  9. The battery drains very quickly if you are taking a lot of photos for example, there have been times I was using the camera to take photos of a whole lot of different things and the battery ran down really quickly so I had to switch to a separate camera.
  10. There are next to no accessories available for it. Although admittedly that is true of nearly any phone that isn't an Iphone or a Galaxy S, and buying it from someone other than Vodafone doesn't help.
  11. Contacts is a disaster, it keeps losing contacts especially new ones. I now expect to be doing a lot of contact editing in Gmail as I have many duplicates and old contacts as well as attempting to fix up this contact loss issue. It may be the contact sync on Thunderbird is causing some issues but it never created any problems before.
I have to admit that with the above and various glaring standout problems in that list that have made the phone unavailable for days at a time that I haven't noticed, because at home I can use PCs to do most of the stuff I would use the phone for apart from calls or texts, it has been a less than happy experience with this phone and I would think twice about buying another one again for sure.

UPDATE: Issues 1 and 2 were overcome by installing an app (Auto Do Not Disturb) which makes the whole experience much smoother and easier.  The contacts issue has not been completely resolved but I did discover that there was an all contacts view which makes the whole experience easier, although there doesn't seem to be any way to make it the default. But at the moment I am coping with using the phone every day as I expect it to have some more years of life left in it yet.

New bits for "old" computers [9]

Unfortunately I have not attended to any of the tasks in my last post yet because some aerial photos I was working on last week for mapping have to be redone. This time I have just closed off all web browsers and other applications in mainpc and used that one for Gimp so its full memory can be taken advantage of. This has sped things up a bit and the mediapc has been pressed into use for email reading and Facebook etc. Being able to copy layers between different Gimp projects has helped roll the aerial photo refactoring along and although I am not doing any imaging on serverpc as yet it will get pressed into use in a day or two when I am ready to re-render some of these aerials.

So while that is happening only a little map work has been taking place, mostly finding and marking km pegs from the Otago Central rail trail onto a map and also a special layer in Qgis, getting these aerials finished is a high priority and using mainpc to work them will speed things up a lot.

So getting the backups and stuff started has been put off yet again but it is getting more urgent by the day and as soon as the bulk of this refactoring has been pushed through and things slow down a little then the delayed weekend project combining tidying up a lot of things will actually come to pass.

Thursday 22 March 2018

New bits for "old" computers [8]

After a week or two with the new keyboard layout it has bedded in well and is now pretty much the default as I have been using serverpc to do a lot of time consuming and resource intensive Gimp stuff and are freed from a lot of thumb twiddling as I wait for it to complete a task. When the Gimp project is several GB in file size it can work out to a lot more demand on memory and frequently you will be waiting for it to read or write the hard drive. This has resulted in some of these projects taking days to complete and it is a good use of that computer to be doing this while at the same time able to continue map drawing on the mainpc.

So having two keyboards and mice in the arrangement has worked well especially with the two KVMs. The only real glitch has been with the MS mouse used with the second Logitech keyboard. Because the scrolling was too abrupt with the wheel, presumably some Linux issue, I replaced it with another Logitech mouse of a different model (an M171) to the main keyboard's mouse which is a M185. Well it does seem that Logitech with different models of everything makes them work on different frequencies or something because I now have three Logitech keyboards and two mice all working together in close proximity without any hassles at all. The only real issue is with the new mouse and the new shelf it sits on both being quite slippery so it is difficult to hold still. Interestingly I don't recall any real issue with the MS mouse used on mediapc.

The next small tasks are making the Win10pc's screen turned to be in portrait mode, and the same for the second screen of serverpc. The next big task is to get the Borg backup server set up properly on serverpc because it is becoming urgent for me to get backups going again and to have the backup server properly set up to receive and hopefully consolidate them. I will have to do a lot of reading up on Borg because I don't know too much about using it in a server configuration. I have done just one backup to date with it on mainpc and that looked pretty good but I am hoping having a server will let me consolidate all the backups together in some way.

The mapresources VM I had set up on mainpc has so far had little use, possibly it won't achieve a lot, great concept but the inconvenience of a restart or failed resume is possibly not as great as I thought. Mainpc is running Qgis 2.18 again until a major issue with 3.0 can be resolved.  Whereas on serverpc I have to keep an eye on disk usage as the gimp projects eat up a lot of file space. The Sources directory currently has just under 500 GB of stuff. The next major task after getting the backups going is to clean up all these aerial photo resources.

As I keep looking at ergonomics, apart from changing a couple of screens around, I have to figure the best way of heating the room in winter and therefore placing the little 800 watt radiant heater where it is useful for both the main desk and the side desk. At the moment it is only useful for the main desk, being on the right, and therefore really needs to be on the left where the second desk is. Therefore my cup slide on the left could be in the way. Moving that is not easy because there is limited room on the right, and I really don't want to move the cup slide over there. The other option is to put the heater on the table itself. Moving the table slightly closer to the main desk, and moving it into the room more, are optional tweaks that could help this work. Because the main air in the room needs to be at 16 degrees I will probably use the air con to raise the temperature in the room, and then use the little heater for boosting that for my personal comfort. It seems strange that last year I went right through winter heating my bedroom at night to 16 degrees, but in daytime I didn't heat the lounge air. 

Tuesday 13 March 2018

Multiple keyboards [2]

This is what the arrangement of keyboards now looks like with my computers. Basically on the left you have the double keyboard slide with two keyboards on slides under the desk, and then a third keyboard above. Over to the right you can see a fourth keyboard on top, and then below it two KVM switches (with four buttons and five lights each) are stacked directly under the desk top.

The way this works is the keyboard and mouse on the big slide at the bottom are connected through the black KVM on the right, and the keyboard and mouse on the small slide above them are connected through the white KVM on the right. Both KVMs are connected to all four computers. the net result is that of these two keyboards and their attendant mice, each of them can be connected to any one of the four computers independently of each other.

The two keyboards that are up on the desktop are each connected permanently to one specific computer. Both of these are multimedia keyboards with a built in touchpad to perform mouse functions. However, for convenience, the left hand keyboard has a separate mouse connected alongside it. This one controls the mediapc and the right hand one controls the win10pc.

Having two keyboards able to be switched around instead of one is quite useful when using two computers to work on simultaneously as the big keyboard can be assigned to the one doing the most work and the secondary computer still has a readily accessible keyboard without having to switch between computers all the time. This is all helped as well by the double slide. Having finished installing that last week the next task was to make the shelf to let the keyboard for the win10pc sit on the desktop instead of making another slide for it to sit underneath, and that in turn cleared the way for the two KVMs to be stacked with special brackets underneath instead.

Monday 12 March 2018

Photography notes 03/2018

I used to write on this blog a lot about my digital cameras and photography. Back then I took a lot more photos and even had many thousands of them published online. However in recent years my focus for photography as a hobby has waned and I took down virtually all of my online photos, in part because of a bad experience with Flickr. Be aware if you are outside the US you have no rights as such on Flickr, and barely any more if you are in the US. Their customer service is terrible. The problem I had with them was someone discovered my photos and apparently filed malicious takedown requests for some of them. Flickr did not notify me of these requests as they are required to do and as would be an obvious courtesy, and I had no knowledge until I happened to be scrolling through some of the online albums and noticed the "image unavailable" graphic had replaced some individual images. In the US Flickr is required to follow the correct procedure and let people know as people can challenge these takedown requests but this law does not apply to other countries and it appears Flickr has decided not to notify users outside US and they do not have any ability to challenge or reverse the decision. This discovery led to me taking down all of my Flickr albums and as it took a lot of work to put them there in the first place I am not prepared to put them onto another photo service. I use a Flickr site with NZ Rail Maps to share some resources solely because they can be downloaded at full resolution, and most of the actual maps are stored on Google Photos. I do put some albums onto Google Photos where I want to share them with people that I personally know such as school or church functions.

Apart from that I also take less photos in general and as a result I don't spend as much time or money on cameras these days, unlike the time in my life when I replaced one of my cameras almost every year, although many of these were cheap cameras costing less than $200 and because they had taken thousands of photos in that time they had been well used.

Currently the main cameras I use are a EOS 600D DSLR and a Powershot SX260. The DSLR is very good and reliable. The Powershot has been very good but now has developed a problem with the automatic shutter over the lens jamming. It can be nudged fully open but is a liability when it doesn't completely open and you don't notice. This has been a pretty good camera apart from these issues and I have had it about 5 years and have had the EOS 600 about the same length of time. 

I am looking at a Canon EOS M series as the replacement for the SX260 although they are relatively bulky, it is still a smaller camera than a DSLR with the body being about the same size as the SX260 folded up, the lens is the bulky part but it can be collapsed. The EOS M100 is the current replacement for the M10 I mentioned earlier and is available in NZ through official Canon channels unlike its predecessor. With a APS-C sensor the imaging and video performance is very high quality although possibly a little below the EOS 600D. However the 600D has problems when shooting video that causes it to only be able to record for about 10 minutes at a time, some sort of inherent technical limitation. I would be very surprised if the mirrorless camera had the same problems and expect it to be able to record long video clips. The usage of the EOS M would be similar to a DSLR with manual zoom, which of course has advantages with video due to lack of noise and being able to control the zooming speed. The ISO ratings can go very high and it has a 24 megapixel output and full HD video. I will look at buying one of these if I can find some way to squeeze the necessary dosh out of a stone as I am a bit skint at present. Being a more compact camera than a DSLR is important for me so that is one of the drawcards.

What has been good lately has been taking photos for church events and I hope that will pick up in future as it was something I used to do more of in the past and did wane in recent years but it looks like that would happen more often now.

Friday 9 March 2018

Multiple keyboards etc

My last post mentioned keyboard layout arrangements at my desk. I have now completed building a double keyboard slide (two sliding shelves directly on top of each other) the purpose of which is easy access to two different keyboards/mice for working with two computers simultaneously. This job took all day on Wednesday to complete and since then there has been a bit of tweaking to get everything right. This has included fitting a locking pin to the top slide so that the depth can be adjusted and locked at positions other than all the way out, and shortening the runners on the bottom slide to reduce the depth when all the way out. Ultimately there was a bit of juggling to figure out the depth to set each slide to that is reasonably optimal while minimising depth to the most practical extent. The arrangement is that the right angle brackets have both sets of runners attached to the same brackets and both shelves are the same width. A lot of stiffening had to be added because the bottom shelf is relatively heavy, so extra brackets needed to be added and wooden rails had to be put on the sides. There are in fact four pairs of brackets supporting the rails.

The next step is to have two KVMs, one per keyboard/mouse set, to allow the keyboards to be assigned to any computer out of four. I am waiting for an order of USB cables I need to hook up the second KVM to be delivered. This is a much more versatile arrangement than having only one keyboard able to be switched.

The old keyboard slide that used to be on the right hand side and holding the Windows computer's keyboard has been moved to the left side to be used for cups and any food items and has been adjusted to slope away from the desk so any liquid spills won't go over the computer which is under the desk on that side. 

I am still experimenting with a shelf on top of the office drawer cabinet and have not reached a decision about having it or not. The replacement keyboard slide for the Windows keyboard to sit on is still to be assembled and mounted under the desk. At the moment I am considering whether I even need it there or whether to use some other arrangement as the dual keyboard arrangement will make it easy to use the second keyboard to control that computer. Alternatively a fully raised slide like the upper one will still allow me to use space under the desk for the 2nd KVM etc. Another option is to adapt the top of the desk to allow the keyboard to sit on the desk.

It looks like Borg is easy to set up on serverpc, I just have to install and configure SSH on serverpc to get it set up to be the backup host, it will have borg installed on it as well and uses SSH as the network protocol, more reliable and faster than a Samba connection.

Wednesday 7 March 2018

ReinstallMyPC: Symlinking /home/patrick/Maps to /mnt/share/mainpc/maps

This week I started using serverpc to store some Qgis maps resources for NZ Rail Maps. Because everything has to work across network and local access (directly from mainpc) it means mainpc has to have a symlink created as mentioned in the title.

Using the command to do this:

ln -s /home/patrick/Maps /mnt/share/mainpc/maps

whereby maps is the name of the link that is created in /mnt/share/mainpc, to /home/patrick/Maps

Otherwise there is not portability between network and local access to resources because the paths are different (on remote computers the /mnt/share/mainpc path is always the one that the Maps folder is mapped to over a SMB network share).

So this is another task that has to be accomplished when reinstalling Linux on mainpc. As such I am now putting in a new tag, which is going to be ReinstallMyPC, and will be attached to some of the other articles, for steps to follow when reinstalling my computers.

New bits for "old" computers [7]

The serverpc is now being used to store additional mapping resources, specifically aerial photos as the amount of space these take up is significant and at times has filled up a lot of disk space on mainpc. I am working on a new layout of my keyboards so that I can use both computers at the same time for mapping quite easily, since Qgis will mostly be running in a VM on serverpc since it can be allocated 12 GB of memory on that computer. At the same time I am using a MapResources VM specifically set up on mainpc in order to be able to guarantee saving the session each time that I shut down that computer. This is because I have experienced ongoing issues with hibernation in Debian which can be very reliable a lot of the time but can also be frustratingly unreliable at other times. I got the replacement K230 keyboard and it's much better than the previous one so that is the keyboard being used.

The two keyboards, the main one that is switchable between computers and the K230 keyboard for serverpc, will have a double stacked sliding shelf arrangement so that the main keyboard shelf I have that slides under the desk will come all the way out for the main keyboard, and above it will be a second shelf that also slides out, and holds the keyboard and mouse for serverpc. This second shelf will not be able to be slid in without removing the keyboard and mouse off it, as it will go right under the desktop with no clearance. I am working today on that plus also increasing the size of the right hand keyboard slide where the keyboard for the Windows computer sits, because a bigger one is needed, and installing a slide on the left hand side, that will be used only for cups. So a lot of work today with the woodworking tools etc to achieve that.

One of the things I am going to have to do with the aerial photos while mapping is to make VRT layers out of them in order to reduce the number of layers, this should improve the processing, and at the same time reduce the number of layers that are being stored on disk to only the ones actually needed, because of the disk space usage. Since I am eventually going to want to be using the aerial coverage for the whole country. In order to be able to select just the images I want, I am going to have to learn scripting so that I can have a script that will read the QLR layer definition files that Qgis produces, and grab the specific images listed and copy them (along with the sidecar files) to another directory. Apart from having only the files that I need, it also means the VRT create utility can only use the files it needs.