Showing posts with label command-line. Show all posts
Showing posts with label command-line. Show all posts

Friday, November 27, 2015

Re-size VirtualBox Disk-Images

The native disk-file format for VirtualBox is .vdi, but VirtualBox is fully operational with other file formats as well.  ( .vdmk .vhd .ovf .ova .vdi ...)

However, if you need to re-size your virtual disk image, you might need to convert your file. To my knowledge, currently the re-size function within VirtualBox image manager works best with .vdi images.

In my case I was using a vmWare image of Windows 7 on my Ubuntu 12.04 / 14.04 LTS host, so I cloned my disk first to .vdi before re-sizing.

Tuesday, August 18, 2015

Extract the audio stream from YouTube videos

If you want to extract the audio stream from a video, you can do that with a series of software free and not free, but I prefer to use ffmpeg at the command line. It is very quick and simple.

Beware some video's have multiple audio files. Using the correct demuxing procedure is in order.

In this article I assume you want to extract audio from YouTube Video's with one audio stream


  • Open a terminal screen. (Ctrl+T in Ubuntu) 

  • type: ffmpeg -i inputfile.mp4 -vn -ab 256 outputfile.mp3



for more information visit the FFmpeg site


Thursday, March 20, 2014

Dynamically change screen resolution in Virtual Box for Linux host/guests.


If you install a new virtual Ubuntu machine (guest), in a Ubuntu system (host), by default the screen resolution is fixed to either 640x480; 800x600 or 1024x768.

You might want to change that to a system where the guest screen resolution is dynamically adjusted to the size of your window.

To do that you need to change some settings and make sure you have installed the guest additions correctly.


Procedure:

  1. Turn off 3D Acceleration in the VM settings

  2. Open Terminal screen and run these commands:

    sudo apt-get update  
    sudo apt-get upgrade  
    sudo apt-get install dkms  
    sudo apt-get install build-essential
    
    
  3. From the Devices menu, select "install the Guest Additions (Host-D)".
    Normally the auto-run application will start to install the guest additions. If not, a new CDROM will appear on the desktop / file manager. Open the device and (Rightclick) start Autorun.
  4. Restart the virtual machine
  5. Now if you resize the window or choose Full Screen mode, it will resize the desktop screen resolution properly.

Thursday, April 18, 2013

Splitting PDF-File via Command-Line

To Split a PDF file, or lets say, cut-out some pages, and save them as a new PDF file in Linux, you don't need to install any extra software. Of course you can use a nice GUI driven program to do this, but it is actually not that hard to do in command line. (I like to keep my system clean with the least amount of clutter, so I prefer to use the tools available by default)

If you want to use the command line function for this manually, it is a bit of a pain, so I recommend to create an alias for this PDF splitting/extract function.
You do that by adding the following code in your ~/.bashrc file.


1. open a terminal screen. (Ctrl + T)

2. type:  gedit ~/.bashrc

Tuesday, June 19, 2012

Merging PDF files via Command line (Build in tools)

Merging several PDF-files into one PDF file; In Linux, you don't have to install any additional software to do this. Everything can be done on the command line with a few simple lines of code. If you however don't like to work on the command line, you might want to install additional software (example: PDF-mod)
To make your life easier, I recommend creating an alias for the PDF merge function. You do that by adding the following code to your .bashrc file in the home folder.

MySQL- DataBase Backup (command-line)

The quick and dirty way to backup (dump) all databases currently served on the server:

I assume the server is not running any GUI, right at the command line, type the following:

sudo mysqldump --all-databases > /home/username/dumpalldb.sql -u root -p

where:
username = home folder for the user currently logged in.
dumpalldb.sql = the sql file dump of all databases.


Friday, April 27, 2012

Switch off ATI VGA in Hybrid cards with Intel on Ubuntu (solving overheating)


On my HP Pavilion dv7-6190ed (FW F.18) I have an AMD Radeon HD 6700M series video card, which sometimes it make my laptop overheat until 97 C.
The ATI Radeon and Intel VGA both run, and seem to go rogue at times. At the time of my install, (around Jan. 2012) the Catalyst drivers seem to have a problem with Ubuntu 11.10 (oneiric).
By switch off VGA AMD Radeon part of the card, it seem to decrease the running temperature, to about 60 C on av. Along with that it runs way more quiet. (no cooling fans going ballistic)
So basically, turning off the ATI VGA part of the card will decrease the heat problem in Ubuntu.

NOTE:  Since posting this workaround, there has been an upgrade for the BIOS (FW F.1B). They fixed option available now for ATI, may reduce heat too. so try upgrading the BIOS FIRST !!. here is the link>> BIOS FW F.18)


Tuesday, December 27, 2011

Remove Old Kernel versions, and update your grub Menu

If you want to clean up your system, and free some space on your system partiton, removing old unused kernel versions is a good start.
NOTE: Before starting any of this, make sure you have a solid back-up (There are several good GUI driven back-up systems for Linux available, although I still like to run my own scripts using rsync)

1. find out what the current kernel version is (open a Terminal screen): 

uname -r

