05.23.14

Bypassing MiCOM S1 Studio password

MiCOM S1 Studio is a program for programming power system protection relays. This post outlines how the password protection feature can be bypassed, in the case that it mysteriously starts asking for a password that it never used to like it did for me...

 

s1s_1

I know that S1 Studio is largely written in .NET, so lets try reflection to see what gives:
Read the rest of this entry »

| Posted in Software | 8 Comments »
03.18.14

Autonumbering Title Blocks in AutoCAD

Several people seem to have had this problem (going by the number of posts on the internet about it), but I didn't really find a satisfying solution.  After spending half a day on the problem, I think I have come up with something useable.

First, lets outline the problem:  Normally, along the top of a title block we have a column numbers (for referencing purposes).  Say there are 20 columns per drawing.  In a multisheet drawing, we want the first sheet to go from 1 to 20, the second from 21 to 41 and so on.  You can do this easily by editing your block each time and changing the numbers, but this is tedious...

Solution:
First we need to create a table for our column numbers.  My title block is 400 units wide, so I have a table 400 wide, with one row and 20 columns of 20 units each.  In the second column, enter the formula "=A1 + 1".  Drag this across all the columns so each one increments from the previous cell (so now you should have a blank first cell, then 1 to 19 in the others).autocad-autonum3
Read the rest of this entry »

| Posted in Software | No Comments »
02.6.14

On video formats

On a trip recently my friends and I recorded video on a few different devices, all of which used several different video formats.  We ended up with the following flavours:

MTS, x264, 50fps (interlaced), 1440x1080 (Effective ratio 1920x1080)
MP4, x264, 25fps (progressive), 1440x1080 (Effective ratio 1920x1080)
MP4, x264, 30fps (progressive), 1920x1080

We wanted to join all the clips together in movie maker, but unfortunately Windows Movie Maker is not that good at making all these different flavours look the same when they are run together - some are smooth (ish), some are noticeably more jagged and so on.

I first decided on a common format that I would try to convert all the video to.  The obvious choice for codec is x264, and MP4 is also the container of choice these days.  Frame size would stay at 1920x1080, and the video would be progressive (as all screens these days are progressive in nature).  The only real decision was frame rate.  Naturally the 50fps video looked smoothest, and was noticeably staggered once resampled at 25fps.  In the end I decided to convert everything to 50fps.  For the MTS video, this was straightforward using Avidemux with  yadif and scaling filters:

adm = Avidemux()
adm.videoCodec("x264", <omitted>)
adm.addVideoFilter("yadif", "mode=1", "order=1")
adm.addVideoFilter("swscale", "width=1920", "height=1080", "algo=2", "sourceAR=1", "targetAR=1")
adm.addVideoFilter("resampleFps", "mode=0", "newFpsDen=1000", "newFpsNum=50000")
adm.audioClearTracks()
adm.setSourceTrackLanguage(0,"unknown")
adm.audioAddTrack(0)
adm.audioCodec(0, "LavAAC");
adm.audioSetDrc(0, 0)
adm.audioSetShift(0, 0,0)
adm.setContainer("MP4V2", "optimize=0", "add_itunes_metadata=0")

Avidemux can be used for batch processing quite easily, just save the project file and remove the lines at the top of the project file that load the video and set the markers (else we end up cutting longer videos short!). Then we need a batch or powershell script to pass all the files we want to process, I used the following:

set avidemux="C:\Program Files\Avidemux 2.6\avidemux.exe"
for %%f in (*.MTS) do %avidemux% --force-alt-h264 --load "%%f" --run MTS2MP4.py --save "%%f.mp4" --quit

Next up I needed a way to convert the 25 and 30fps video to 50fps.  There seems to be two ways to do this - either fill the gaps with the existing frames, or predict the intermediate frames based on the frames either side.  Filling the gaps is not going to make the video any smoother, so I opted for the latter.  MeGui is the tool that gets the job done here - it uses AviSynth to do the heavy lifting (see http://mewiki.project357.com/wiki/Main_Page).  The Avisynth script I used:

Setmemorymax(512)
SetMTMode(3,4)
PluginPath = "C:\Program Files (x86)\MeGUI\tools\avisynth_plugin\"
LoadPlugin(PluginPath+"svpflow1.dll")
LoadPlugin(PluginPath+"svpflow2.dll")
Import(PluginPath+"InterFrame2.avsi")
<input>.ConvertToYV12()
SetMTMode(2)
InterFrame(Cores=4, NewNum=50000, NewDen=1000)
LanczosResize(1920, 1080)

I was pleasantly surprised with the results from this - the video looked much smoother, and the process introduced few artefacts.  With all the video in the same format, we can now import  into WMM and get a nice consistent frame rate in the output.

| Posted in Software | No Comments »
10.21.13

Moving photos from Nikon Picture Project to Picasa

I was asked recently to migrate someones digital photo collection from Nikons picture project software over to googles picasa. Seemed straightforward enough, but upon further investigation I discovered that Picture Project was a nightmare for interoperability with other software...

The main problem, is that everytime you import photos into PP via the softwares import functionality (the only way), it puts the files in a custom location, and the folder is given some numeric name (eg 1234). You then give the album a name in PP, and PP keeps a database of the name to number relationships. If you nest albums, the database keeps track of this too (the directory structure is flat). Annoyingly, there is no export function for PP, and the database is a password protected access database.  Initially I tried 'nikon', but it was wrong and I scoffed at the idea that they would pick something so easy. So, fire up IDA, search for 'mdb' and we find ourselves in sub_438A00. A quick browse of the function shows us this interesting looking section:

Read the rest of this entry »

| Posted in Software | No Comments »