Archive

Archive for the ‘Programming’ Category

For windows users: Convert video files

July 27, 2012 No comments
No Gravatar

Easy and free video converting is not any more sole priviledge of GNU/Linux operating system. Program called FFMPEG, which is the ultimate video editor and converter has came to Windows too. You can download it from here: http://ffmpeg.zeranoe.com/builds/

However, there is a problem: FFMPEG is a command line program which is difficult to use. Instead of searching for expensive solutions or front-ends, I have made simple batch script that you can use to convert video files. Script is set to be used to convert videos downloaded from youtube to a format playable on most TV sets that has USB etc.

Script is changable easily, and legally. Here it is. You need to select all and copy text to your favorite text editor. Save file under any name you wish, but add “bat” extension. Example: “convert.bat”.

@echo off
rem --- This program will change all files of type set in EXT_IN to a files of type set in EXT_OUT (MP4 to AVI)
rem --- It is free and is published under GNU/GPL v2 GENERAL PUBLIC LICENSE 
rem --- see http://www.gnu.org/licenses/gpl-2.0.html for more info.
rem --- FFMPEG is necessary for this program to work. Please download it if needed from 
rem --- http://ffmpeg.zeranoe.com/builds/  and use STATIC 32-bit or 64-bit according to your OS

rem ------- Settings. Change as required. -------

REM ******* INPUT and OUTPUT file extensions. Change accordingly to your needs. 
SET EXT_IN=mp4
SET EXT_OUT=avi

REM ****** executable ffmpeg with path. Change accordingly to your case
SET FFMPEG=C:\Windows\SysWOW64\ffmpeg.exe

REM ****** set video and audio codec: XVid = libixvid, MP3 = libmp3lame *********
SET VIDEO_CODEC=libxvid
SET AUDIO_CODEC=libmp3lame

REM ****** set bitrate. 3Mb/s = 3192 Kb/s *****
REM **** Low quality, small file: 1M
REM **** best quality/size ratio, 3 to 4M
SET BITRATE=3M

REM -------------------------------------------------------------------------------
REM ******************* program - do not change unless you know what you are doing
REM -------------------------------------------------------------------------------
if %1.==Sub. goto %2
 
for %%f in (*.%EXT_IN%) do call %0 Sub action %%~nf
goto end
 
:action
%FFMPEG% -i "%3.%EXT_IN%" -vb %BITRATE% -vcodec %VIDEO_CODEC% -acodec %AUDIO_CODEC% -y "%3.%EXT_OUT%"
 
:end
Categories: Multimedia, Programming, Technology Tags:

SWF protection – SWF Protector 3.0 review

July 7, 2010 2 comments
No Gravatar

With rising problem of SWF reverse engineering, I was looking for a simple tool that does SWF protection. There are variety of tools out there, but one got the hold of my eye, so I decided to do a little testing. Not that I have something to hide, as I usually write GPL code, but when I do it for clients, then it is reasonable to mess up some sensitive code parts.
That tool is SWF Protector 3.0 which has nice interface and it is very simple to use.

According to author, it provides unbreakable protection for reverse engineering. I do not believe that, as everyting is breakable sooner or later, but for now it does the job good. It has two levels of protection, for Actionscript 2, for which I do not care about as I don’t use AS2, and two for AS3: Obfuscate and Protect.
Obfuscate does not protect SWF from decompressing and reverse engineering, but it really messes up code beyond readable. Protect protects from reverse engineering completely. Good thing is that default setting is to do both at once. However, since they increase size of the file, if size of SWF is really important, Read more…

Flex3 – Autocompletion failure fix after SDK upgrade

July 5, 2010 3 comments
No Gravatar

What irritates me the most in Flex Builder 3 (windows) or Flex3 for Eclipse (linux), is when you upgrade SDK, you loose autocomplete or some packages cannot be found by autocomplete.
For example, most common error is when you write import flash. and want to get events, all you can see is flash.errors but not flash.events or any other.

Problem: (this is just pure speculation)
Since FB3 comes with FlashPlayer 9.x, and most probably that you have 10.x by now, adding SDK looses itself between versions. No matter if you set in SDK’s ini file that target player is 10.

