Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Mediatomb input is an rtp stream, howto??

2010-08-23
2013-05-30
  • Sabah Al-Sabea
    Sabah Al-Sabea
    2010-08-23

    Hi,

    I want to let mediatomb has as input rtp stream. Here is my setup:

        - I have mediatomb running on ubuntu on a virtual machine,
        - I use vlc to stream an .avi or .mp4 video file using rtp to the loopback address (rtp://127.0.0.1:5004).
        - the host machine is windows xp with xmbc MediaRenderer
        - the network adapter between the host and guest machine is bridging
        - I want the mediatomb to take this rtp stream and stream it again (over UPnP) so that i can play it on xbmc

    After googling and trying for a couple of weeks I realized that i should use the transcoding feature of the mediatomb. In my configuration file I have changed/added  the following:

    <transcoding enabled="yes">
    ...
    <transcode mimetype="video/x-avi" using="ffmpeg-sh"/>
    ...
    <profile name="ffmpeg-sh" enabled="yes" type="external">
                <mimetype>video/mpeg</mimetype>
                <accept-url>yes</accept-url>
                <first-resource>yes</first-resource>
                <agent command="ffmpeg-tr.sh" arguments="%in %out"/>
                <buffer size="10485760" chunk-size="262144" fill-size="5242880"/>
            </profile>
    

    I created the /bin/ffmpeg-tr.sh file (and made it executable) and put this in it:

     #!/bin/sh
       exec ffmpeg -i "$1" -b 2000k -me_method zero -f mpeg -ar 48000 -ac 2 - >"$2"
    

    In the web interface I added an item with the following characteristics:

    Type:               external link
    title:                  test
    URL:                rtp://127.0.0.1:5004
    Protocol:         rtsp-rtp-udp
    class:              object.Item.VideoItem
    description:
    Mimetype:       video/x-avi
    

    For testing run the vlc for streaming (without transcoding) and to make sure it works i try to open the stream using another instance from vlc and it works :-)

    However from the UPnP part (xbmc and mediatomb) it doesn't giving lot of errors.

    I have been trying for weeks and it is really annoying me as it is mentioned that mediatomb is able to take input from rtp stream but i am not successful in this. So please if you have any idea or any question for more details that may help me solve this, I will be very thankful.

     
  • Jin
    Jin
    2010-10-18

    use http-get in the protocol, with your setup you are not serving the rtp stream directly to the player, instead you are using MediaTomb to transcode and that serves the transcoded stream via http.

     
  • #!/bin/sh
       exec ffmpeg -i "$1" -b 2000k -me_method zero -f mpeg -ar 48000 -ac 2 - >"$2"

    Add a -y option to the command as the ffmpeg transcoder needs to be forced to write to the fifo reffered to by the variable $2. Refer the "ffmpeg failing mysteriously" in the documentation

    http://mediatomb.cc/dokuwiki/transcoding:transcoding