An easy way to enable VNC in Ubuntu 14.04

i’ve struggled today for a few hours to get XDMCP connections running on my new tv server. in the end i posted on a few forums and gave up. a bit frustrating!

but i still didn’t want to leave my seat without having any ability to log into my server without gui, so i opted for a simple vnc server solution:

  1. you need to have the gnome-session-flashback package installed through apt-get
  2. you need to log into at least one session that is a gnome (fallback) one.
  3. go to applications > system tools > preferences > desktop sharing
and that solves the problem. you must have at least one desktop session running, logged into Gnome-flashback and this user must have the connection allowed.

Installing Office 2007 on Ubuntu

This evening I thought I finally give installing Office 2007 another go. Not that I don’t like OpenOffice, but I often deal with files that have more than 65k lines…

I am no fan of Microsoft, but I must admit that the Office suite was always great. Probably that’s why it’s the only non native software that’s made it to the Mac…
I also got quite used to using the ribbon and it’s visually very pretty to work with MS.

So, I read that you should use an older wine version, namely 1.1.14, but I also read on the wine site that everything above 1.1.3 should also be suitable, so I will get the latest wine version Synaptic can find (which is 1.1.38). I will also install wine-gecko and I know we will need cabextract… The package manager thinks it’s wise to install a few other packages to, so here we go!

Good news: so far so good..
it starts the installation and asks for product key…
off to choose the programmes…
and the installation proceeds… (the installation is anything but quick…)

For the next step we need winetricks:
Get it by:

sudo wget www.kegel.com/wine/winetricks

So now we should be able to install a few windows repositories:

sh winetricks corefonts tahoma vcrun2005sp1 wsh56js

This will ask you a few time if it’s OK to install certain things and once completed, you need to configure wine:

winecfg

Find the libaries tab and add to new overrides:
riched20 & usp10
both will need the ‘Native (Windows)’ button ticked.

And off we go!
It installed in fine and it runs fine. Here is a screenshot:

Video splitting with MEncoder

So now the question is how can you use MPlayer’s Mencoder to split a video file into chunks, or how can you just cut a scene out?

I haven’t really found an option to just cut it out in one go, but MEncoder is so fast, it’s easy to just cut twice, first the beginning:

mencoder -ss 00:13:11 -oac copy -ovc copy original.avi -o new.avi

Simply exchange the time (HH:MM:SS) with the ‘begin’ point of the new video. That copies all the rest of the file into a new one.
Now you need to trim the file to get the new end:

mencoder -endpos 00:01:11 -ovc copy -oac copy in.avi -o out.avi

This makes the file exactly 1 minute 11 seconds long.

With this method you can split any video in any number of smaller chunks.
Happy video sharing!

PS: I think I already showed how you can combine to videos, in case you wanna reverse the process, if not, I will post this soon.

Quake Live now for Linux

I have been playing ID software’s ego shooter since the years of Doom. Back then I wasn’t really ‘hooked’ and found ego shooter a rather dull waste of time.

Although, I did went on playing Doom 2 and it’s franchise, but again for lack of something better to do.

When I first saw Quake with it’s very pixelated graphics, I immediately disliked it. It wasn’t until me and my friends started patching computers into a network, using Coax cables at the time, that I learned that mouseaim and strafing opened a new dimension to Doom legacy…
When I then saw the game in GL mode, I realised the potential the game had… Shadows and pixel free animation was such a great improvement to the game.


Shortly afterwards I got hooked. I played all the expansions, with my favourite one being Painkiller, a multiplayer only mod. It featured the can of beans (gave you 100 HP, but made you fart), the bear trap and the gravity orb. It was good fun and we had lots of laughs when we were playing it some years ago. I even played Alien Quake, which was so dark and scary, it made me jump everytime I saw (or could hear) and enemy.


I played SO much that I was by far the best in my league of friends. I started playing online, even went to a few tournaments and bigger events.

Then came the long awaited Quake 2 in 1997.

It was different. A lot different. Apart from my usual problem of not having a high end machine to play the game, it was also a lot slower then Quake. The rocket launcher was not as strong anymore, the
jumps didn’t seem to be as powerful (although I found out that they were better than in Quake, but way too late) and noone really wanted to spend much time playing it.
Needless to say, I finished my way through the story mode and then never played it again. I saw people playing it on LAN parties, but I stuck to good old Quake or played Blobby :)…

Two years later, in 1999, ID software released the best ego shooter the world has seen to this day: Quake 3 Arena.