How to fix it:
Go to your project properties -> Flex Builder Path, choose Library tab, and expand your SDK.
DELETE playerglobal.swc then add playerglobal.swc manually from SDK.
(same-same but its somehow very different).

Now, clean your project and WOA! Now you have autocompletion and can see all packages.

Flex: Callback of a Callback

March 26, 2010 1 comment
No Gravatar

Depending on architecture of your Flex application (or application you work on), you might have to use callback functions, or it is mandatory to use them. Of course, you shouldn’t be mixing things inside so service functions should remain in service class, where you call your remote objects. Callback function populates your model and that is it. We shall not get into merit should you use MVC, callback functions etc. but presume that you have to do it this way.
So, this is a typical remote service call: Read more…

Baires – Batch Image Resizer

December 10, 2009 1 comment
No Gravatar

The problem: I need the easiest way possible to resize a bunch of images from a digital camera, or from one directory, and place them into another.

There are a lots of great tools for the job. As linux user, I had a choice of a variety of excellent applications to use, from large scale applications like GIMP or Krita, to small tools like BIRT. Lately, because I have KDE4, I used Gwenview because it supports batch resizing.

However, all of them ask you to select the files which you wish to resize. Well, I want all of them; I may have already prepared them in some directory by selecting them from various sources. So, file selection was just slowing me down.

Solution: Since I could not find a tool which would solve my problem, I made one.

Baires is an application that will resize all of your pictures that reside in a selected folder, and resize them to the same folder or another folder. Since it keeps ‘last used’ settings, next time resizing is just one click away.

Baires is an open source GUI application, made in Qt. It works on all platforms, but if you are not using openSUSE or Fedora linux, you’ll have to compile it from source. I have pre-compiled RPM packages for openSUSE 11.0 to 11.2, SLED/SLES 10 and 11, and Fedora 9-12, available for download.

You can download it from Baires download page

Flex 3 : Events – part 2

August 11, 2009 No comments
No Gravatar

I have seen that many of the junior Flex programmers have problems in understanding how events in Adobe Flex works and how should be used. So, I find a good thing to explain events a bit more. I have already wrote about custom events in this article. It’s time to go a bit deeper. Read more…

Flex 3 – ProgressBar suddenly stopped working? No problem!

May 20, 2009 No comments
No Gravatar

I had to take some parts of the old project to complete deadline for the new project I was working on. One of the components that I used had a ProgressBar, that worked like a charm.

Before…

I had to load some video clip from the net, and show it’s loading progress in accurate measure of bytes, as well as percents and to have it visually as a progress bar. Well, OK, that is not a problem, since I was picking progressEvent which has bytesLoaded and bytesTotal. Those values were filled correctly and on my surprise, progressBar haven’t been updated as the event was fired.

What the hack? This thing worked.

After extensive investigation, I realized that we have changed flash player from 9.x to 10.x. Now, many of the things work in a different way. ProgressBar component is one of it.  Before, you could omit filling the “mode” property, or you could set ti to manual:  mode=”manual”

Now this doesn’t work. you must fill it, and fill it with proper constant:

mode=”{ProgressBarMode.MANUAL}”

Now, it worked as it was before.

Flex 3 – Creation of custom events

April 24, 2009 2 comments
No Gravatar

In Flex 3 and ActionScript 3, events are the most important. As AS3 is completely event-driven asynchronimus language, commands are not waiting to finish, but executed in order, and waits for no one and nothing. However, there are a lot of code that dispaches and capture events in a way that is very error-prone. Read more…

Flex 3 – Smart positioning popup component

March 18, 2009 1 comment
No Gravatar

Popups are something that one cannot and should not avoid nowadays in web applications. I am heavy user of popups, and mostly, I do not want them to be centered on the screen/browser but opened at some coordinates at the component that invoked it.

That is nice but one problem rises. What if your component (let’s say button, link label or whatever else) is at the right edge of the screen, and usual popup opens to the right? What if it is in the right bottom of the screen? Read more…