IT Chalk Board & More

IT Experiences, Reviews, Hints & Tricks

Easily enable MP3, MPEG4, AAC, and other restricted encoding in FFmpeg

Thanks to FakeOutDoorsman @ the Ubuntu Community for this posting   Go There ->

A common question is “why doesn’t the repository FFmpeg convert to mp3, aac, mpeg4, etc?”. Ubuntu doesn’t make it very clear to the general user as to why to repo FFmpeg is so limited or how to fix this issue. This is reflected in the number of forum questions relating to this topic.

Why is FFmpeg from the repository so limited?
Legal reasons. Some software is limited due to geographical differences in software patents, legal restrictions on free speech, and restrictions on certain technologies. Ubuntu sidesteps these legal restrictions by not including some restricted packages by default. Users must install these packages on their own. See Restricted Formats Ubuntu Community Documentation and FFmpeg License and Legal Considerations for more details.

How do I fix FFmpeg?
There are several options:

A. Compile FFmpeg yourself
B. Install the “unstripped” libraries from the repository
C. Install the ubuntu-restricted-extras package
D. Install FFmpeg from Medibuntu

A. Compiling FFmpeg yourself (for all Ubuntu versions)
The official FFmpeg answer is to compile it yourself, giving you the power to get what you want with the benefits of the most recent FFmpeg revision. This is an excellent solution and is explained here:

HOWTO: Install and use the latest FFmpeg and x264

However, this isn’t for everyone, especially beginners. Sometimes you want an official package that works right now; with a minimum of fuss. Off to the other options…

B. Installing the “unstripped” libraries from the repository
This is the easiest option for Intrepid and Jaunty users and is not available for prior Ubuntu versions. FFmpeg from the repository does not include many restricted encoders, formats, and codecs including: h261, h263, h263p, aac (libfaac), mp3 (libmp3lame), h264 (libx264), xvid (libxvid), mpeg2video, mpeg4, msmpeg4, msmpeg4v1, and msmpeg4v2. You can fix this by installing the “unstripped” FFmpeg libraries that will enable these restricted encoders. Open up Terminal (Applications -> Accessories -> Terminal) and enter:

Ubuntu Jaunty Jackalope 9.04

Code:
sudo apt-get install ffmpeg libavcodec-unstripped-52

Ubuntu Intrepid Ibex 8.10

Code:
sudo apt-get install ffmpeg libavcodec-unstripped-51

Alternatively, you can search for these packages in the Synaptic Package Manager.

C. Installing the ubuntu-restricted-extras package
Another option for Jaunty and Ibex is to install the ubuntu-restricted-extras package. This is a meta-package, which means that it will install multiple packages including the “unstripped” FFmpeg libraries. This is a sledgehammer approach, especially if you are bandwidth limited, and will install a large amount of other packages that you may not want. To install this package, open up Terminal (Applications -> Accessories -> Terminal) and enter:

Code:
sudo apt-get install ffmpeg ubuntu-restricted-extras

D. Installing FFmpeg from Medibuntu
This option is only available for Ubuntu Hardy Heron 8.04. Medibuntu is a third-party repository that contains packages that are unable to be included in the official Ubuntu repositories. To install FFmpeg from Medibuntu open Terminal (Applications -> Accessories -> Terminal) and run the following:

Code:
sudo wget http://www.medibuntu.org/sources.list.d/`lsb_release -cs`.list --output-document=/etc/apt/sources.list.d/medibuntu.list && sudo apt-get -q update && sudo apt-get --yes -q --allow-unauthenticated install medibuntu-keyring && sudo apt-get -q update

This huge command (adapted from Medibuntu – Community Ubuntu Documentation) will install the repository information to your computer then update and authenticate the new repository. Now install FFmpeg:

Code:
sudo apt-get install ffmpeg

That’s it. Now you have a non-crippled version of FFmpeg.

Example
Here’s an example to encode a mp3 file:

Code:
ffmpeg -i inputfile.mp4 -acodec libmp3lame -ab 128k outputfile.mp3

Undoing Changes Made By This Guide
B. Uninstalling the “unstripped” libraries

