Thursday, February 20, 2020

a tale of two cities

This is one of my infrequent travel posts. Some earlier examples are

  1. https://hnsws.blogspot.com/2017/09/updated-budget-airline-flying-experience.html
  2. http://hnsws.blogspot.com/2007/01/flying-air-deccan.html
I'd been to Pune and Chennai recently, visiting family and also hand-carrying some items needed for our lab here. 

Both Chennai and Pune seemed to be less congested than Bangalore, the traffic jams were less severe. Also rode the Chennai Metro and was favourably impressed. Not as crowded as Bangalore's Namma Metro, since there were many more coaches - 6 vs 3 - per rake. And the interior was quieter too, during the run. The lines for token vending machines in Chennai Metro stations were relatively shorter than the lines for human assistance counters. And as expected, travelling by Metro across town was faster than travelling by car. Just half an hour to reach the airport from Annanagar, including time taken to buy tokens, wait for train, etc. 

Pune's green spaces also impressed me. Went for a couple of walks in a gated community's park and in the University campus. Apparently, some hills nearby are also preserved from tree-cutting, and offer a haven for wildlife. 

Tried out AC 1st class train travel. Comparing with AC 2-tier, the berths are somewhat wider, longer and more padded. Is it worth three times the AC 3-tier cost? Doubtful, unless you are four of a group and want the privacy of a lockable cabin. In the coach I travelled, there were 3 1st class cabins - A, B and C - occupying half of the carriage, and the other half of the bogey had AC 2 tier passengers. There were 2 toilets (one Indian, one Western) on the 1st class side, but no sink/mirror outside the toilets. Except for an initial stink when the AC was turned on, no adverse issues. Power sockets worked etc. The power sockets in the AC 2-tier cabins I travelled in for these trips also worked fine. But there was a problem with the water in the toilets running out for the Pune-Bangalore train. 

I also had my first flying experience with low-cost carrier Indigo, Chennai - Bangalore. It was an A320, VT-IZZ according to flightradar24, less than one year old. Favourably impressed by aircraft cleanliness, crew and on-time performance. They ask passengers to be at the gate 25 minutes before departure, so that everyone gets on quickly, and they have the freedom to push back early. In this case, "flying conditions at Bangalore airport" delayed the push back from 1 pm till 1.25 pm, but still reached BLR before the scheduled 2 pm since flying time was only 30 minutes and not the scheduled 1 hour. Probably the "flying conditions" were strong crosswinds. Even when we landed, the windsock was blowing right across the landing path. Boarding at Chennai used an airbridge, while de-boarding at BLR was on the tarmac, followed by a 10 minute bus ride to the terminal. This air ticket was only 30% in cash, rest in points using HDFC SmartBuy. So, I paid only around Rs. 500 out of pocket.



While at Chennai airport, I also had my first airport lounge visit, complimentary with my credit card. Access to the Travel Club lounge seemed to be only via a couple of lifts, which were quite busy. The restrooms were located outside the lounge, and hand wash was available only in the restrooms (!) so after you eat something, you have to go out and come back. But the lady in the reception desk doesn't say anything, in fact, she was the one who guided me to the restrooms outside. At 11.30 am, there were some breakfast items like idli and salads, and also aloo paratha with rajma which was my choice. A nice apron view, aircon and a place to eat. A bit cramped, so at busy times may get very crowded. 



 


build issues with appveyor

The working appveyor yml file is at
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml

The post-build artifact (exe file) can be downloaded from the Appveyor site due to the addition of the last "artifacts" section in the yml file.

The build issues were probably due to missing the OpenCV.props in some build configurations in
https://github.com/hn-88/ViewportSavercWin64/blob/master/ViewportSaverc.vcxproj

For example, line 72 has
<Import Project="qhy.props" />
<Import Project="OpenCV.props" />
while line 77 only has
<Import Project="qhy.props" />
 


building Windows binaries on the cloud - AppVeyor instead of Azure

Instead of relying on a virtual machine which will expire in 60 days, explored other solutions like an Azure free trial (one year) virtual machine. I wanted to try a build with VS2015, since the OpenCV build which I have used and is known to be working was built with an older VS than the current VS2019. Also the current VS2019 had other build issues. But when I tried an Azure VM with a VS2015 image, I got the platform image not found error as in this page,
https://medium.com/@rafique82.ai/azure-virtual-machine-visual-studio-platform-image-not-found-4234fe058317

Instead of trying to troubleshoot this, since this is available only for a year, thought of CI tools like Travis, but for Windows. Googling found that AppVeyor was more stable for Windows CI.

Googling the docs and support forums, finally got a project using QHY camera SDK and OpenCV to build - the appveyor.yml gives the detailed syntax.
https://github.com/hn-88/ViewportSavercWin64/blob/master/appveyor.yml.

I also needed to tweak the paths in the project file, in this case set using a property page qhy.props, to match the values set in the yml file. 

