Transcode movie files for Sony Bravia on Linux

January 3, 2011

This post describes some way, of transcoding your video files to be used with Sony’s Bravia Television.

Matroska to MPEG-4 (mkv2mpg)

mkvtoolnix is needed for the following commands.

  • First get the frames-per-second value of your matroska movie file:
    mkvinfo movie.mkv
  • Extract the video and audio parts from the matroska container:
    mkvextract tracks "movie.mkv" 1:movie.264 2:movie.dts
  • If the audio part is in DTS format, like the example above, transcode it into AAC or AC3. In case you choose AAC:
    ffmpeg -i movie.dts -vcodec libfaac movie.aac
  • Create an mp4 movie file from the video and audio files.

Creating an MP4 movie

For the following command the gpac package is needed.
MP4Box -new movie.mp4 -add movie.264 -add movie.aac -fps 23.976

Splitting the MP4 movie file for FAT-32

Since the most HD-files are bigger than 4GB (the maximum file size for a FAT-32 file-system), it may be necessary to split an HD-movie into multiple chunks. This can be done with MP4Box like this:
MP4Box -split-size 4194304 input.mp4
where the size is 4194304 KB = 4 * 1024 * 1024 KB = 4 GB

Putting the splitted files into a separate folder for the movie on the usb-disk will give the best user experience.


logging out from openbox (the Upower way)

April 15, 2010

In the manner of batti, using the newest linux desktop technologies with minimal dependencies, I created a small python script to be able to logout from openbox (that one was really easy), but also to reboot, halt, suspend and hibernate my computer without the need of using sudo. The screenshot first:

There are some things to keep in mind, when using the ConsoleKit and UPower backends.

  • openbox-session has to be launched with ConsoleKit to get an active session. So this should be the entry in your ~/.xinitrc:
    ck-launch-session openbox-session
  • A local session of D-Bus needs to be running. So this would be the entry in your
    if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
        eval `dbus-launch --sh-syntax --exit-with-session`

I know about  oblogout. I even tried it, but it was too heavy for that simple purpose. Furthermore I believe it still depends on hal, but I’m not sure about that. The script below is just a starting point. It could be extended to a complete project, by adding localizations, an own icon-theme (installed in hicolor-icon-theme, of course), better aligning of the buttons and its icons (probably using GtkBuilder instead of python), disable/hide buttons if their corresponding action is not allowed, …
Feel free to contact me, if you are going for that.

But for this time, I wanted to keep it simple. So, finally the script:

#!/usr/bin/env python
    ob-logout, fire power-managment events without sudo

    Copyright (C) 2010 Arthur Spitzer <>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <>.

import dbus
import gtk
import os

class DBusExecutor(object):

    ConsoleKitService = 'org.freedesktop.ConsoleKit'
    ConsoleKitPath = '/org/freedesktop/ConsoleKit/Manager'
    ConsoleKitInterface = 'org.freedesktop.ConsoleKit.Manager'
    UPowerService = 'org.freedesktop.UPower'
    UPowerPath = '/org/freedesktop/UPower'
    UPowerInterface = UPowerService

    def __init__(self):
        self.__bus = dbus.SystemBus()

    def logout(self, widget=None):
        os.system("openbox --exit")

    def restart(self, widget=None):
        obj = self.__bus.get_object(self.ConsoleKitService, self.ConsoleKitPath)
        manager = dbus.Interface(obj, self.ConsoleKitInterface)
        if manager.CanRestart():

    def shutdown(self, widget=None):
        obj = self.__bus.get_object(self.ConsoleKitService, self.ConsoleKitPath)
        manager = dbus.Interface(obj, self.ConsoleKitInterface)
        if manager.CanStop():

    def suspend(self, widget=None):
        obj = self.__bus.get_object(self.UPowerService, self.UPowerPath)
        manager = dbus.Interface(obj, self.UPowerInterface)
        if manager.SuspendAllowed():

    def hibernate(self, widget=None):
        obj = self.__bus.get_object(self.UPowerService, self.UPowerPath)
        manager = dbus.Interface(obj, self.UPowerInterface)
        if manager.HibernateAllowed():

    def cancel(self, widget=None):
        # Check if we're already in gtk.main loop
        if gtk.main_level() > 0:

