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.