Tuesday, April 4, 2017

Enhanced Slideshow with Kdenlive

My aim was to create highly visual slideshow videos with typical visual effects such as zooming, panning, and rotation. While there are some tools for automatically creating such slideshows, I wanted better control. Random panning and zooming was out of the question, as images typically have specific focal points and axes that you want to follow meaningfully. Also, I wanted smooth slide transitions and proper image captions. Then, add an intro screen and some music.

The final video is available in Youtube:

Title Screen


While animations and logos would have been nice, creating them was out of scope of this video project. I didn't want to spend too much time with the title screen, so I went with simple text with the Noto font. I colored some labels and added a gradient bar behind the main title. I wanted something moving in the screen, and settled for a panning background image. I dimmed it a bit to bring the text out better.

I wanted something moving in the screen, and settled for a panning background image. I dimmed it a bit to bring the text out better.

Images

The images are arranged in two or three video bands, so that each overlaps for two seconds with the previous and next image with a cross-fade effect.

In the following is the sequence for adding an image:
  1. Put the image to an image folder. I preferred to put all the images under the Kdenlive project folder, so that they would not be lost if I relocate the originals. I renamed the files so that the have Author_date-title, so that I have all the information needed for the image captions.
  2. Add the image clip to the Project Bin, under a slide group folder. I grouped the images by author.

    (Note that in this screenshot I already have the caption screens created later.)
  3. Duplicate and rename a title clip. My title clips have name of the object in the middle, date on the left, and author on the right, all aligned to bottom of the screen. As they have three fields, I could not use templates, but had to duplicate any older title clip. Rename it after the image file, removing the ".JPG" suffix.
  4. Edit the title clip. (When the editor opens, it's a bit annoying that I always have to select "Show Background".) Edit the three fields according to the image name. After editing, some realignment may be necessary.

    I used the Noto font with 50 px high image caption in the middle and 40 px high date and author name labels. I grayed the latter ones a bit.
  5. Find a suitable place for the image.
  6. Make space in the timeline by using the "M" key tool. If you need to insert an image afterwards, you need then space for them. I used 12-second clips with 2 seconds of overlay with both previous and the following image. Add some extra space, as can always remove it later. Go back to Select mode (key "S").
  7. Drag the image clip to the timeline, on an alternating band. Notice that above we used two alternating bands for cross-fading clips. Inserting a clip in the middle messes up with the alternation, unless we either add another clip OR add a fourth video band and move the clip there.
  8. If necessary, rescale its length by double-clicking it and set the length. My default for clips was 10 seconds, so I had to manually resize to 12 seconds.
  9. Add a crossfade effect of proper length to the end of the clip. I use 2 second crossfades. It's easiest to copy-paste one from another clip (Ctrl+C, Ctrl+V, and drag to place), as that also keeps the length correct. It should be "Reverse" if going down in the video stack and non-reverse if going up.

    (Crossfade is "Häivytä" in Finnish)
  10. Move the rest of the slideshow to correct position with M-mode. Now that the ending crossfade is in place, you can snap the next video clip to the beginning of the crossfade.
  11. If using three video bands, move the crossfade to the upper video clip.
  12. Drag the title clip to the top band. Snap it at the end of the beginning crossfade.
  13. Resize if necessary by dragging the end of the clip or by double-clicking the clip. My default for text clips is 8 seconds, so they get the correct length when you drag them to the timeline.
  14. Copy a fade effect from another title clip with Ctrl+C, Ctrl+V, and drag. I use a keyframed Affine effect for text fade-in-and-out. I have keyframes at 0:00, 2:00, 6:00, and 8:00 seconds, with respectively 0%, 100%, 100%, and 0% opacity.
  15. Add a keyframed Position and Zoom effect to the image clip. I have this and the Three-point-balance as a custom effect, so I just right-click the image and add the effect. The parameters need to be customized for each video clip.
  16. Customize the Position and Zoom effect. The keyframed start and end positions are different for almost every image, as is the initial and final zoom level. It takes some time and artistic effort to get them right.

    • Typically, if the image is square, you start with 140% zoom to make it fill the screen horizontally, and end with maybe 160% zoom or more.
    • Configure the position so that it zooms towards a meaningful focal point or simply pans up or down.
    • More zoom makes it quicker and more restless. Following similar images should have matching zoom speeds.
    • You can also start with bigger area than the size of the image. In that case, it is necessary to set the effect background color to black with non-transparent opacity (255), or otherwise blended layers such as image titles will have trouble.
    • While editing, because we're using cross-fade for transitions, you need to disable the other video band(s) to be able to see the ends of the currently edited clip.
    • Most of my tweaking effort went to this effect, because it's really hard to get right. Especially it's a big effort to match zoom levels and exact positions in multiple images. The solar eclipse sequence was really tough to edit!
  17. Configure Three-point-balance. I often use this to change the contrast, but if it's OK, just leave it as is.
  18. Optionally, add a keyframed Rotate effect. Typically, rotate from 0 to 250 (25 degrees) or something like that.
  19. Test render a range around the clip.
  20. Fix issues.
  21. Tweak until you drop.

It takes around 15-30 minutes to add a picture, which makes the creation of a big gallery rather a lot of work. Working with batches, you can handle a lot of videos at once, such as when you add effects to them. It's just very important that you decide the times and transitions in advance. I believe the effects given here is are a good basic choice.

Definitely the biggest job was tweaking the zoom effects. Especially, if you look at the solar eclipse sequence, it required very exact matching of the image positions and zoom levels. Tweaking the parameters was rather difficult and they still don't match exactly in the final, but I considered it good enough.

Music


For music, I first tried the Free Music Archive. However, much of the music was for non-commercial use only. That was OK for my purposes, but the effect was also that when I added my video to Youtube, all possible ad income was directed to the musician. That didn't seem quite fair, considering that there was me and others who made the video and its contents. While there was some more free music in Free Music Archive, I noticed that the Youtube Audio Library had a somewhat better selection.

There was very little editing involved with the music. The piece was a bit longer than what I needed, so I truncated it and silenced the end.

Monday, March 13, 2017

Installing Kubuntu 16.04 on ThinkPad T420

Installing Kubuntu 16.04 on ThinkPad T420

It was again time to reinstall Kubuntu to get more of latest stuff. I had purchased a Kingston 480 GB SSD drive, which was much bigger than the 120 GB one that I had used for some five years. I need to do a lot of video editing, so I needed a lot of disk space, and it must be fast.

I downloaded the Kubuntu 16.04.2 LTS version. I definitely want to use the LTS versions, as I don't want to upgrade every few months.

These are my notes for the process, just to remember what I did there. I'm writing them here just in case someone benefits from it somehow, such as regarding some of the problems.

Creating a USB image

Run usb-creator-gtk. Select the ISO image and the drive to write to. Start writing the image. The actual burn took me quite long, perhaps around half an hour. I have no idea what it did there, but at some points I thought it was stuck. Nevertheless, got it done.

Booting

Booting from the USB stick, I got the following error:
gfxboot.c32: not a COM32R image
It kept repeating.
Pressing Tab gave a menu of commands. I typed "live" to start the live mode. It worked just fine.

Installing Kubuntu

Once the live mode had started, I just clicked the Install Kubuntu 16.04.2 LTS icon. The installation APP popped up.
  1. Language – I chose "Suomi" (Finnish) as my installation language. I've been doing Finnish localizations of KDE and always want to use that. (Note that UI captions mentioned from here on are my back-translations from Finnish to English)
  2. Wireless connections – I chose to connect to network. Oddly, the keyboard layout was in en-US layout, not Finnish. That should not go so.
  3. Preparations – I wanted to choose to download updates when Kubuntu is installed, and also install 3rd party drivers. Oddly, the check box for downloading updates did not work! Pressing Continue took quite a while with no progress feedback.
  4. Installation type – I wanted encryption, but "encrypted LVM" sounded like some low-level encryption, which I didn't want. I assumed that the default was to have encrypted home directory, and encrypting entire disk would not be a huge benefit. I was installing on SSD, so I didn't want swap. Using the guided installation seemed to use swap, which is kind of stupid nowadays that it doesn't default no-swap on SSDs, so I had to do manual partitioning. Hence, I selected Partition yourself. So, I added a single /dev/sda1 partition with root (/) mount point that uses the whole disk. Ext4 filesystem was OK. Again oddly, it complained about the missing swap. Really, why doesn't it recognize SSDs? Everybody uses SSDs nowadays and nobody wants swap on SSDs!
  5. Time zone – chose my time zone.
  6. Keyboard – chose my keyboard (Finnish). It is a bit bad that it asked keyboard here and not before entering wireless password, where it really would be needed.
  7. User info – pretty straight-forward here. Noticed to select Encrypt my home folder, which enables EncFS for the home folder. That can cause trouble in some cases, such as reinstalls, but it's mostly what you want unless using whole-disk encryption. I did not want that because I want to have encryption more controllable and have more efficient non-encrypted directories.
  8. ...installation went quite smoothly. Reinstalled the machine. Pulled the USB drive out a bit too quick, so had to restart, but everything seemed to be OK.
Kubuntu booted rather fast and also KDE started rather fast. That's an improvement. And it looked good.

Then on to the settings.

System Settings

  • Optimize for SSD. You don't want atime access and such for SSD drives, so have to set in /etc/fstab for the root filesystem:

       defaults,noatime,discard

    There's probably some other relevant settings needed as well. This is a bit surprising issue, as most laptops nowadays have an SSD drive and they should be optimized automatically, without hell requiring a specialist. OK, I'm rather one, but still.

 Toolbar Settings

  • Chose to hide the toolbar automatically.
  • Set it a bit higher, as the height doesn't really disturb when it hides automatically, and I want to be able to see and click even smaller icons better.
  • Application Launcher –  The default is a new "fancy" application launcher, but I want to use the old tree-like one.
  • Quick Launcher – This is a handly grid for having quick launch buttons for the most commonly used applications.
  • Pager – Allows switching between desktops.
    • Configured to no text, but icons, so that it shows miniature icons for open windows in each desktop. You can actually drag and drop windows from one desktop to another in the pager.
  • Task Manager
    • Rows at most: 2, and always organise tasks in those two rows.
    • Only show windows in this desktop, as I often need to control the visibility of windows from the task manager and it gets rather confusing if it shows also the windows in other desktops. Only show windows in this display (I only use one display anyhow).


Arranging the toolbar proved really difficult. Applets were positioned in wrong places and moving them was really buggy.

KDE System Settings

Started up the System Settings. First, I chose the "Classic Tree View", which I've used for the last 15 years or so.

There was a lot of settings that I wanted to do:
  • Appearance
    • Workspace Theme
      • Look and feel – There are two choises: Breeze and Breeze dark.
        I want to use dark theme on my external OLED TV display. In OLED, black is true black, so I wanted to use black desktop. Hence Breeze dark.
      • Desktop Theme – Again choosing a dark theme, the Oxygen theme. That actually didn't have much effect.
      • Oddly, I haven't found a way to set desktop background to completely black. Setting black background still has some low brightness, making the screen look like LCD. In an OLED display, black should be completely black and it works that way with my other computer, so I don't understand why not here. Can't find a setting that could cause the problem.
    • Colors – Chose Obsidian Coast, which seemed rather dark, but not entirely. I don't want all black inside windows, as that sometimes causes trouble when applications assume black-on-white colors.
    • Font – The default font was Noto 10 pt, which looked rather great. However, in Libreoffice, I noticed that font rendering is horrible, so I tried tuning the font antialising settings, as instructed somewhere, but that didn't seem to help.
  • Workspace
    • Desktop
      • Desktop Effects
        • Desktop Cube – I use the desktop cube animation (see below), and set the rotation time to faster 200 ms, set Windows float on top, and Use the effect to browse desktops.
        • Desktop Cube Animation – I set the animation time to 200 ms, which is rather OK, although could be a bit quicker still. The default was way too slow. I had to disable "Use pager layout for animation", as I have two rows in the pager, but animation gets really weird that way.
      • Virtual Desktops
        • Layout – I always want eight, in two rows in the desktop pager in the panel, hence 8 and 2 in the settings.
        • Desktop names – Yeah I like to give them names.
        • ChangingAnimation – I really like the KDE's 3D desktop cube animation, so I chose that, as describe above.
        • Shortcuts – Changed the keyboard defaults for changing the desktops. For some sick reason, KDE uses Win+Tab and Shift+Win+Tab to browse "activities", but I really want to browse the desktop list. OK....there still seems to be the bug that can't use Shift+Win+Tab. The Shift key there does nothing, so had to use Ctrl+Win+Tab.
        • For some reason, the Win key does not work on my Logitech G110 keyboard. I was able to use the keyboard for several years with the old version, but then it appeared suddenly. I have to see if
      • Desktop Locking – Disabled this for now, as 5-minute locking is a bit annoying at home.
  • Window Chooser
    • Choose to use Compact rather than the default one.
    • Deselect Show selected window. The default is too disturbing.
  • Power Saving – When plugged in, don't dim and don't change mode if the lid is closed.

Extra Packages

  • kubuntu-restricted-extras – Gets MS core fonts (Times New Roman) and such.

Firefox

  • General
    • Set Firefox as the default browser
    • Set Ctrl+Tab to browse in order, not latest
    • Save downloads to a custom folder. I don't want those under my home directory, which is encrypted and backed up. Hence, I usually have a download folder directory such as /ftp (some long history with that naming).
    • Deselect opening new windows to tabs. I want to control that.
  • Content
    • Set default font size to 14. The default 10 resulted in really tiny letters on many pages.

Other Software

  • KDEnlive – Linux video editing software. I use this for all of my Youtube and other videos.
  • Synfig – Animation editor, which I have been experimenting with recently.
  • Kaffeine – Video and movie device viewer. I have been using Kaffeine for TV viewing for years. Nowadays I'm not using my TV card anymore, rather a real TV, and use Kaffeine for viewing camera videos.
    • MP4 support was missing, had to install also libxine2 plugins:
      # apt-get install kaffeine libxine2 libxine2-all-plugins
    • MTS video playback is broken! It shows green "static" about once a second. Actually, it also shows for MP4 in some cases.

      This is rather annoying, as all of my camera videos are in MTS. It looks like it's a problem with hardware acceleration. If I edit .kde/share/apps/kaffeine/xine-config and set video.driver to a safe setting such as xshm, it plays just fine. Well actually it doesn't, because the video mode is not hardware-accelerated, so it is laggy like hell. I haven't found a good video mode, so Kaffeine is currently rather unusable.
  • VLC – Installed also this, as MTS playback was broken in Kaffeine, but it seemed to work just fine in VLC. VLC also has some other features that I need, such as playing 50 FPS video back in half speed. I don't like VLC's GUI so much and some things like browsing video folders is total hell.
  • Octave – Mathematical software.
  • Jed – My preferred quick command-line editor.
  • Atom – I like to use the Atom editor for some stuff. There was no Ubuntu package for that, so had to get the DEB package from atom.io. It required installing "apt-get install git gvfs-bin".
  • Thunderbird – My preferred email client, although it does have some issues.
  • Kazam – A screen recorder that I use to make video presentations. 
  • LibreOffice –  This was actually preinstalled, but for some reason, the font rendering is horrible. It's a Gtk application, so it renders fonts a bit differently from native KDE/Qt applications. I tried some fixes, but no success so far.
There's tons of other software that I need to install, but that's a start.

New Things

For one thing, KDE was able to link up with my Android phone with KDE Connect. It's at least useful for file transfer and such. It will be interesting to learn what it exactly does.

Conclusions 

It took me some years to update (K)ubuntu, but it was worthwhile. The speed seems to have improved greatly. Some of that may be due to the faster SSD, but also rendering seems significantly faster.

I am a bit disappointed with some serious bugs, especially in organizing the desktop panel. That is a very basic task and beginners would get really frustrated. Font problems with LibreOffice seem like something very basic. I am also surprised that there is no special installation mode for SSDs. KDE also has many rather odd defaults.

There is probably much to learn about Kubuntu 16.04. Most importantly, it gives me latest versions of various important software.