class BiggerButton(gtk.Button):
    def __init__(self, label=None):
        gtk.Button.__init__(self, label, use_underline=True)
        self.set_size_request(200, 50)

class OBLogout(object):
    def __init__(self):
        self.executor = DBusExecutor()
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.executor.cancel)

        vbox = gtk.VBox(False, 16)

        icon_size = gtk.ICON_SIZE_DND

        logout_btn = BiggerButton('_Logout')
        image = gtk.image_new_from_icon_name('gnome-session-logout', icon_size)
        logout_btn.set_property('image', image)
        logout_btn.connect('clicked', self.executor.logout)
        vbox.pack_start(logout_btn, True, True, 0)

        restart_btn = BiggerButton('_Restart')
        image = gtk.image_new_from_icon_name('gnome-session-reboot', icon_size)
        restart_btn.set_property('image', image)
        restart_btn.connect('clicked', self.executor.restart)
        vbox.pack_start(restart_btn, True, True, 0)

        shutdown_btn = BiggerButton('Shut_down')
        image = gtk.image_new_from_icon_name('gnome-session-halt', icon_size)
        shutdown_btn.set_property('image', image)
        shutdown_btn.connect('clicked', self.executor.shutdown)
        vbox.pack_start(shutdown_btn, True, True, 0)

        suspend_btn = BiggerButton('_Suspend')
        image = gtk.image_new_from_icon_name('gnome-session-suspend', icon_size)
        suspend_btn.set_property('image', image)
        suspend_btn.connect('clicked', self.executor.suspend)
        vbox.pack_start(suspend_btn, True, True, 0)

        hibernate_btn = BiggerButton('_Hibernate')
        image = gtk.image_new_from_icon_name('gnome-session-hibernate', icon_size)
        hibernate_btn.set_property('image', image)
        hibernate_btn.connect('clicked', self.executor.hibernate)
        vbox.pack_start(hibernate_btn, True, True, 0)

        sep = gtk.HSeparator()
        vbox.pack_start(sep, True, True, 0)

        cancel_btn = BiggerButton('_Abort')
        image = gtk.image_new_from_stock(gtk.STOCK_CANCEL, icon_size)
        cancel_btn.set_property('image', image)
        cancel_btn.connect('clicked', self.executor.cancel)
        vbox.pack_start(cancel_btn, True, True, 0)


    def main(self):
        except KeyboardInterrupt:

if __name__ == "__main__":
    obl = OBLogout()

batti icon-theme

April 12, 2010

batti was updated to include it’s own icons and icon-naming. The icons are actually not its own, but stolen from gnome-power-manager. But since batti is made as a replacement of gnome-power-manager (well just the battery-monitor part of it), I don’t think it’s the wrong decision.

Additionally a simple desktop-file was also included.

mail from softpedia

April 11, 2010

Batti, one of your products, has been added to Softpedia’s database of software programs for Linux. It is featured with a description text, screenshots, download links and technical details on this page:

I’m very surprised to get a mail from them. But possitive, of course. Thank you Softpedia, for promoting my little app.

In the meantime I also added batti to gnomefiles: There are 8 downloads, yet! Fantastic. 😀

batti-0.3 released

April 8, 2010

Version 0.3 of batti is released.

Since I got dbus-daemon-launcher-helper to work, DeviceKit.Power was finally able to start. Than yesterday, Upower 0.9.2 was added into portage, so it was possible to copy the power backend of DeviceKit to UPower, resulting in version 0.3 of batti.

If your PolicyKit installation is fine, batti should even allow suspend and hibernate actions.