Wednesday, February 19, 2020

deployment issue for Visual Studio VM image in Azure

This post on Medium gives the solution for Platform Image Not Found error on Azure. Basically this is a bug in Azure deployment, I guess. 

In short, download the resource template using "Download a template for automation" from our failed VM, search for the value which gives the error. Then run inside cloud shell:
az vm image list --all --sku vs-2019-comm-latest-win10-n
(or whichever image was giving the error.)

In the case of the medium post above, it was the version which had the error. Once the template was corrected and it was redeployed, the error was not seen. 

Tuesday, February 11, 2020

using Visual Studio on Windows 10 virtualbox image

  1. Visual Studio 2019 Community edition - 20 GB download from Microsoft.
  2. On my system, 45 minutes to unzip the file, since I was using a 3 TB USB external drive which was not very fast. 
  3. Then 45 minutes to import the OVA file into virtualbox.
  4. More downloads and installs - the default Visual Studio 2019 does not have the 'develop for desktop' SDK and tools needed for C++ console apps - 45 minutes more.
  5. Spent quite a while troubleshooting why the shared folders were not visible in Win10 - turns out that sharing and discovery is turned off by default, have to enable them in Network and Sharing from the control panel.
  6. Finally it turns out that projects which need earlier versions of the toolkit - like Spinnaker SDK which needs the VS2015 toolkit - won't work, complaining that the required SDK is not found. Even downloading the oldest available SDK shown for install doesn't solve the problem. Further, lots of errors with QHYCCD SDK, like
    1>J:\qhy\include\stdint_windows.h(28,1): error C2144: syntax error: 'signed char' should be preceded by ';'
    1>J:\qhy\include\stdint_windows.h(28,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>J:\qhy\include\stdint_windows.h(70,19): error C2146: syntax error: missing ';' before identifier 'int64_t'
    1>J:\qhy\include\stdint_windows.h(71,28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
  7. So now I'm trying the VS2015 DVD download, which is another 7.1 GB, 90 minutes. 
  8. Edit - update - 45 minutes to uninstall VS 2019. 
  9. Three hours forty-five minutes !! to install VS2015 from virtual DVD drive in virtualbox.
  10. Then the projects compiled without too much trouble, as "Win32 console project" though I was compiling it for an x64 Release target. Will probably upload the project and solution files, along with the property pages which I created, to the github repo.
  11. Just like Windows on underpowered machines, the virtualbox Win10 takes around 2 minutes to boot, around a minute to shut down, around 5 seconds after a click in order to start opening an app, and so on. On my configuration, just 2 GB RAM for the virtualbox, and it runs from an external USB drive. But things do get done.

Edit - a better solution might be to build on the cloud - my later post

Monday, February 10, 2020

steps to create ebook friendly pdf file from LaTEX

Recommended pdf file was with a5 papersize, 0.5 cm margins, and 14 point doublespaced text. In order to achieve that, had to follow these,
https://www.overleaf.com/learn/latex/Questions/How_do_I_adjust_the_font_size%3F
https://tex.stackexchange.com/questions/402009/exam-with-18pt-main-font

in my case, by adding the line
\usepackage[14pt]{extsizes}

and later
\documentclass[
14pt

etc.

And afterwards, needed to resize some figures to make them fit in the smaller page size, and also make text tiny in tables to make them fit.
https://tex.stackexchange.com/questions/374757/how-to-make-font-size-small-in-a-tabular-environment

\centering
\tiny
\begin{tabular}

aborted attempt to create html / doc / rtf file from LaTEX

The recommended way to export LaTEX from overleaf to epub or such ebook formats is to create a html / doc / rtf file first. But both latex2rtf as well as htlatex failed to convert my document out of the box.

latex2rtf was easy to install with apt-get install, but it aborted the conversion with Error! Could not find <\end{refsection}>.

htlatex - gave a few errors, which were corrected by installing the required packages as below. But the final output html still had jumbled equations. Not prettily bitmapped ones. In short,

gave
which pointed to

"A command of the form ‘htlatex filename "html,word" "symbol/!" "-cvalidate"’ asks for HTML output tuned toward MicroSoft Word. Such a format, however, relies on bitmaps for mathematical formulas."

texlive-latex-base
LaTeX Error: File `etoolbox.sty' not found
sudo apt-get install texlive-latex-extra

sudo apt-get install texlive-science




sudo apt-get install texlive-fonts-recommended

Package minted Error: You must invoke LaTeX with the -shell-escape flag.




self-publishing a book

My experience with self-publishing a book, with Lambert and Notion Press.

  1. Interestingly, both experiences were quite quick and easy.
  2. Lambert charges nearly 10 times more, but do worldwide distribution. Notion Press does India-only distribution, but will do worldwide if you buy 50 author copies. Which comes to nearly the same amount of money as buying 3 copies from Lambert!
  3. Both publishers accepted the print-ready PDF from overleaf. Lambert sized the page down to fit, from US letter to 5.5 x 8.5 inches. Notion Press wanted US letter size. Notion Press cover designer was quite nice.
  4. Notion Press online sales page at notionpress.com/store/ was much more polished than Lambert's morebooks.shop
  5. Ebook publishing with Kindle Direct Publishing, or with Draft2Digital and so on - did not work, since the equations in my pdf did not convert correctly from pdf to epub / mobi with their online tools. But text only content in doc/rtf format works fine with their tools.
  6. The recommended way to create epub / mobi was via tools to convert to html or rtf first, but the tools stuttered and I did not pursue it further. Details in another post
  7. Finally just created a pdf file with A5 size, which is reasonably well formatted to read on a Kindle or other ebook reader, as detailed in another post.


Friday, February 07, 2020

multipe displays with old macbook pro, manual mode setting

On the Macbook pro with GT 330 M graphics (circa 2010?), running Ubuntu and Linux Mint - Mint could easily detect a TV which was capable of 1366x768 display connected via a VGA adapter to the mini-displayport, and could start a secondary display on it. But it could not force 1080p out of the box. Mirroring the display caused the resolution to drop to 1024x768.

Ubuntu 18.04 - the mirroring option was not visible on the Display applet. But as per this page, was able to hit Command+p and mirror. Unfortunately, the mirroring did not automatically choose a supported resolution, so display was garbled on built-in display.

On MacOS, interestingly enough, neither the TV nor an older VGA monitor could be displayed - enabling the secondary display caused the OS to crash (or at least blank the display completely).

A detailed post on how to set desired modes:
https://unix.stackexchange.com/questions/227876/how-to-set-custom-resolution-using-xrandr-when-the-resolution-is-not-available-i

Saturday, January 25, 2020

background reading for fisheye

Some background reading for fisheye - types of fisheye etc

http://www.fmwconcepts.com/imagemagick/pano2fisheye/index.php

https://en.wikipedia.org/wiki/Fisheye_lens
(stereographic preferred)

http://paulbourke.net/dome/fisheyetypes/
normal fisheyes are equidistant == linear? the default I assume.

Edit - all this finally resulted in OCVWarp -  a link to all my posts about OCVWarp.

Wednesday, January 22, 2020

converting 360 videos to fulldome for planetarium projection

Following the helpful post by 'borkia' on the Fulldome Yahoo group, I set up a project in Blender to render fulldome frames or video from 360 videos. 'borkia' had posted this explanatory image.

I had to take a few minutes to remind myself of the Blender interface, since it has been 7 years since my Blender fulldome experiments.
  • Right-click to select an object - this can be a camera also

  • Change its properties like position, rotation etc using the object tab on the Properties panel,

  • The rotation of the sphere in the screenshot above changes the up-down angle. Increasing the X angle is like tilting the camera down.

  • I saw this tutorial for getting to know how to edit nodes - what he suggested was to move the timeline up, and in place of the timeline, choose the editor type to be the Node editor. 

  • The Cycles rendering engine must be selected. The rest of the settings as per 'borkia's explanatory image. On my old model i7 Macbook Pro, 512x512 images were rendered in less than 2 seconds. 2048x2048 were taking 30 seconds per frame. So, around 1000x slower than real-time. So, a half-hour segment would take 20 days to render. I suppose it would be better to render in few-second chunks. One minute would take around 16 or 17 hours to render. 100 frames would take around 50 minutes or an hour. Cycles is capable of supporting GPU-based rendering, so it might work much faster with a NVIDIA + Mac Pro.

    Edit: OCVWarp can do much much faster - 4 frames per second or so for 2K output.

basics of Nodes in Blender

This video - Nodes 4 Noobs

Wednesday, January 15, 2020

Windows XP in virtualbox

Download a free version of Windows XP (30 day trial) from Microsoft - https://www.makeuseof.com/tag/download-windows-xp-for-free-and-legally-straight-from-microsoft-si/

WindowsXPMode_en-us.exe from https://www.microsoft.com/en-us/download/details.aspx?id=8002

Open the exe as type cab, unzip. Inside sources, xpm folder has the files we need. Unzip to folder, rename VirtualXPVHD as VirtualXP.VHD

Inside Virtualbox, create vm, Expert Mode, use existing hard disk & choose the vhd file above.

Virtualbox settings -> system, change boot order to HDD first for the XP virtual machine.

Display* - increase video ram

Network - set to Bridge

Set IP to 192.168.1.10 & google dns

Devices -> Install Guest Additions CD image

Snapshot to go back after 30 days. In Virtualbox, Machine | Take Snapshot

Devices -> Shared Folders to see host files

Right side Command ALT C for toggle scaled mode in Virtualbox.

More about virtualbox screen size - from https://askubuntu.com/questions/3205/higher-screen-resolution-in-virtualbox

(a) Settings > Video > Video Memory = 128 MB, Enable 3D acceleration = true.

(b) Install Guest Additions

(c) On Host machine, in cmd/bash, run
VBoxManage setextradata global GUI/MaxGuestResolution any 




This application has failed to start

A somewhat vague error message from Windows about "This application has failed to start". Following this page - https://www.coffeecup.com/help/articles/this-application-has-failed-to-start-because-the-application-configuration-is-incorrect-error-message/ - Reinstalling the C++ runtime environment seems to be the solution. 

Monday, January 13, 2020

6 mono waves to 5.1 AC3 using ffmpeg

Instead of using WAV to AC3 on Windows, a cross-platform solution using ffmpeg - from http://ankitshah009.blogspot.com/2015/02/useful-ffmpeg-commands.html

ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav \
-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]" -map "[aout]" output.wav

So, in our case,

ffmpeg -i Eng.wav -i Hin.wav -i Tel.wav -i Eng.wav -i Eng.wav -i Tel.wav \
-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]" \
-map "[aout]"  -acodec ac3 directaudio.ac3

in a single step.


Sunday, January 12, 2020

warping on Linux - filter on avisynth and virtualdub - OK

While exploring ffmpeg and the Remap filter for warping videos, noticed that this filter is not GPU optimized, it does not use OpenGL. So, if avisynth works on Linux, even the avisynth filter made for warping should do the job just as well.
http://www.avisynth.nl/users/vcmohan/Planetarium/Planetarium.html
http://www.avisynth.nl/users/vcmohan/index.html


For this, would need to get avisynth working on Linux under wine.

This link
https://forums.opensuse.org/showthread.php/429428-howto-install-virtualdub-under-wine-deshaker-plugin
gave hope for getting Virtualdub working under Wine.

In my case, I downloaded
VirtualDub-1.10.4,
ffdshow_beta7_rev3154_20091209.exe
(the latest one, ffdshow_rev4532_20140717_clsid did not work)
Installed winetricks with apt and mfc42 using winetricks
vcredist_x86.exe
Xvid-1.3.2-20110601 (Xvid-1.3.5-20171208 did not work)
installing ffdshow, the vcredist and xvid using
wine ffdshow_beta7_rev3154_20091209.exe
and so on. Mostly choosing the defaults. In my case, running the setup for vfw, video and audio after installing ffdshow, I ran into errors in the MS runtimes. But things seem to work anyway.

Avisynth works, except that DirectShowSource doesn't work, we need to use FfMpegSource.
Avisynth can be used with mencoder

and avs2yuv may be an easier way to do piping.
"There is no function called FFMS2" - found that I was running Avisynth 2.5, while the plugin was was Avisynth 2.6 - "This is not an avisynth 2.5 plugin".
Had to install older version, 2.1 of ffms2 - trying 2.18rc1 worked. Installation is by copying the dll to the plugins folder.
Syntax for old version is different from the latest version -
Loadplugin("/home/myusername/.wine/drive_c/Program Files/AviSynth 2.5/plugins/ffms2.dll")
FFvideosource("in.mp4")
If I make any changes to codec settings inside Virtualdub, then rendering crashes. Must close and open vdub again. Also, need to set DirectX rendering Off, otherwise does not proceed beyond the first few frames, and garbage is rendered. This is in VirtualDub Options -> Preferences



Also, vdub on Wine does not work as frameserver. 
My machine renders Xvid videos with simple profile, as needed by my BluRay player, at around 20 fps, and drops to 8 fps when using the avisynth warping filter Planetarium.dll. The rendering only works for me with the ffvfw MPEG-4 codec and not with the Xvid codec - probably some installation glitch. Settings for simple profile and high quality like the screenshot below.

Testing of avisynth scripts is easily done in Virtualdub. As in the link mentioned above, can explore mencoder and or other rendering options using pipes.

Saturday, January 11, 2020

Blender Fulldome plugin and OSL

A couple of links - 

someone trying out Open Shading Language (OSL) scripts with 360 images and fulldome - https://blenderartists.org/t/osl-for-fulldome/570991

and a Blender plugin to "quickly create and preview domemasters for planetariums" - https://github.com/johnroper100/Fulldome-Pro

Wednesday, January 08, 2020

faster rendering of kdenlive projects with melt

I had made a 107 minute video with kdenlive - exporting slides from a Google Slides presentation, and syncing with audio. While rendering it, found this link,
https://amp.reddit.com/r/commandline/comments/7mpiox/the_fantastic_melt_package_and_rendering_a/

melt /path/to/project.kdenlive -consumer avformat:output.mp4 vcodec=libx264 b=5000k acodec=aac ab=128k
went at 1.6x - 3600 frames in 72 sec
375% CPU with top. The entire render took approx 75 min.

Kdenlive was going at 0.6x - the 107 minute video showed 2:45, i.e. 165 minutes to complete.
250% CPU with top.

So, rendering with melt is more than twice as fast as rendering in kdenlive. This was with kdenlive-18.12.1b-x86_64.appimage and melt -version shows 6.0.0.

Tuesday, January 07, 2020

working with multi-track single wav files on Reaper and creating 'minus' tracks

To split a single multitrack file into separate mono tracks in Reaper (at least in Reaper 5), menu item
Item -> Item processing -> Explode multichannel item to one channel items

Then, single tracks can be solo'd till we hear only music, if the narration track is localized to one or two tracks. Muting does not seem to work, but solo seems to work. Then the file can be rendered into a 'minus' track, without the narrator.

Monday, January 06, 2020

enabling https on apache

Wanted to make our websites running Apache to be SSL enabled. Since we use Cloudflare, and Cloudflare has an option by which we can use self-signed certificates on the origin web-server, decided to try self-signed certificates first.

Followed this tutorial on digitalocean, which is concise, complete and to the point.

1. Our current servers use su and not sudo.

2. Creating a key pair with
openssl req -x509 -nodes -days 365 -newkey rsa:2048 
-keyout /etc/ssl/private/apache-selfsigned.key 
-out /etc/ssl/certs/apache-selfsigned.crt

3. Creating ssl-params.conf in /etc/apache2/conf-available with the following text:
 
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
# Disable preloading HSTS for now.  You can use the commented out header line that includes
# the "preload" directive if you understand the implications.
# Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
# Requires Apache >= 2.4
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11, so commented out
#SSLSessionTickets Off

4. Modifying /etc/apache2/sites-available/default-ssl.conf by adding the correct contact info, and the correct key-pair paths. In our case, I had to copy the directives in default.conf, since there were a lot of changes to be done.

5. For finding Apache version,
apache2 -version
and enabling all the modules, configs and sites by
a2enmod ssl
a2enmod headers
a2ensite default-ssl
a2enconf ssl-params
apache2ctl configtest
service apache2 restart     

6. In our case, cloudflare could do the https redirecting. But redirecting all traffic to https breaks our pages which have POST links, since those are not redirected. (Edit 21 Feb - after the POST links were updated to https, turned "Always use HTTPS" on. No issues.)

7. Found that this procedure can reasonably be easily replicated with a certificate from letsencrypt -
https://letsencrypt.org/getting-started/
https://certbot.eff.org/
In our case, perhaps doing a cert only cron job with certbot would be desirable.
certbot-auto certonly --server https://acme-v02.api.letsencrypt.org/directory --manual 
--preferred-challenges dns -d 'ourdomain.tld,*.ourdomain.tld'

I did try it out manually. For automating it, we would need to put the Cloudflare API key on the server, or the newer token with more limited powers, for automatically updating the DNS TXT record used for validation by certbot and letsencrypt. Or perhaps even the simpler option given at the certbot website might be enough.
certbot-auto certonly --apache

In this case, it takes a bit of time, and asks which domain we want the certificate for. After that, it works, with http authentication. May need some tweaking to automate this, since there are multiple domains involved. But renewal seems to be simple. As the closing notes say,

Performing the following challenges:
http-01 challenge for our.domain.tld
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/our.domain.tld/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/our.domain.tld/privkey.pem
   Your cert will expire on 2020-04-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto renew"


 

Thursday, January 02, 2020

Reset Raspberry Pi password

Forgot password - reset it by booting into single user mode as given at http://mapledyne.com/ideas/2015/8/4/reset-lost-admin-password-for-raspberry-pi

  • Take out the SD card after powering down the Pi
  • Edit the cmdline.txt and add to the end init=/bin/sh
  • Once the Pi boots into single user mode, just su to become root, no password, and then do passwd pi to reset the pi user's password.
  • Then again take out the SD card after powering down, remove the init phrase from cmdline.txt

The link above also has troubleshooting tips like mount -o remount,rw /dev/mmcblk0p2 / etc. Also, if root pw is set, , replace contents of /etc/shadow with * to make it blank as above.

SD card was read-only with the laptop's built in reader. If an external card-reader was used, it could be written to. The issue was something else, not a chown issue or a hardware switch as in the following: https://ubuntuforums.org/showthread.php?t=2400119

Also, changed the auto login by editing /etc/lightdm/lightdm.conf

Raspberry Pi wifi not working for new Pi 3B+

Apparently the wifi is disabled for regulatory reasons till country code is set - https://www.raspberrypi.org/documentation/configuration/wireless/desktop.md - "To set the country code, open the Raspberry Pi Configuration application from the Preferences Menu, select Localisation and set the appropriate code."

and then it probably needs a restart.

Tuesday, November 19, 2019

brief review of machine transcription - old recording to text

Tried out automated speech recognition from Google. Though there is a lot of improvement over the last couple of decades, still a long way to go. 

1. Google's paid product is priced at around Rs. 100 per hour, with the first hour free. https://cloud.google.com/speech-to-text/
 Google's version first:

Followed by my transcript.


You can see that it has made quite a few mistakes, and more importantly, missing entire sections. The skipping of sections would be the big  no-no for me. (I take around 3 minutes to transcribe one minute of English from this old recording).

2. Using Google Docs "voice typing" free feature - 


Monday, November 11, 2019

some simple light-weight webservers

On linux - lighttpd is available widely, for example in ubuntu's repos. Some examples given at https://unix.stackexchange.com/questions/32182/simple-command-line-http-server are SimpleHTTPServer in Python, node.js (lightweight compared to apache) and many many others. And for windows, this page lists tinyweb which can even run cgi.

trial embed of audio and pdf

Testing an embedded audio file with two embedded pdfs. All hosted on Google Drive, with embed code obtained from More items -> Open in New Window -> More items -> Embed.

Indic input enabled using Google Acccount Settings -> Language -> Input Tools -> Edit
https://www.google.com/inputtools/services/products/account-central.html
Then choose File -> Language to choose the required language within Google Docs.





warping on Linux - initial ffmpeg trials without a final solution

I still use the tool made in 2014 to pre-warp fulldome planetarium shows for our planetarium's Blu-ray-player-based playout system. But that tool's main limitation seems to be that it works only on Windows XP. It does not seem to work even on Windows 7 - I tested with RS's laptop.

In the search for alternatives for future-proofing, I had a look at ffmpeg's Remap filter. If a suitable map is made, it should be possible to use this filter to do the warping in a platform independent way.
ffmpeg -i /path/input.mp4 -i front_kodak_sp360_1440_xmap.pgm -i front_kodak_sp360_1440_ymap.pgm -lavfi remap out.mp4

Preliminary test went at around 8 fps, 1 minute video took 4 minutes to encode.

out.mp4 was of a similar format to input file, but not exactly.

mediainfo out.mp4

Testing to see if opengl will be faster, tried with just re-encoding to divx,
ffmpeg -i /path/input.mp4 -c:v libxvid out.mp4
did the 1 minute video in 2 minutes, but quite low quality for the highly changing scenes. That would be 15 fps.

ffmpeg -i /path/input.mp4 -c:v libxvid -qscale:v 100 out.mp4
did not make much of a difference.


Some info about OpenGL filters with ffmpeg
Piping to screen works, albeit not in realtime, 0.25x perhaps.
ffmpeg -i /path/input.mp4 -i front_kodak_sp360_1440_xmap.pgm -i front_kodak_sp360_1440_ymap.pgm -lavfi remap -f matroska - | ffplay -

inspired by

Using rawvideo, (raw RGB is not supported in matroshka, so using NUT), went to 0.68x, but in black and white!
ffmpeg -i /path/input.mp4 -i front_kodak_sp360_1440_xmap.pgm -i front_kodak_sp360_1440_ymap.pgm -lavfi remap -c:v rawvideo -f NUT - | ffplay -

with AVI instead of NUT, colours are mismatched and not antialiased?!

Later, went to try avisynth instead. That is described in another post.




Friday, November 08, 2019

shared folder new behaviour

Now when I move something out of a shared windows folder from our Linux server, I get this message:

mv: listing attributes of ‘THE_FILE_NAME.mp3’: Numerical result out of range

After the file is moved to a local drive on the Linux server, moving it elsewhere doesn't give this error. Maybe this behaviour is something to do with this,

https://wiki.archlinux.org/index.php/File_permissions_and_attributes

"mv silently discards extended attributes when the target file system does not support them."

Edit: Most probably this message is due to group name or user name not being mapped to GID or UID properly, I guess - as discussed at https://serverfault.com/questions/811997/mounting-a-cifs-share-fails-with-numerical-result-out-of-range

Thursday, November 07, 2019

link dump - possible ways to port to GL_warp2Avi

Exploring ways to port my old tool GL_warp2Avi to cross-platform code - 


links to Linux version, which uses avifile >=0.60


Edit - a few months later, I've created GL_warp2mp4 using OpenCV and GLUT and the generalized OCVWarp based on OpenCV which can do what GL_warp2Avi could do.

virtual tours with 360 photos, and panoramas

Thought about creating a virtual tour of the planetarium with the Insta360 Air camera. This camera works reasonably well in good light, but cannot capture in low light as is the case inside the planetarium theatre - severely pixelated with the lights on, and completely dark when trying to capture the live planetarium show.

Saw some tutorials using cupix and google tour creator, then made one with google tour creator,
https://poly.google.com/view/6fr4ibdUbv0

Added the same images (after resizing to 4K) to google street view using the street view app. To change the directions in which the 360 images are pointed, under Edit location, the photo can be rotated by swiping while keeping another finger on the directions (N, NE, E etc.) shown below, to keep the directions steady. A bit fiddly. Positioning was also a bit fiddly, since the zoom level on the positioning map was not sufficient in my case.

Made a couple more panoramas, both using the Panorama feature in the stock camera app on my LG Q6 Android phone and using the street view app. The street view app tries to stitch it into a 360 image, so requires a very large number of photos.
Shot with the Google Street View App, which needs you to align the phone to a shown circle and click repeatedly.

Shot with the Panorama feature of the phone's camera App, which needs you to just wave your phone from left to right or vice versa. 
Also shot with the Panorama feature on the phone camera. A passerby created an artifact, so repeated below. 




stackoverflow gyaan on when to use GPU

getting a human being with HDFC phonebanking

It seems a bit difficult to get a human being using the HDFC bank tollfree number. One possible workaround is - choose the "Loans" option. If that option does not appear on the first menu, try the "Report stolen card" option, and when they ask for confirmation, choose "2 for any other services" and then "Loans". After a human being answers, you could tell them what you want, and if they say that they need to transfer your call, agree.

Thursday, October 31, 2019

GPU and CUDA explorations with OpenCV


Bscancompute
    While loop 9.01159 sec.
      While loop 12.5376 sec.
        While loop 13.7008 sec.

            2nd run
              While loop 9.03921 sec.
                While loop 8.88572 sec.
                  While loop 8.32227 sec.

                      Test wo FFT,
                        Before while loop 0.0226007 sec.
                          While loop 3.82644 sec.
                            While loop 3.6609 sec.
                              While loop 3.07903 sec.

                              • A simple sample program, to perform a 2D DFT and inverse, gave the following results on running more than once -
                              • samplecudadft,
                                480x360 fft and inv fft
                                DFT and inverse, with upload/dl 0.255261 sec.
                                (after running several times).

                                2400x360,
                                DFT and inverse, with upload/dl 0.261917 sec.

                                CPU
                                E:\OCT\opencvcuda\OpencvCuda\x64\Release>samplecudadft
                                DFT and inverse, on CPU 0.0144597 sec.
                                DFT and inverse, with upload/dl 0.260429 sec.
                              • bottleneck seems to be FFT "planning" and not upload download.

                                E:\OCT\opencvcuda\OpencvCuda\x64\Release>samplecudadftDFT and inverse, on CPU 0.0146046 sec.
                                DFT and inverse, with upload/dl 0.263986 sec.
                                DFT and inverse, without upload/dl 0.260521 sec.
                                and running it a 2nd time,
                                DFT and inverse, 2nd time without upload/dl 0.00618453 sec.
                              • Even when called as a function, quite fast after the first time.
                                DFT and inverse, as a function 0.00678208 sec.
                                DFT and inverse, as a function 0.00605592 sec.
                                DFT and inverse, as a function 0.00654344 sec.
                                DFT and inverse, as a function 0.00608254 sec.
                                DFT and inverse, as a function 0.00651554 sec.
                                DFT and inverse, as a function 0.00623649 sec.
                                DFT and inverse, as a function 0.00607195 sec.
                                DFT and inverse, as a function 0.0063154 sec.
                                DFT and inverse, as a function 0.00597894 sec.
                                DFT and inverse, as a function 0.00685649 sec.
                                DFT and inverse, as a function 0.00608895 sec.
                              • Will probably need to optimize based on
                                https://docs.opencv.org/master/dd/d3d/tutorial_gpu_basics_similarity.html
                              • Currently, with upload / download and variable assignment not optimized,
                                on cpu,
                                While loop 9.15065 sec.
                                on gpu,
                                While loop 9.34765 sec.
                                where variables were initialized, 64 to 32 conversion and back were included.

                                More important, the Bscan image shows up a bug.

                              Friday, October 25, 2019

                              a workflow for equal loudness RMS normalization on Adobe Audition

                              Sat with the Telugu team and worked out the following procedure for increasing and standardizing the RMS volume of their audio to -12 dB in Adobe Audition.


                              1. Match the volumes in the relevant regions to around -12 dB peak.
                              2. Do Noise Reduction by selecting a region of audio without noise, and then using that as the noise to be removed, around 70% or 80%.
                              3. Noise Gate at -60 dB - the threshold to be tweaked depending on audio's background noise level.
                              4. Choose either L or R track and mute the other track if relevant audio is only on one track, then convert to Mono.
                              5. Multiband compression using the Broadcast preset, and decreasing the thresholds by -20 dB, with Brickwall On.
                              6. Reverb filter if required.
                              7. Total RMS to -18 dB.
                              8. Hard Limiter at -6 dB.
                              9. Normalize peaks to 100%.


                              Tuesday, October 22, 2019

                              UTF-16 LE with BOM and compiler errors, warning: null character(s) ignored

                              By some fluke, the source code which I had edited on Windows got saved on github as UTF-16 LE with BOM (as reported by Geany). This was not compiling on Linux, which gave lots of warnings,

                              warning: null character(s) ignored

                              Googling got the UTF to UTF convertor on www.fileformat.info which converted the file properly to UTF-8. Problem solved.

                              Saturday, October 12, 2019

                              clearing up GMail used space

                              Change of 16.21 GB to 16.11 GB by deleting 8893 conversations from Trash, most of them short text-only email notifications.

                              100 MB for 10,000 short text emails, or around 10 kB per email.

                              So, probably it does not make sense to delete small emails - deleting attachments would clear up much more space.

                              Monday, October 07, 2019

                              X windows issues after CUDA install, resolved

                              Since my machine is supposed to have a GeForce GT 330M according to lspci, I thought I could try out the old version of CUDA SDK - apparently version 6.5 is the last one to support the GT 330M. The deb was supposed to be for Ubuntu 14.04, and I was running Linux Mint 18.1 based on Ubuntu 16.04. The deb and the apt-get install ran without any complaints. But ...

                              The build of examples worked, but the the cuda compatible nvidia card was not detected. And, after a restart, X did not come up.

                              Possible culprit was the NVidia driver for the older 14.04 kernel, which probably needed to be removed and so on. After some googling and some trial and error, the following method worked -

                              sudo apt purge nvidia*
                              sudo apt-get update 
                              sudo apt-get autoremove
                              sudo apt-get upgrade
                              sudo apt-get install --reinstall xserver-xorg-core
                              sudo apt-get install --reinstall xserver-xorg-video-nouveau

                              and a reboot. 

                              Sunday, September 22, 2019

                              WhatsApp notification issue and solution

                              On my LG Q6 phone, running Android 8, there was a problem of WhatsApp notifications arriving only after I opened WhatsApp. WhatsApp voice call notifications were also not coming through. After some digging, found the setting which made the difference - under Battery -> Power saving exclusions, allowed WhatsApp as an exclusion. Problem seems to be solved.

                              Saturday, September 14, 2019

                              tutorial on 360 to dome with Vuo on Mac

                               In the second half of this tutorial, Paul talks about warping 360 videos to dome -http://paulbourke.net/dome/vuo/

                              Edit: Can now use OCVWarp and do this ... 

                              Thursday, September 12, 2019

                              system program problem

                              Popup on startup - System Program Problem detected. The solution was to clear /var/crash as per this post.

                              Saturday, September 07, 2019

                              increasing font size in Octave legend

                              Some figures created in Octave had very small font sizes when added to the LaTEX manuscript. Trying to fix the text with Inkscape led to kerning issues similar to this post. So, found these solutions at
                              https://stackoverflow.com/questions/1532355/increase-font-size-in-octave-legend

                              Used commands like
                              print ("j0exp.eps", "-depsc", "-F:20")


                              Tuesday, September 03, 2019

                              starting offline processing in a new thread - C++

                              Tried various options to begin processing in a new thread for BscanFFT, without locking the UI - 

                              Just
                              std::system(offlinetoolpath);
                              // - this causes the BscanFFT program to wait for the offline tool to finish

                              Then,

                              pid = fork();

                              if (pid == 0)

                              {

                              // child process

                              std::system(offlinetoolpath);

                              }

                              else if (pid > 0)

                              {

                              // parent process

                              }

                              gives the error

                               [xcb] Unknown sequence number while processing queue

                              [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called

                              [xcb] Aborting, sorry about that.

                              BscanFFTspinj.bin: ../../src/xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

                              Apparently, system specific is safer, http://www.cplusplus.com/forum/beginner/13886/

                              "Actually, the most important disadvantage of system() is that it introduces security vulnerabilities. Using a system-dependent method (that skips the shell) is always safer.

                              In Windows, it is CreateProcess(), which is really straight-forward to use.

                              In POSIX (Linux, etc) it is a combination of fork() and one of the exec() functions.

                              http://linux.die.net/man/2/fork

                              http://linux.die.net/man/2/execve

                              http://linux.die.net/man/3/execv

                              These are also easy to use, but there are some caveats. Follow the example codes."

                              execve with the example code gave
                              (show:9323): Gtk-WARNING **: 10:47:16.601: cannot open display:

                              https://stackoverflow.com/questions/2437819/gtk-warning-cannot-open-display-when-using-execve-to-launch-a-gtk-progra/2437850#2437850

                              suggested using execv instead. This worked.


                              external hard disk prices

                              From amazon.in, current external USB hard disk prices which I collected for N -
                              1 TB = Rs. 3500 - per TB cost 3500
                              2 TB = Rs. 5100 - per TB cost 2550
                              3 TB = Rs. 6200 - per TB cost 2067
                              4 TB = Rs. 8100 - per TB cost 2025

                              The 3TB drives seem to be attractively priced due to the sharp drop in per TB price as compared to 2TB drives. 


                              Monday, September 02, 2019

                              gimp 16-bit caution

                              Gimp 2.8 opens 16-bit png files, but saves as 8-bit tif or png. Octave 4.2.2 on the other hand, does write 16-bit png with imwrite. Octave's behaviour depends on shared libraries, too, of course.

                              On Linux,
                              file filename.png
                              gives information about the file, like bit-depth and so on.