Mediatomb does not start the transcode script

Help
Anonymous
2011-06-12
2013-05-30
  • Anonymous - 2011-06-12

    Hello,

    For the past couple of days I have been trying to use Mediatomb to stream to my iPod Touch 2G. After finding a player for my iPod that will actually try to start the files instead of saying "Fuck you! It's not an MP4 so I ain't touching that!" I started working on the Mediatomb configuration.

    First I added the mimetypes in my config folder. After I did that I added a profile that I found on the internet, which was said to be working.

    However, when I try to open a media file that needs to be transcoded, the transcode script doesn't start. Help! Why is this (not) happening?

    This is my config file:

    <?xml version="1.0" encoding="UTF-8"?>
    <config version="1" xmlns="http://mediatomb.cc/config/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/1 http://mediatomb.cc/config/1.xsd">
      <!--
         Read /usr/share/doc/mediatomb-common/README.gz section 6 for more
         information on creating and using config.xml configration files.
        -->
      <server>
    <port>10002</port>
    <ip>192.168.1.10</ip>
        <ui enabled="yes" show-tooltips="yes">
          <accounts enabled="no" session-timeout="30">
            <account user="mediatomb" password="mediatomb"/>
          </accounts>
        </ui>
        <name>JScharlooHServer</name>
        <udn>uuid:0adc530c-eb90-46bd-a5ad-523affc55a00</udn>
        <home>/home/homeserver/.mediatomb</home>
        <webroot>/usr/share/mediatomb/web</webroot>
        <storage>
          <sqlite3 enabled="yes">
            <database-file>mediatomb.db</database-file>
          </sqlite3>
          <mysql enabled="no">
            <host>localhost</host>
            <username>mediatomb</username>
            <database>mediatomb</database>
          </mysql>
        </storage>
        <protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
        <!--
           Uncomment the lines below to get rid of jerky avi playback on the
           DSM320 or to enable subtitles support on the DSM units
        -->
        <!--
        <custom-http-headers>
          <add header="X-User-Agent: redsonic"/>
        </custom-http-headers>
        <manufacturerURL>redsonic.com</manufacturerURL>
        <modelNumber>105</modelNumber>
        -->
        <!-- Uncomment the line below if you have a Telegent TG100 -->
        <!--
           <upnp-string-limit>101</upnp-string-limit>
        -->
        <extended-runtime-options>
          <ffmpegthumbnailer enabled="no">
            <thumbnail-size>128</thumbnail-size>
            <seek-percentage>5</seek-percentage>
            <filmstrip-overlay>yes</filmstrip-overlay>
            <workaround-bugs>no</workaround-bugs>
          </ffmpegthumbnailer>
          <mark-played-items enabled="no" suppress-cds-updates="yes">
            <string mode="prepend">*</string>
          </mark-played-items>
        </extended-runtime-options>
      </server>
      <import hidden-files="no">
        <scripting script-charset="UTF-8">
          <virtual-layout type="builtin"/>
        </scripting>
        <mappings>
          <extension-mimetype ignore-unknown="no">
            <map from="mp3" to="audio/mpeg"/>
            <map from="ogg" to="application/ogg"/>
            <map from="asf" to="video/x-ms-asf"/>
            <map from="asx" to="video/x-ms-asf"/>
            <map from="wma" to="audio/x-ms-wma"/>
            <map from="wax" to="audio/x-ms-wax"/>
            <map from="wmv" to="video/x-ms-wmv"/>
            <map from="wvx" to="video/x-ms-wvx"/>
            <map from="wm" to="video/x-ms-wm"/>
            <map from="wmx" to="video/x-ms-wmx"/>
            <map from="m3u" to="audio/x-mpegurl"/>
            <map from="pls" to="audio/x-scpls"/>
            <map from="flv" to="video/x-flv"/>
            <map from="mkv" to="video/x-matroska"/>
            <map from="mka" to="audio/x-matroska"/>
            <map from="m4a" to="audio/mp4"/>
            <map from="mp4" to="video/mp4"/>
            <map from="m4v" to="video/m4v"/>
            <!-- Uncomment the line below for PS3 divx support -->
            <map from="avi" to="video/divx"/>
            <!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
            <!-- <map from="avi" to="video/avi"/> -->
          </extension-mimetype>
          <mimetype-upnpclass>
            <map from="audio/*" to="object.item.audioItem.musicTrack"/>
            <map from="video/*" to="object.item.videoItem"/>
            <map from="image/*" to="object.item.imageItem"/>
            <map from="application/ogg" to="object.item.audioItem.musicTrack"/>
          </mimetype-upnpclass>
          <mimetype-contenttype>
            <treat mimetype="audio/mpeg" as="mp3"/>
            <treat mimetype="application/ogg" as="ogg"/>
            <treat mimetype="audio/x-flac" as="flac"/>
            <treat mimetype="image/jpeg" as="jpg"/>
            <treat mimetype="audio/x-mpegurl" as="playlist"/>
            <treat mimetype="audio/x-scpls" as="playlist"/>
            <treat mimetype="audio/x-wav" as="pcm"/>
            <treat mimetype="audio/L16" as="pcm"/>
            <treat mimetype="video/x-msvideo" as="avi"/>
            <treat mimetype="video/mp4" as="mp4"/>
            <treat mimetype="audio/mp4" as="mp4"/>
            <treat mimetype="application/x-iso9660" as="dvd"/>
            <treat mimetype="application/x-iso9660-image" as="dvd"/>
            <treat mimetype="video/x-matroska" as="mkv"/>
            <treat mimetype="audio/x-matroska" as="mka"/>
            <treat mimetype="video/mp4" as="mp4"/>
            <treat mimetype="audio/mp4" as="m4a"/>
          </mimetype-contenttype>
        </mappings>
        <online-content>
          <!-- Make sure to setup a transcoding profile for flv -->
          <YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="flv" hd="no">
            <favorites user="mediatomb"/>
            <standardfeed feed="most_viewed" time-range="today"/>
            <playlists user="mediatomb"/>
            <uploads user="mediatomb"/>
            <standardfeed feed="recently_featured" time-range="today"/>
          </YouTube>
          <Weborama enabled="no" refresh="28800" update-at-start="no">
            <playlist name="Active" type="playlist" mood="active"/>
            <playlist name="Metal" type="playlist">
              <filter>
                <genres>metal</genres>
              </filter>
            </playlist>
          </Weborama>
          <AppleTrailers enabled="no" refresh="43200" update-at-start="no" resolution="640"/>
        </online-content>
      </import>
      <transcoding enabled="yes">
        <mimetype-profile-mappings>
          <transcode mimetype="video/x-flv" using="vlcmpeg"/>
          <transcode mimetype="application/ogg" using="vlcmpeg"/>
          <transcode mimetype="application/ogg" using="oggflac2raw"/>
          <transcode mimetype="audio/x-flac" using="oggflac2raw"/>
          <transcode mimetype="video/mpeg" using="video-iphone"/>
          <transcode mimetype="video/avi" using="video-iphone"/>
        </mimetype-profile-mappings>
        <profiles>
          <profile name="oggflac2raw" enabled="no" type="external">
            <mimetype>audio/L16</mimetype>
            <accept-url>no</accept-url>
            <first-resource>yes</first-resource>
            <accept-ogg-theora>no</accept-ogg-theora>
            <agent command="ogg123" arguments="-d raw -o byteorder:big -f %out %in"/>
            <buffer size="1048576" chunk-size="131072" fill-size="262144"/>
          </profile>
          <profile name="vlcmpeg" enabled="yes" type="external">
            <mimetype>video/mpeg</mimetype>
            <accept-url>yes</accept-url>
            <first-resource>yes</first-resource>
            <accept-ogg-theora>yes</accept-ogg-theora>
            <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit"/>
            <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
          </profile>
          <profile name="video-iphone" enabled="yes" type="external">
            <mimetype>video/mp4</mimetype>
            <accept-url>no</accept-url>
            <first-resource>yes</first-resource>
            <hide-original-resource>no</hide-original-resource>
            <use-chunked-encoding>yes</use-chunked-encoding>
            <agent command="mediatomb-transcode" arguments="-i %in -o %out --video-iphone"/>
            <buffer size="14400000" chunk-size="512000" fill-size="120000"/>
          </profile>
        </profiles>
      </transcoding>
    </config>
    

    When I try to open my file this is what Mediatomb in debug mode says:

    2011-06-12 15:50:13   DEBUG: [../src/web_callbacks.cc:72] create_request_handler(): Filename: /content/media/object_id/2362/res_id/0/ext/file.avi, Path: (null)
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:341] open(): start
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:356] open(): full url (filename): /content/media/object_id/2362/res_id/0/ext/file.avi, parameters: object_id/2362/res_id/0/ext/file.avi
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:366] open(): Opening media file with object id 2362
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:502] open(): path: /data/Files/Videos/OLDPromoG4L.avi
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:515] open(): fetching resource id 0
    2011-06-12 15:50:13   DEBUG: [../src/file_request_handler.cc:660] open(): Adding content disposition header: Content-Disposition: attachment; filename="OLDPromoG4L.avi"
    

    I don't see the script appearing on htop and PlugPlayer (my player on the iPod) doesn't do shit with the file, except for trying to open it.

    The script is located in /usr/local/bin.

    Here is what the script looks like:

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    #!/bin/sh
    # This script is used by MediaTomb for transcoding support.
    # Basic function that will transcode any input file into the target type
    # 'dvd' ffmpeg supports
    video_common() {
        local input="$1"
        local output="$2"
        ffmpeg -i "$input" -target dvd -y "$output"
    }
    # Basic function that will transcode any input file into the wav format
    audio_common() {
        local input="$1"
        local output="$2"
        ffmpeg -i "$input" -f wav -y "$output"
    }
    # Function to transcode matroska files to dvd compatible format
    transcode_matroska() {
        local input="$1"
        local output="$2"
        local alang="$3"
        local slang="$4"
        # Default to english if languages are not set
        [ "$alang" ] || alang="eng"
        [ "$slang" ] || slang="eng"
        # Use mencoder if available, else fall back to using ffmpeg.
        # Transcoding using ffmpeg will not include subtitles.
        if which mencoder >/dev/null 2>&1; then
            mencoder "$input" -oac lavc -ovc lavc -of mpeg -mc 0 -noskip \
                -lavcopts vcodec=mpeg2video:vbitrate=6000:acodec=ac3:abitrate=448 \
                -vf harddup -alang "$alang" \
                -slang "$slang" -font 'Bitstream Vera Sans' \
                -o "$output"
        else
            ffmpeg -alang "$alang" -slang "$slang" -i "$input" -target dvd \
                -y "$output"
        fi
    }
    # Our "main" function below.
    USAGE="
    This script is used by MediaTomb for transcoding support. It can also serve as
    a script to transcode various files in a format suitable for streaming directly.
    Synopsis:
     mediatomb-transcode [TRANSCODE FUNCTION OPTION] [GENERIC OPTIONS]
    Generic Options:
     -h, --help                 Display this help message.
     -i, --input                Input file that is meant to be transcoded.
     -o, --output               Output file that will be read back by MediaTomb.
     --audio-lang               Specify ISO 639 language code to use for audio.
     --subtitle-lang            Specify ISO 639 language code to use for subtitles.
    Transcode Function Options (one is required):
     --video-common             Perform generic video transcoding.
     --audio-common             Perform generic audio transcoding.
     --transcode-matroska       Used in transcoding matroska files.
    "
    while [ "$#" -gt "0" ]
    do
        case "$1" in
            -i|--input)
                INPUT="$2"
                shift; shift;
                ;;
            -o|--output)
                OUTPUT="$2"
                shift; shift;
                ;;
            --video-common)
                USE_VIDEO_COMMON=1
                shift
                ;;
            --audio-common)
                USE_AUDIO_COMMON=1
                shift
                ;;
            --transcode-matroska)
                USE_TRANSCODE_MATROSKA=1
                shift
                ;;
            --audio-lang)
                ALANG="$2"
                shift; shift;
                ;;
            --subtitle-lang)
                SLANG="$2"
                shift; shift;
                ;;
            -h|--help|*)
                echo "${USAGE}"
                exit 1
                ;;
        esac
    done
    # Perform specified function
    if [ $USE_VIDEO_COMMON ]; then
        video_common "$INPUT" "$OUTPUT"
    elif [ $USE_AUDIO_COMMON ]; then
        audio_common "$INPUT" "$OUTPUT"
    elif [ $USE_TRANSCODE_MATROSKA ]; then
        transcode_matroska "$INPUT" "$OUTPUT" "$ALANG" "$SLANG"
    else
        # Must specify one transcoding function
        echo "${USAGE}"
        exit 1
    fi
    

    Any help would be greatly appreciated!

    Best regards,
    Mastermind

     
  • Catalin Eugen Popa

    Your error is in your MediaTomb config file. When you specify the agent in your video-iphone profile you should include the full path to your script.
    So instead of

    <agent command="mediatomb-transcode"
    

    you should have

    <agent command="/usr/local/bin/mediatomb-transcode"
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks