Monday, July 23, 2012

Adding existing C++ Makefile project to Ecplise for editing the files!


On linux based systems we generally compile C++ projects with Makefile. The default editors for the source code are gedit or vi/vim. However, these are not so user friendly for editing complex codes.

Therefore, many a times we want to use Eclipse for editing source files and comiple it using a Makefile. It can be done by adding the project to Eclipse in the following steps:

  1. Open Eclipse with its default workspace.
  2. Go to File->New->Makefile Project with Existing Code
  3. Browse to the main folder in which you have your project files
  4. Give appropriate project name. I generally like the name to be the same as the root folder.

Friday, March 23, 2012

How to convert windows figures (generated using PowerPoint, VISIO etc.) to EPS vector file!

Many times we find it more comfortable to draw figures on Windows programs such as VISIO and PowerPoint. The problem with these programs is that they don't have any option to save the drawings as EPS. A generally opted solution by many of us is "SAVE AS .jpg" and then use GIMP to convert to EPS.

THIS IS A VERY BAD APPROACH. 

EPS figures that are generated from jpeg are as bad as jpg, because they are not actually vectored, its just a single vector which does not scale when we zoom-in the images. 

Following are the STEPS that you can take to create proper vectored EPS figure from windows programs:
  1. Choose the "Save As" option and save the drawing in either "Enhanced Metafile (*.emf)" or " "Enhanced Windows Metafile (*.emf)", whichever is available.
    • Please remove PowerPoint (or Windows) specific special effects such as shadows or gradients. They may appear as SOLID BOX in final EPS.
    • To avoid the empty space of the slide around the drawing, group all the contents of the slide, right click, and save as *.emf. This will only save the selected group/objects in the emf file. 
  2. Convert the *.emf file into EPS file using Metafile To EPS Converter"
Please check the final drawing. You may have to do some adjustments sometimes because of compatibility issues. With VISIO it works fine.

Enjoy!
-Mukesh
    

Tuesday, February 7, 2012

Loss-less conversion of the video files to mp4 (libx264) using ffmpeg


ffmpeg -i input.* -vcodec libx264 -qscale 2 -deinterlace output.mp4
*-any format

Thursday, January 19, 2012

How to rotate videos on ubuntu!

Using mencoder:

  • To rotate by 90 degree clockwise
    • mencoder -vf rotate=1 -o output.mp4 -oac pcm -ovc lavc -fps 30 -ofps 30 input.mp4
      • It is important to specify both input and output frame rate (with fps, ofps), else you will get the  error.
  • To flip horizontally
    • mencoder -vf flip -o output.mp4 -oac pcm -ovc lavc -fps 30 -ofps 30  input.mp
Using ffmpeg
  • To rotate the video by 90 degrees, we can use the following command
    • ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
      • "transpose=1" => 90 degree clockwise
      • "transpose=2" => 90 degree anti-clockwise
    • You may get the following error while running the command-"No such filter: 'transpose'". In this case, you should you need to install Libavfilter.
  • To vertically flip the video 
    • ffmpeg -i input.mp4 -vf  vflip output.mp4
  • To horizontally flip the video
    • ffmpeg -i input.mp4 -vf  hflip output.mp4