Code:
sudo apt-get remove ffmpeg libavcodec-unstripped-5*

C. Uninstalling the ubuntu-restricted-extras package

Code:
sudo apt-get remove ubuntu-restricted-extras

D. Uninstalling FFmpeg and the Medibuntu Repository

Code:
sudo apt-get autoremove ffmpeg medibuntu-keyring && sudo rm /etc/apt/sources.list.d/medibuntu.list && sudo apt-get update

Copy as is on  Sept. 02, 2009 @ the Ubuntu Community, Posted By FakeOutDoorsman

.

September 2, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks | , , , , , | No Comments Yet

AVI to SWF using FFmpeg

AVI container file with Video Codex: mpeg4 & Audio Codex: mp3)

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

Command line (open terminal)

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

Note:

you might have to add extra options to change parameters as frame rate, bit rate, ….)

Example output on screen:

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: –enable-gpl –enable-pp –enable-swscaler –enable-pthreads –enable-libvorbis –enable-libtheora –enable-libogg –enable-libgsm –enable-dc1394 –disable-debug –enable-shared –prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 16 2009 21:16:26, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)

Seems stream 0 codec frame rate differs from container frame rate: 30000.00 (30000/1) -> 29.97 (30000/1001)

Input #0, avi, from ‘input.avi’:
Duration: 00:00:39.7, start: 0.000000, bitrate: 1192 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 520×340, 29.97 fps(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, 128 kb/s

Output #0, swf, to ‘output.swf’:
Stream #0.0: Video: flv, yuv420p, 520×340, q=2-31, 200 kb/s, 29.97 fps(c)
Stream #0.1: Audio: 0×0055, 44100 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 1190 q=31.0 Lsize=    2132kB time=39.7 bitrate= 439.9kbits/s
video:1479kB audio:621kB global headers:0kB muxing overhead 1.568774%

There is also a GUI-version available (cross-platform) @

http://code.google.com/p/winff/

.

September 2, 2009 Posted by M.kojak.S | IT - Related - Linux, Linux Applications | , , , , | No Comments Yet

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/

.

September 2, 2009 Posted by M.kojak.S | IT - Related - Linux, Linux Applications | , , , , | No Comments Yet

Remove XBMC-Live from Ubuntu 8.04/9.04

Prologue:

If you install XBMC-live on your PC, it renders the system to a dedicated media centre. I works, but you might not have wanted that.
I personally find the name choice ‘Live” a little confusing as it usually means a CD that runs as software or O/S without altering the original software on the machine. In this case it meant creating a dedicated machine only to serve as XBMC-media centre.

How do you go back when you don’t see your normal desktop and it seems all messed up with user rights?

The following procedure worked for me to remove XBMC-live from a machine running jaunty (Ubuntu 9.04) were I afterwards installed XBMC for regular pc use successfully.

procedure:

Open terminal screen:

[ctrl + alt + F1]

Log in as a user that has sudo rights (the first installed user account during installation)
Then execute the following:

sudo apt-get remove xbmc xbmc-live xbmc-skin-* xbmc-*

sudo apt-get autoremove

Change your sources list, and remove the 2 lines you’ve added earlier, to installed XBMC, Unless you want to re-install XBMC for PC use later.

sudo nano /etc/apt/sources.list

delete these lines:

deb http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu jaunty main

Optionally: rebuild your list index by:

sudo update-apt-xapian-index

Remove xbmc-live from your /etc/init.d directory

sudo rm /etc/init.d/xbmc-live

Re-install your Gnome Desktop manager

sudo apt-get install gdm

Optionally: Re-install guest sessions

sudo apt-get install gdm-guest-session

Optionally: Re-install fast user switch applet

sudo apt-get install fast-user-switch-applet

Finally: Reboot:

sudo reboot

August 22, 2009 Posted by M.kojak.S | IT - Related - Linux, Linux Applications | , | No Comments Yet

Splash screen disappear while booting and shutdown with Ubuntu 8.04:

Prologue to issue:

After a Hard drive crash, I restored my back-ups  (system and data) to a new drive.  I nicely changed the UUID in the boot loader (Grub) and Fstab. The system was restored and worked. However, during boot / shut-down, the splash screen would disappear and show the whole boot and shutdown sequence. Nothing bad in itself, as there were no errors reported, but not looking nice. I must have forgotten some detail.

Cause:

Different UUID values in /etc/initramfs-tools/conf.d/resume and the real UUID of the swap partition given by “sudo blkid

Procedures:

  1. Change all the UUID in /boot/grub/menu.lst to match the real UUID  (given by:  sudo blkid for the system, swap and home partition)
  2. Change all the UUID in /etc/fstab to match the real UUID  (given by:  sudo blkid for the system, swap and home partition)
  3. Change that the UUID in /etc/initramfs-tools/conf.d/resume to match the real UUID (given by:  sudo blkid for the swap partition)
  4. Run the following: sudo update-initramfs -u
  5. Restart the system

.

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks | , , , | 1 Comment

Archive E-mails in Evolution (Ubuntu 8.04/9.04)

Intro:

One thing I really liked in MS-Outlook, was the Archive option; creating one file with the complete sub-folder structure preserved. Evolution does not yet have this feature, however, you can mimic it, with a very similar result.
I have switched from Outlook to Evolution around July 2008, And we are currently March 2009. So far, I haven’t archived anything, and my daily Back-up starts to take way more time than I’m willing to bare.

Goal:

I want to outline a procedure, that will give me a system very much like the outlook archives. I used to Archive Quarterly.

Procedure:

I Prefer to work in my Virtual Box, to make sure I won’t mess up anything in my real time version. (work off-line.)

  1. Before you start anything, Back-up your real time evolution data.
  2. Create the following Search folders:
  3. - Criteria: Date Received, is before October 1, 2008; All local files: (Search folder 1: 2008_Q3)
    - Criteria: Date Received, is before January 1, 2009, All local files and Date Received, is after October 1, 2008, All local files: (search folder 2: 2008_Q4)
    - Criteria: Date Received, is after January 1, 2008, All local files: (search folder 3: 2009_Q1)

  4. Back-up Evolution again. (file: Evolution_Backup.tar.gz)
  5. Starting Virtual Box – Ubuntu session (you can do it in your real time version too, but I opted to be safe)
  6. Restore previous back-up (file: Evolution_Backup.tar.gz) in the virtual Evolution.
  7. Open Evolution.
  8. Delete all Emails in Search Folder 2 and 3 (also empty trash folder). Manually clean sent-folder for this period, which is easy as it is a long list chronologically anyway
  9. Back-up evolution and call the file “evolution_archive2008_Q3”
  10. Restore the original Back-up (file: Evolution_Backup.tar.gz) Note that this will overwrite everything with original data
  11. Delete all Emails in Search Folder 1 and 3 (also empty trash folder). Manually clean sent-folder again.
  12. Back-up evolution and call the file “evolution_archive2008_Q4”
  13. Transfer your Archive files to your Virtual box share with the host system, and try to restore each of them in your virtual box Evolution. Each time overwriting your data and putting up the original structure, but with only emails form the archive period. See it works ! Nice huh.
  14. Leave Virtual Box and go back to Real time system (host) and open Evolution.
  15. Delete all Emails in Search Folder 1 and 2, (also empty trash folder, and manually clean sent-folder), and you will be left with only your recent email, from January 1 2009 until current.

Once up-to-date, you can simplify the procedure, by Archiving (back-up) on the last day of the Quarter, then clean up the previous quarter at later date, when you feel like it, but before you Archive the next Quarter. (using search folders)
NOTE 1: I would suggest, using your virtual box evolution, to browse any of your archives. This keeps your real-time host clean and issue free.
NOTE 2: In this procedure I have listed a quarterly archive, if you don’t have massive amounts of email, a yearly one will do.

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, Linux Applications | , , | No Comments Yet

Ubuntu 8.04: USB Devices in Guest O/S with Virtual Box

USB Devices in Guest O/S with Virtual Box:

Once Virtual box is installed and working, you might find USB devices not recognized or giving Error about no permission in usbfs …

The Solution for this issue:

Check if the group id for vboxusers: (should have been created as part of installing Vbox.)

$ more /etc/group | grep vboxusers

result: vboxusers:x:124:username (where username is your username)

Edit fstab:

$ sudo nano /etc/fstab

Add the following lines to the fstap file.

# virtualbox group id = 124 (see previous)
none /proc/bus/usb usbfs devgid=124,devmode=664 0 0

mount all fstab devices after changes:

$ sudo mount -a

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks, Linux Applications | , , , | No Comments Yet

Ubuntu 8.04: BlueTooth headset in Skype on Acer Aspire 8920G

Blue Tooth Headset set-up. (for use with Skype)

Normally the installation of Ubuntu should detect the BT-controller.
Turn on the BT receiver/transmitter and you will see if it is detected.
Go in terminal mode:

Test if the BT adapter is working:

$ hciconfig -a
If you get an output with hci0 and manufactures name, the BT adapter is working.

Config BT configuration file:

$ sudo gedit /etc/bluetooth/hcid.conf
Near the top of the file you will see the following:
# HCId options
options {
# Automatically initialize new devices
autoinit yes;
# Security Manager mode
# none – Security manager disabled
# auto – Use local PIN for incoming connections
# user – Always ask user for a PIN
#
security user;

Change the security user line to security auto
A few lines down from this is a section about password:
# Default PIN code for incoming connections
passkey “1234″;
Change the default password “1234” to something else, e.g.: 8372.
This will be the passkey required for other Blue tooth devices to connect to you and it would be insecure to leave it at the default.
SAVE the file and EXIT.

Restart the BT service to activate the changes in the config-file above.

$ sudo /etc/init.d/bluetooth restart

An informational box will appear in your task bar saying:

<hostname>-0  Device has been made discoverable

where <hostname>  is your computer’s name. In my case Aspire9820:
“Aspire8920-0 Device has been made connectable”.

Turn on BT headset , but don’t go into pairing mode, and type the following:

$ hcitool scan

your BT adapter will scan for devices and show your headset. Occasionally it won’t show anything, in which case you can try the scan while having te headset in pairing mode (Your headset probably has been paired with another device, putting it in pairing mode wile scanning again, will make it visual)

The output would look like this:

$ hcitool scan
Scanning …
00:41:2E:AA:CB:C1 PLANTRONICS
$

Take note of the MAC-address, you will need it in next section.

Create a new (hidden) file in your home directory called “. asoundrc”

sudo gedit ~/.asoundrc

Add the following code and add the Substitute the MAC-address with your MAC-address that you gathered as seen earlier.

pcm.bluetooth {
type bluetooth
device 00:41:2E:AA:CB:C1
profile “auto
}

Save and Exit the editor

Loading modules and making pulse audio (default for Skype) aware of the BT device.

$ sudo hciconfig hci0 voice 0×0060
$ sudo modprobe snd_bt_sco
$ sudo modprobe sco

If you would like to load the drivers automatically on each boot, only add the two modprobe lines above to the end of the /etc/modules file (sudo gedit /etc/modules)

$ pactl load-module module-alsa-sink device=bluetooth
$ pactl load-module module-alsa-source device=bluetooth

If you do kernel updates or system updates to sound drivers, you might have to run these last 2 commands again to make your headset work with Skype. (I would suggest to keep them in a file on your desktop and make them executable for higher convenience. Alternatively you could create another hidden file in your home folder, but you might have side effects with it and not recommendable.

NOTE: this procedure is to make your headset work with Skype, not to play your audio. Your BT device is not yet connected to your sound card yet. If you choose to create that functionality you will have to add few more procedures. (not covered in this manual)

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks, Linux Applications | , , , | No Comments Yet

Installing Windows XP/Vista true type fonts in Ubuntu 8.04/9.04 system wide

Installing windows XP/Vista true type fonts in Ubuntu system wide.

First find out in which location Linux has installed the True Type fonts. It is usually at the location ‘/usr/share/fonts/truetype/’ .

But you may also do a search for the same as follows:

# locate .ttf -b

Once you know the path of the fonts directory, move to this directory and create a folder there (it can be any name).

# cd /usr/share/fonts/truetype
# sudo mkdir windowsfonts

Note: You need to be logged in as root while doing this, or on Debian like distro’s use sudo
Next copy all the windows ttf fonts to the windowsfonts directory that was just created.

# sudo cp /sourcefolder/*.ttf /destinationfolder/           (as gathered from above)

Make sure they have a right of 644 .

# sudo chown root.root *.ttf
# sudo  chmod 644 *.ttf

Now run the command mkfontdir while in the windowsfonts directory.

# sudo mkfontdir

Lastly run the command fc-cache to update the cache. (from truetype directory)

# sudo fc-cache -fv

This command will scan the font directories on the system and build font information cache files for applications using fontconfig for their font handling.

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks | , , , | No Comments Yet

Ubuntu 8.04: Screen Brightness Control for Acer Aspire 8920G

Screen brightness control

The FN-key + left and right arrow is used to change screen brightness. By default this doesn’t work.
Here is how to make them work. (Again, I found this code in several help forums and modified it to make it work for my Acer). Make a backup of these files (video_brightnessup.sh and video_brightness_down.sh) so you can put things back the way they were if necessary.

sudo gedit /etc/acpi/video_brightnessup.sh

Copy this text in the file and save:

#!/bin/bash

CURRENT=$(grep “current:” /proc/acpi/video/GFX0/LCD/brightness |awk ‘{print $2}’)
case “$CURRENT” in
100)
echo -n 100 > /proc/acpi/video/GFX0/LCD/brightness;
;;
90)
echo -n 100 > /proc/acpi/video/GFX0/LCD/brightness;
;;
80)
echo -n 90 > /proc/acpi/video/GFX0/LCD/brightness;
;;
70)
echo -n 80 > /proc/acpi/video/GFX0/LCD/brightness;
;;
60)
echo -n 70 > /proc/acpi/video/GFX0/LCD/brightness;
;;
50)
echo -n 60 > /proc/acpi/video/GFX0/LCD/brightness;
;;
40)
echo -n 50 > /proc/acpi/video/GFX0/LCD/brightness;
;;
30)
echo -n 40 > /proc/acpi/video/GFX0/LCD/brightness;
;;
20)
echo -n 30 > /proc/acpi/video/GFX0/LCD/brightness;
;;
10)
echo -n 20 > /proc/acpi/video/GFX0/LCD/brightness;
;;
0)
echo -n 10 > /proc/acpi/video/GFX0/LCD/brightness;
;;
*)
echo -n 100 > /proc/acpi/video/GFX0/LCD/brightness ;
;;
esac