But at the time it was out and new and people were playing it religiously, I didn’t have a computer that was able to support that game. In later years, when it was still ‘in’, my computer was good enough to play it and I developed some half way decent skills. I played with friends till the early dawn, went out and played on LAN party tournaments and even got into moderate ranks from time to time.


But I couldn’t play online (because T-Online didn’t have a proper ping). The usual mods came out, within them a few really good one: Challenge Pro Mode Arena, another Painkiller and the engine was used in pretty much any ego-shooter you could think of.
In the meantime, Quake 3 developed into somewhat of a religion. Even girls were starting to play Quake 3! But it got worse: people weren’t afraid anymore to admit to being excessive gamers, in fact some even painted to logo on their skin:

(but there were also pretty ones)

A few years later and I had a very decent Quake 3 able machine, but guess what: nobody played anymore :(… I found a few people to give me a game on rare occasions, but these poor guys had no Quake experience and lost constantly, even when I tried to let them win. I had moved countries twice and playing with the old team was nearly impossible.

Eventually I migrated to Linux and by that time discovered OpenArena, which was good fun and had a nice community, but that community was small and you often couldn’t get games going. Still, I was very fond of the usual playmates 🙂

In my frustration I tried Quake 4, a title I actually bought – don’t ask me why…


Until I heated rumors about Quake Live: Quake 3 but browser based! How cool was that idea? I got my beta account fairly quickly and even installed Windoze to play it, but eventually gave up on the dual boot, as I never started Windows. Now, another 7 month down the line, there is a Linux native Firefox plugin for Quake Live. My prayers to the ID software god have been heard!


I haven’t been playing all that much, as i hardly have time for it. It’s still a great game and it’s always good to play it with some familiar faces…
I hope you will join me online for some frags soon. Play the best ego shooter in your bowser: Quake Live! If you want to connect with me, my in-game name is: d3ngar (surprise!).

UVC webcam upside down image

I have a laptop with a buld-in webcam. This would normally be all well and good, but the damn thing has a problem with the picture being upside down…

If you have the same problem, here is the solution:

  1. Download the new uvcvideo from here and extract it.
  2. Extract the file (tar xjvf uvcvideo.tar.bz2)
  3. Get one of the patches: 1_mirrored, 1_notMirrored, 2_mirrored, 2_notMirrored (courtesy of arjos85)
  4. Save the patch in the folder ~/linux/drivers/media/video/uvc/uvc_video.c (~ is the path to the just downloaded and extracted driver)
  5. Then run: patch -p0 < [your_patch]
  6. Now build the module: make && make install
  7. load it with: modprobe uvcvideo

Now everything should be working correctly. Try it with Skype or Cheese!

Let me know if there were any problems…

How to re-encode videos using MPlayer

Hi,

It often happens to me that I get sent a video and it turns out to be unnecessarily huge. I think nowadays people record videos with a digital camera or an older camcorder – but this isn’t really important…

If you use Windoze, there are probably hundreds of programmes that you could use to re-encode videos, provided you pay a license fee or steal the software. Linux however this comes free for all of us and it’s fairly easy to do from the trusty shell (console, prompt…). In addition you will find that you can change aspect ratio, frame rates and do other processing functions easily using MPlayer. In addition, MPlayer crosscodes nearly all media files, certainly most I have ever come across…

The prerequisit is that you get MPlayer and their codec-pack installed. You can find that here: http://www.mplayerhq.hu/. If you use ubuntu, you should be able to do something like:

sudo apt-get MPlayer

to install the player using the package manager.

Let me know if there is need for more detailed instructions on how to install MPlayer…

There are different codecs for re-encoding for both audio and video. It’s also not always possible to convert the audio part of a file into something much better – and why would you, it’s not going to sound better!

Next, we need the massive video file that we’d like to shrink. Simply navigate to the folder it is in. To encode with standard settings, using the liblav codec (for DivX), try this command:

mencoder -ovc lavc inputFile -oac mp3lame -o outputFile

This will re-encode the file, but this mightn’t be using the best settings for your needs, so I’m going to intruduce a few more features:

Need to fix a broken index in your video file:

mencoder -idx input.avi -ovc copy -oac copy -o output.avi

Want to merge a few media files? This is for you (be sure that they are the same format etc…):

cat 1.avi 2.avi | mencoder -noidx -ovc copy -oac copy -o output.avi

Here’s a simple command that converts an MPG file to AVI format:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc

-ovc and -oac represent the options for the video and audio codecs that mencoder will use. To find out what video codecs are installed on your system, use mencoder -ovc help and mencoder -oac help.

Suppose you need a file with no compression on the audio part and decide to use PCM. You can specify the type of audio codec you want by using the acodec option:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=pcm

When it comes to MP3 compression, you can also choose a bitrate using abitrate:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=libmp3lame:abitrate=128

You can use lameopts if you have libmp3lame installed and want to add extra options to the encoding process. You can also create files with variable bit rate audio compression:

mencoder file -o file.avi -ovc lavc -oac mp3lame -lameopts vbr=2:q=3

where q can be any number between 0 and 9.

You can do the same thing with the video part of the file:

mencoder file.mpg -o file.avi -ovc lavc -oac lavc -lavcopts acodec=libmp3lame:abitrate=128 vcodec=xvid

If you don’t want to use video compression, try vcodec=copy. With that option, the frames will be copied one by one from the source file.

You can use xvid or divx directly, without going through lavc:

mencoder -ovc xvid -oac mp3lame -o destination.avi source.avi

If you need customized quality, you can add a few options to the XviD compression:

mencoder -ovc xvid -oac mp3lame -xvidencopts bitrate=878 -o destination.avi source.avi

The higher the bitrate, the better quality the video file will be. The downside is a larger file size.

Now let’s get fancy and make an XviD copy of a DVD using two passes. During the first pass, mencoder analyzes the content of the file; on the second pass mencoder encodes the new file based on the information obtained. By using two passes you can produce a better compressed file, but you’ll have to wait a little longer for it, and you’ll probably see CPU usage at 90% during the conversion:

mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=1 -o /dev/null

mencoder dvd:// -oac mp3lame -ovc xvid -xvidencopts pass=2:bitrate=800 -o xvidfile.avi

You can use whatever bitrate option you want. If you need to squeeze a DVD into a 700MB XviD file, you could use the following command, which forces the file size of the resulting AVI to 700MB.:

mencoder dvd:// -ovc xvid -oac mp3lame -xvidencopts bitrate=-700000 -o file.avi

If you don’t like the CPU being used to the max and want to leave resources for launching other applications, use the nice option, which will run the program with the lowest priority when it comes to process scheduling:

nice -n 19 mencoder dvd:// -ovc xvid -oac mp3lame -xvidencopts bitrate=-700000 -o file.avi

Suppose you have a folder full of small video files of different types and would like to merge them into one big movie for easy watching. First, rename them so that they’re in the order you want them to appear in the final video, then use:

mencoder * -o output.avi

If you want to add a particular audio file to a movie, use:

mencoder source.avi -o destination.avi -ovc copy -oac mp3lame -audiofile file.wav (for uncompressed files)

mencoder source.avi -o destination.avi -ovc copy -oac copy -audiofile file.mp3 (for compressed files)

To convert a video file to run on a device running iPodLinux, use:

mencoder -ovc raw -ofps 15 -oac pcm -vf scale=176:-2,expand=176:132,format=bgr16 input.file -o output.avi

This produces a RAW AVI file with uncompressed audio data and scales it so it fits the Nano’s tiny screen perfectly.

I have a Pocket PC that I sometimes bring with me on business trips. I take a couple of movies I haven’t seen in a while and convert them to fit on a 512MB SD card:

mencoder -oac mp3lame -lameopts mode=3:preset=24 -ovc lavc -lavcopts vcodec=mpeg4:vhq:vbitrate=384:keyint=250 -vop expand=”320:240″ -o outputfile.avi inputfile.avi

or

mencoder input.avi -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=200:abitrate=48 -vop scale=320:240 -oac copy -o output.avi

The difference here is that the latter command scales the file and the former fills the PDA’s 320×240-pixel screen with the movie.

If you have a webcam and want to record the output, use:

mencoder tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:forceaudio -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:acodec=mp3 -ffourcc divx -o test.avi

The command records anything output by /dev/video0 in 640×480 resolution, using DivX with MP3 audio as an output result.

As you can see, you can use mencoder to convert almost any type of video file in several ways. It works fast, it works well, and I wouldn’t change it for any other application, be it GUI-friendly or not.

Kindest Regards to Kivilcim Hindistan – from whom I ripped some parts of this tutorial…

How to change the mouse polling rate in Ubuntu

Changing the mouse polling?

Special Thanks to: Cesare Tirabassi and everyone contributing in this thread

Beginner Tip: You must use sudo when editing these files.
Such as:

Code:
 gksudo gedit /etc/modules

Blackmagic’s solution:
Edit /etc/modules

Code:
gksudo gedit /etc/modules

Add these two lines onto the end:

Code:
-r usbhid
usbhid mousepoll=2

reboot.

Alternate solution that may work on Feisty (try the first one first):
Add

Code:
options usbhid mousepoll=2

on its own line at the end of /etc/modprobe.d/options

and then add

Code:
usbhid

on the end of /etc/modules
reboot

Alternate solution that may work on Edgy:
Add

Code:
options usbhid mousepoll=2

to /etc/modprobe.d/usbhid

and then add

Code:
usbhid

on its own line at the end of /etc/modules
reboot

aidanr’s alternate feisty solution
Create a file at /usr/local/bin/mymousesettings with the following inside:

Code:
#!/bin/bash
rmmod usbhid && modprobe usbhid mousepoll=2

or if you want to use lomoco (a program for changing the resolution on Logitech mice) you can use this instead:
(G5 and G7 mice don’t need lomoco because they are software-independant)
{
Install:

Code:
sudo apt-get install lomoco

lomoco’s Homepage: http://lomoco.linux-gamers.net/

Code:
#!/bin/bash
# -4 for 400 cpi, -8 for 800 cpi, -m for 1200 cpi, -h for 1600 cpi, -g for 2000 cpi
lomoco -h && rmmod usbhid && modprobe usbhid mousepoll=2

}

After doing either method enter the command

Code:
sudo visudo

and replace the line that says

Code:
%admin ALL=(ALL) ALL

with

Code:
%admin ALL=(ALL) ALL, NOPASSWD:/usr/local/bin/mymousesettings

Use Control + O and then hit enter to save and then use Control + X to exit.

Add that command to startup in System –> Preferences –> Sessions by clicking add and then adding

Code:
sudo sh /usr/local/bin/mymousesettings

as a new entry.
reboot

hanging the mouse polling?


Fixed it with the help of the Gentoo guide:
http://gentoo-wiki.com/TIP_Change_mouse_hz

I added

Code:
options usbhid mousepoll=2

to /etc/modprobe.d/usbhid
(using “sudo nano”)

and then I added

Code:
usbhid

on the end of /etc/modules

=)