2. Do a test run and see what will be removed. (nothing will actually be removed. it is so called a dry - run command)

Friday, December 16, 2011

Edit AVCHD files (*.mts) with Blender or Cinelerra::Convert .mts to DNxHD .mov

AVCHD (*.mts and *.m2ts files) are tough to handle in Blender VSE, or Cinelerra, especially 1440x1080 anamorphic interlaced files. (produced by Canon LEGRIA HF R16)

Using an intermediate file format, better suited for video editing, works for both, Blender and Cinelerra.

Cinelerra (a dedicated NLE) has come long ways, and the community version offers a lot of features, I still find it buggy at times. (has good potential though)
Blender VSE, very professional, but it has a very high learning curve. (so much more than a dedicated NLE)

Tuesday, October 25, 2011

Recover SD Card data in Linux

Deleted your family pictures on your camera by mistake?
You can recover them with the following procedure in Linux, (command line) given they weren't overwritten already.

Preemptive: You need to install gddrescue & testdisk

Sudo apt-get install gddrescue testdisk

1. find out to what device the SD card is loaded and where it is mounted.
Run in terminal screen (command line)

Wednesday, May 11, 2011

FFMPEG: Convert AVCHD (*.mts, *.m2ts) to H264

Most Camcorders including the "Canon LEGRIA HF R16" record Digital High Definition Video in full HD resolution at 50 frames (interlaced) in mts/m2ts-format.

Cross platform and one of the best compressions out there today is to my personal preference H264

Assuming you have installed ffmpeg and all the libraries you might need,
use the following command to get the job done relatively fast. 

Wednesday, May 4, 2011

FFMPEG: Convert AVCHD (*.mts, *.m2ts) files to AVI files

Most Camcorders including the "Canon LEGRIA HF R16" record Digital High Definition Video in full HD resolution at 50 frames (interlaced) in mts/m2ts-format.

To create more a transportable Standard definition DVD quality progressive avi file,
you can convert them with ffmpeg.

Assuming you have installed ffmpeg and all the libraries you might need,
use the following command to get the job done relatively fast.

Saturday, June 26, 2010

Convert OGV to AVI on Command Line.

Converting ogv files to avi files using mencoder at the command line:

mencoder -idx inputfile.ogv -ovc lavc -oac mp3lame -o outputfile.avi

Note you can add more options for re-sizing, resolution changes etc...  but this will create a decent quality avi.
For more information on all the mencoder options, which is part of the mplayer project, follow this link. http://www.mplayerhq.hu

Sunday, June 6, 2010

FFmpeg: Convert AVI file to series of PNG/JPG images

Extracting a movie file frame by frame and create images (png, jpg) of it. You can set the the frame rate, on how frequent you want an image extracted. Example, if you want to extract 1 image per sec, your rate is 1, if you want to extract every frame of the movie, your frame rate = frame rate of movie.
This technique is used to do a loss-less video editing in tools as Blender, were you can import a sequence of images. This procedure can be very time consuming for long video's, but the quality after editing rewards you for it.
Lets say you do a screen-capture, on a canvas of 1024x768, and created an AVI file with a frame rate of 15 frames per second. (typical for screen casts) you want every frame to be written out as an png-image file, where the numbering is expected to run up to 5 digits. (%05d - option will allow for numbers 5 digits long, padded with zero's)
The command line to do this would look as follows:

Wednesday, November 18, 2009

MOV to FLV using FFMPEG

Converting a .Mov file to .Flv is strait forward with FFMPEG. Changing canvas and bit rate can be done with simple add-on parameters. Lets say we want to convert a .Mov file with bit rate 7000kb/s and size 320x180 to a .Flv file at a lower bit rate lets say 700kb/s and a different size lets say 464x220. The following command line will do just that.

ffmpeg -i filenamein.mov -acodec copy -vcodec flv -b 700k -s 464x220 filenameout.flv

You will see the following output in your terminal window:

Thursday, October 15, 2009

Creating Thumbnails on Command Line

Image Magick is a great free image processing tool to do batch conversions. Many hosting companies running Linux servers will offer it by default. It will empower your website to create thumbnails and rescale images on the go (given your web-code utilizes it). For a full description click here

In this posting we want to explain how to create thumbnails (one by one or in batch)

Monday, October 5, 2009

Mass-change of Directory/File permissions @ command line.

A Quick note on how to change permissions of a whole directory structure and/or all containing files.

  1. Changing permissions of Files in a directory structure, (starting point is current directory)(Example: set all files to 644)

    Sudo find . -type f -exec chmod 644 {} \;
  2. Changing permissions recursively of all directories from current directory as starting point. (Example: set directories to 755)
    Sudo find . -type d -exec chmod 755 {} \;

Sunday, October 4, 2009

FLV to SWF Using FFMPEG command line

FFmpeg, is probably one of the most versatile converters around, and used in many projects across platforms.

In Ubuntu, For a quick and dirty way to convert FLV files to SWF files I use:

ffmpeg -i input.flv -acodec copy -vcodec copy output.swf

There is also a GUI-version available (cross-platform) @ http://code.google.com/p/winff/