Rendering problem with Kdenlive

I really enjoy using the Kdenlive video editor. I think it’s a simple, straight forward, and yet powerful tool.

But just during the last few days, I had troubles for the first time and could not find a solution. When rendering my project, it kept failing with max_analyze_duration 5000000 reached at 5000000. I searched online, the error might be related to the size of the audio (>1h) Still, the project rendered at first, but after the final cut – with lots and lots of cuts – I started getting this error, thus, out of a sudden, I was not able to get my final video file out anymore. Was I threatened to having to do the entire work again or what??

Finally, today I found a solution! Better, a workaround.

I split up the file by adding guides – in my case three, but the number might depend on the project size – and then used the render feature “Guide zone” (at the bottom of the render dialog). So, I rendered three parts and used melt to put them together like this:

melt input*.mp4 -consumer avformat:result.mp4 acodec=aac ab=160k vcodec=libx264 vb=3000k

I’m using x.264 and AAC here – but you can also drop all those parameters and let melt figure everything out – it’s pretty capable, give it a try.

melt input*.mp4 -consumer avformat:result.mp4

If you have ffmpeg on your system, you can merge the files using the copy mode, so no quality gets lost – see details here. But even when using melt and thus re-encoding the video, you will not notice that it has been rendered in three parts and “melted” later. So I’m happy! Still a bit surprising that I could not find a solution online. So hey, hope this approach works for you too! ๐Ÿ™‚

Recover deleted photos

Shit happens… but for Linux users, there is a power tool straight from the US Air Force called "foremost" to help you recover (aka undelete) your photos easily!
Note: you’ll need sudo rights to install this software tool.

But most importantly: do not write any new data to your device (SD card, flash drive or whatever)! Otherwise, you’ll overwrite what is still there and lose your photos forever.

The steps:
Remove or unplug the media/drive/card from your comupter.
Open a terminal window.

Install the recovery software.

sudo apt-get install foremost

Create a folder to put the recovered photos in. Important: don’t put this forler on the drive where you want to recover photos from! See above…

mkdir recovered-photos && cd recovered-photos

Find the device: copy the following command to your terminal and press the [Tab] key twice

foremost -v -t jpg /dev/sd

It will say something like this

sda   sda1  sda2  sda3  sda4  sda5  sda6  sdb

Now, plug in your drive/card/medium and press [Tab] again, twice.
It should change to something like this

sda   sda1  sda2  sda3  sda4  sda5  sda6  sdb  sdc  sdc1

In my case sdc and scd1 showed up. Thus, sdc1 is the partition on the device to recover from. Thus, I my case the full command would be (You need to replace sdc1 with whatever showed up previously on your own terminal!)

foremost -v -t jpg /dev/sdc1

… press return and see the magic happen! Your photos will show up in a subfolder of recovered-photos. ๐Ÿ™‚

Setting up a linux server to forward all incoming mails

Typical thing when having a new site up: you want to get whatever@yourdomain.com to end up in you normal inbox, say Gmail.

Here are the steps!
Note: If you are logged in as root, you do not need to use “sudo” in front of each command.

Preparations

It’s recommended to have a user account to receive the mail other than root.
So either choose a user you have created already or create a new one:

sudo adduser [username]

Does your provider require you to use an SMTP relay? (check the documentation, or ask). You need to know this to continue.

Install postfix

Postfix is a software package, a MTA, it handles incoming mail and forwarding.

sudo apt-get install postfix

And answer all configuration questions as below:
Server configuration type: If you use an SMTP relay, choose “Internet with smarthost”, otherwise “Internet”
System mail name: [yourdomain.com] (no subdomain)
SMTP relay host: [smtp.yourprivider.com] (only showing if you chose “Internet with smarthost”)
Root and postmaster mail recipient: The created/chosen before (not root)
Other destinations to accept mail for: keep the suggested defaults and add in front [yourdomain.com] and a space
Force synchronous updates on mail queue: no
Local networks: keep suggested
Use procmail for local delivery?: yes
Mailbox size limit: 0
Local address extension character: +
Internet protocols to use: all

Manual configuration

All edits with sudo if you not logged in as root.
Edit /etc/postfix/main.cf add following two lines to the end

virtual_alias_domains = [yourdomain.com]
virtual_alias_maps = hash:/etc/postfix/virtual

Create/edit /etc/postfix/virtual and add

@[yourdomain.com]    [your.email.address@somewhere.com]

Finally, after editing this file call

sudo postmap /etc/postfix/virtual

so that postmap actually applies your changes.

Notes