sudo gedit /etc/acpi/video_brightnessdown.sh

Copy this text in the file and save:

#!/bin/bash
CURRENT=$(grep “current:” /proc/acpi/video/GFX0/LCD/brightness |awk ‘{print $2}’)
case “$CURRENT” in
100)
echo -n 90 > /proc/acpi/video/GFX0/LCD/brightness;
;;
90)
echo -n 80 > /proc/acpi/video/GFX0/LCD/brightness;
;;
80)
echo -n 70 > /proc/acpi/video/GFX0/LCD/brightness;
;;
70)
echo -n 60 > /proc/acpi/video/GFX0/LCD/brightness;
;;
60)
echo -n 50 > /proc/acpi/video/GFX0/LCD/brightness;
;;
50)
echo -n 40 > /proc/acpi/video/GFX0/LCD/brightness;
;;
40)
echo -n 30 > /proc/acpi/video/GFX0/LCD/brightness;
;;
30)
echo -n 20 > /proc/acpi/video/GFX0/LCD/brightness;
;;
20)
echo -n 10 > /proc/acpi/video/GFX0/LCD/brightness;
;;
10)
echo -n 0 > /proc/acpi/video/GFX0/LCD/brightness;
;;
0)
echo -n 0 > /proc/acpi/video/GFX0/LCD/brightness;
;;
*)
echo -n 0 > /proc/acpi/video/GFX0/LCD/brightness ;
;;
esac

August 21, 2009 Posted by M.kojak.S | IT - Related - Linux, LINUX O/S Related Hints & Tricks | , | No Comments Yet