Code:
$ cat /sys/module/usbhid/parameters/mousepoll
2


Here are all the mouse polls:

1 = 1000Hz
2 = 500Hz
4 = 250Hz
8 = 125Hz
10 = 100Hz (Default)

Fix the upside down on uvc webcams

Hi everybody,
it’s a very quick how-to that will help you to solve the problem of those webcams who give back upside-down images/videos!!!
This help is intended only for those who have a UVC capable webcam.
But it will be usefull only if your webcam supports YUV image format and the applications that use your webcam request YUV format to your webcam!!! I’ve tested it and it works with:
skype, amsn, kopete, luvcview, mplayer!!

So…let’s start!!!!

In order to know if your webcam is UVC capable you just need to open your shell and run:

Code:
lsusb


you will get something like this:

Quote:
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 002: ID xxxx:yyyy “Your_Webcam_Model”
Bus 001 Device 001: ID 0000:0000

Then type:

Code:
sudo lsusb -d xxxx:yyyy -v | grep "14 Video"


If you get something like the following, your webcam is UVC capable:

Quote:
bFunctionClass 14 Video
bInterfaceClass 14 Video
bInterfaceClass 14 Video
bInterfaceClass 14 Video


If your webcam passes this test, you can go on reading. Otherwise, your camera needs to use propertary driver, because it doesn’t use standard protocol/command.

Well,
now you need to donwload the UVCVIDEO driver sources, but they are on a SVN repository, so you need to install the SVN client:

Code:
sudo apt-get install subversion

and now you can download the sources:

Code:
svn checkout svn://svn.berlios.de/linux-uvc/linux-uvc/trunk


The sources will be saved into a folder called “Trunk” in the path from where you run the previous command.

Next, you need to use a patch to update your clean uvcvideo driver. Please download this.

Then proceed..

Code:
patch < patch_solution1_mirrored.patch

Well, now the worst part has been done!!!
We just need to compile our modded file and to install the new driver, so from shell you have to go to the "Trunk" directory and type:

Code:
make

there shouldn't be errors!!

Then, ONLY if you are using one of the Ubuntu distributions (ubuntu, kubuntu, etc.), open with you editor the "Makefile" and change the following line:

Code:
INSTALL_MOD_DIR := usb/media

with

Code:
INSTALL_MOD_DIR := ubuntu/media/usbvideo

Now we just need to remove uvcvideo module (if you have previously installed it):

Code:
sudo modprobe -r uvcvideo

Then:

Code:
sudo make install
sudo modprobe uvcvideo

Now everything should work!!!

Let me know!!