If you forward to Gmail, do not use the same address to send test mails that the mails will be forwarded to – Gmail will silently ignore/delete mail where the sender and recipient are the same and you will think the forwarding does not work.

Scale images for the web — quickly

Starting Gimp just to scale down some photos to send them by mail? Meh.
How about mark them, right-click, "Send To" -> "Scale for web"?
No problemo:
First, get a tool to scale images:

sudo apt-get install imagemagick

Now, create a script that takes a list of images as input, scales them down, and stores them with a prefixed file name. Go!

#!/bin/bash
pwd > ~/f0.txt
echo "$@" > ~/f1.txt
for file in $@
do
	convert "$file" -quality 50 -resize 1024x768 "${file%/*}/web-${file##*/}"
done

Make sure we chmod +x the script file we just created.
Next, let’s integrate it into "Send To". (This is an example for Thunar)
Create a .desktop file in the sendto folder, e.g. /usr/share/Thunar/sendto/scale-for-web.desktop with following content:

# Scale images for the web
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
TryExec=scale-for-web
Exec=scale-for-web %F
Icon=
Name=Scale for the web
MimeType=image/jpeg;image/jpg;image/png

Replace both scale-for-web with the name you gave to your script file. Is the script’s folder in $PATH? No idea? Then just put the entire path+filename.
Now, open Thunar, select some images (Jpeg or Png), right-click, "Send To" -> "Scale for the web", wait a few seconds and you’ll see web-....jpg files appearing in the same folder. ๐Ÿ™‚

References: how to scale images with imageMagick, extract path segments, more details on string manipulation

Missing Digikam Themes w/t KDE

Digikam is a great tool to manage and work on photos — my personal favorite for some years already. But it’s made for KDE and uses a lot of KDE-related libs and stuff, therefore, installing it in Gnome, Xfce, Lxde and the like will cost about 1gb because of the depenedencies.
Nevertheless, worth it. But it comes with a bright default skin rendering it completely unusable for working seriously on light and color settings of photos.

To add themes, you will have to install an extra package (as decribed here) like this:
sudo apt-get install kde-workspace-data
Yes, this will add more data to your disk, but only 10mb this time. ๐Ÿ˜‰

Happy photo-tweaking!

Flickering Screen with ATI Radeon X1400 and Ubuntu

EDIT: ATI Radeon X1400 seems to work fine again since Ubuntu 11.04.

There is another fix to the “well known” issues with the ATI Radeon X1400 and Ubuntu 10.04 to 10.10 besides the one posted about one year ago (see here).
The previous fix kept the graphics card working normally but harmed the overall operating system’s stability, so here is another fix based on disabling all 3D features of the device to get rid of the flickering screen.

It’s up to you to choose what you are able to live without
a) The desktop settings panel and “Segmentation fault” errors now and then, or
b) 3D acceleration (does not harm video playback or any other basic OS functionalities)

For solution a) see this.
For b) create this file: /etc/modprobe.d/radeon-kms.conf — and add following content

options radeon modeset=0

Solution found here (in German).

Logitech Communicator STX Webcam vs. Ubuntu (64bit) & Skype 2.1

There are many tutorials out there solving the problem by making Skype use Video for Linux version 1 drivers instead of version 2, as that particular webcam does not seem to get along with the newer version. It boils down to the following lines:

Create a file in /usr/local/bin/skype and insert

#!/bin/bash
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype

Finally, make it executable by sudo chmod a+x /usr/local/bin/skype
Use this file to start Skype from now on. Done.

But not for me. Skype refused to eat it: ERROR: ld.so: object '/usr/lib/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
Until I finally found this one here.

Just to cut a long story short, here is why: all the other solutions work for 32bit Linux only — but hey, I do not have any of my old laptop’s potential to be wasted — I am running 64bit Ubuntu (tested with version 9.10 and 10.10 64bit). And with a minor tweak, the fix will work for you, too. ๐Ÿ™‚

Install the video4linux libraries:

 sudo apt-get install lib32v4l-0

And change /usr/local/bin/skype to

LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so /usr/bin/skype

Its just about the “32” — and one good example more of why you should put meaningful error messages in whatever software!

Thanks Eoin Murphy.

Resizing System or Home Partion

A very convenient tool for creating, moving, and resizing partitions is GParted. I use it for all my partition-changing-needsย โ€” it is really powerful and yet easy to use! ๐Ÿ™‚

But it is not possible to resize system relevant partitions while the system is running โ€” makes sense, right? ๐Ÿ˜‰

