#60 Transcoding Agents not being killed off

pre 0.12 SVN
General (19)
Andrew Williams

At the moment I have a few transcoding agents to pickup the fileformats that my PS3 can't handle, I've started to add a more complex iPlayer transcoder but hit a few issues while setting it up.

I've noticed that transcoding agents continue to run even after the PS3 has stopped playing the video (exiting with O or stop on a PS3 remote). The process will run until its fully transcoded the video file, while this isn't a issue with short run programs (30min / 45min) it causes issues when trying to view a continuous stream (such as iPlayer live TV).

I've included logs, config, and also the scripts in question. I can provide any other debug information as needed.


  • MT Config

  • Log file

  • mediatomb-transcode script

  • medatomb-iplayer script

    • milestone: 814929 --> pre 0.12 SVN
  • Forgot to add, running Debian Sid using the following Debian supplied Packages:

    ii mediatomb 0.12.0~svn2018-4 UPnP MediaServer (main package)
    ii mediatomb-common 0.12.0~svn2018-4+b1 UPnP MediaServer (base package)
    ii mediatomb-daemon 0.12.0~svn2018-4 UPnP MediaServer (daemon package)

  • Jin

    • priority: 5 --> 1
    • status: open --> open-rejected
  • Jin


    the problem lies in your transcoder scripts, I guess I should describe that better in the docs. Here's a quote from the transcoding documentation:

    it is possible and may be more convenient to call a wrapper script and not
    the transcoding application directly, however, in this case make sure that
    your shell script uses exec when calling the transcoder. Otherwise we will
    not be able to kill it."

    Or in other words: we execute the transcoding agent and get it's pid, so once the player closes the connection we will kill that pid. If the transcoding agent is a script which spawns other processes - there is no way for us to know, so we can't kill those other pid's.

    Therefore you must use "exec" when calling something in your script, this will make sure that the current agent process is overwritten by the new process, the pid stays the same so when we attempt to kill it we will terminate your new process and everything works nicely.

    Example for an ffmpeg wrapper script:

    exec ffmpeg -i "$1" -sameq -map 0.0 -map 0.2 -deinterlace -me_method zero -vcodec mpeg2video -acodec libmp3lame -ab 192k -f mpeg - > "$2"

  • Jin

    • status: open-rejected --> closed-rejected