But you can download GParted as LiveCD ISO file and burn it on a CD. After that, restart your computer with the CD in your drive and a small linux will start up directly from CD including GParted, thus allowing you to modify any drive and partition there is. ๐Ÿ™‚ Do all required changes, click the exit button and you are done. In my case, the computer did not reboot automatically, instead I ended up with a command line interface โ€” use the command “sudo reboot” to restart the system yourself if that happens.

And just by the way, GParted does also handle Windows partitions easily โ€” so there is no need to buy or “get” Partition Magic from somewhere. But never forget to backup your data first.

Yet another hint: GParted works most reliable if you do one step at a time. So for example, there are partitions A and B (A is in front of B) and you wish to give some of the free space in A to B. You need to do following steps: Shrink A, move B left and finally grow B. From my experience, GParted works best if you really do all those steps separately, apply each of then, and go for the next one if the last one finished successfully.

Flickering Screen After Upgrade to Kubuntu 10.04

First of all, I was amazed how smoothly the upgrade went. (K)Ubuntu and I guess other distributions as well have gone quite a far way to become platforms for everybodyย โ€” with a lot of software but even more tools, helpers and automatic background servicesย โ€” like the nice upgrade service.

There was only one problem I ran into and I want to share the solution.

I am running Kubuntu 10.04 (just upgraded today) on a Lenovo IBM ThinkPad R60 (Yes, one of those with both brands on them ;)) with an ATI Radeon X1400 graphics device. But since upgraded, my display started flickering โ€” not permanently but unbearable.

The solution that worked for me (at least partially โ€” see below โ€” and this is of cause depending on the graphics device type) was to install the proprietary ATI drivers. I know, it is not a good solution, I do not like to use them neither and if anyone out there is reading this with a better solution in mind, let me know it!! ๐Ÿ™‚
Edit 2011-02-14: Added a new post with an additional, alternative solution here.

So what you need to do isย  to get your favorite package management tool (e.g. Synaptic or KPackageKit) โ€” just hit Alt+F2 and type “package” and pick KPackageKit from the list (it will ask you for the super user password). Then, search for “fglrx”. In KPackageKit, you will find a result titled “Video driver for the ATI graphics accelerator”, and something below the title like “fglrx – 2:8.723.1-0ubuntu3” but the version number should not matter. Click the arrow to the right, hit “Apply” and after rebooting, everything should perfectly without any configuration.

Good luck. ๐Ÿ˜‰

Problems noticed so far: The driver causes “Segmentation Fault” error messages, e.g. when trying to open up the display settings. That’s ugly, I know. But you can read in several forum and blog posts, that the support for the former nicely working driver for the ATI X1400 has been discontinued since 10.04, hence, it’s just good luck that the fglrx works somehow โ€” good to know *after* upgrading, right. But still, the flickering was unbearable for me, thus, I accept the issues for now. I will keep my eyes peeled hoping for a proper solution in the future.

Change hotkey of Kubuntu’s Quick Launch Tool KRunner

First of all: I love those quick launch tools aka keystroke launchers, they are real time savers โ€” everyone should have one!

[For those without a glue what a keystroke launcher is:] It is THE tool for launching any kind of software or even opening documents. Instead of moving your mouse to you applications menu, click it, search the program, move the mouse there, maybe pick a sub-folder, move mouse again and finally click โ€” unless you accidentally moved a little but to far and the menu close again, completely. ๐Ÿ™ But it is easy to put an end to this (as described below). Instead of doing all that clicking, you hit a special key combination, by default [Alt] and [Space], this will make a small input box show up, now, you only enter the first letters of the programย โ€” e.g. “f” will do after a few uses to start Firefox (the program learned that you use it a lot). It might save only a few seconds each time, but the sum up and, hey, it is very convenient, too!

So here is what you need to do:
Mac OS: It is already built-in โ€” Just hit Alt+Space and type the name of the program you want to start (or files or whatever).
Windows: Get/install Launchy and use it as explained above.
Kubuntu: built-in as well, BUUUT you have to hit Alt+F2 instead.

And there it is, something that kept annoying me about Kubuntu for quite a bit. I was hoping to get used to it but for what reason? Alt+F2 is really not handy compared to Alt+Space.
Finally, based on this old forum post and a few adjustments to fit nowadays Kubuntu, all you need to do is this:

  1. Go to “Settings” -> “Keyboard and mouse”
  2. Select “Global Keyboard Shortcuts”
  3. Pick from the select box “KDE component” at the top “Run Command Interface”
  4. Now, you can access “Run Command” โ€” Change it to whatever you like ๐Ÿ™‚