Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Close but not quite there streaming live video from libshout

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Video Streaming
View previous topic :: View next topic  
Author Message
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Wed Aug 26, 2009 11:43 pm    Post subject: Close but not quite there streaming live video from libshout Reply with quote

I have written a program which uses libshout(3) to stream ogg packaged theora video to icecast(2.3.2). This program connects to my server happily enough and the server creates a mount point for my video.

However, when I try to access that mount-point (in VLC or Firefox) I get nothing. If I take down the stream source then Firefox wakes up and displays a video player (though no video).

I turned on the dump-file option for the mount, and I can play the dumped file in VLC just fine. I can even serve it up through icecast if I put the dumped file in my icecast directory. When I look at the statistics page for icecast I can see the mount and it will have a large number of bytes read and a small (tiny, like 150ish) number of bytes sent.

What am I missing here?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Aug 27, 2009 12:39 am    Post subject: Reply with quote

did you check to see if the log file shows that theora is detected? theora is an optional build component.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 7:15 am    Post subject: Reply with quote

I think it is. I see the following in error.log:

[2009-08-26 15:50:27] INFO connection/_handle_source_request Source logging in at mountpoint "/example.ogg"
[2009-08-26 15:50:36] INFO format-theora/initial_theora_page seen initial theora header

Also as I said I can see theora files just fine when they're served up from the web directory.
Back to top
View user's profile Send private message
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 7:29 am    Post subject: Reply with quote

Apparently my icecast version is actually 2.3.1 (installed from ubuntu package), in case this affects anything.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Aug 27, 2009 12:16 pm    Post subject: Reply with quote

2.3.2 or later would be better

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 8:34 pm    Post subject: Reply with quote

I'm updated to 2.3.2, and it doesn't seem to have changed anything. The stats XML looks like this (connections is high because I keep refreshing the stats XML):

Code:

<icestats>
<client_connections>59</client_connections>
<clients>3</clients>
<connections>68</connections>
<file_connections>0</file_connections>
<listener_connections>9</listener_connections>
<server>Icecast 2.3.1</server>
<server_start>Wed, 26 Aug 2009 16:07:18 -0700</server_start>
<source_client_connections>9</source_client_connections>
<source_relay_connections>1</source_relay_connections>
<source_total_connections>10</source_total_connections>
<sources>1</sources>
<stats>0</stats>
<stats_connections>0</stats_connections>

<source mount="/different.ogg">
<genre>various</genre>
<listeners>0</listeners>
<max_listeners>unlimited</max_listeners>
<on_demand>1</on_demand>
<public>0</public>
<server_description>Unspecified description</server_description>
<server_name>Unspecified name</server_name>
</source>

<source mount="/example.ogg">
<frame_rate>1.00</frame_rate>
<frame_size>640 x 480</frame_size>
<genre>various</genre>
<listener_peak>2</listener_peak>
<listeners>2</listeners>
<listenurl>http://localhost:8000/example.ogg</listenurl>
<max_listeners>unlimited</max_listeners>
<public>0</public>
<server_description>Unspecified description</server_description>
<server_name>no name</server_name>
<server_type>application/ogg</server_type>
<slow_listeners>0</slow_listeners>
<source_ip>127.0.0.1</source_ip>
<stream_start>Thu, 27 Aug 2009 13:22:12 -0700</stream_start>
<total_bytes_read>1529414</total_bytes_read>
<total_bytes_sent>204</total_bytes_sent>
<user_agent>libshout/2.2.2</user_agent>
<video_bitrate>800000</video_bitrate>
<video_quality>0</video_quality>
</source>
</icestats>


The error log looks like this:
Code:

[2009-08-27  13:22:07] INFO main/main Icecast 2.3.2 server started
[2009-08-27  13:22:07] WARN main/main YP server handling has been disabled
[2009-08-27  13:22:07] INFO connection/get_ssl_certificate No SSL capability on any configured ports
[2009-08-27  13:22:12] INFO connection/_handle_source_request Source logging in at mountpoint "/example.ogg"
[2009-08-27  13:22:15] INFO format-theora/initial_theora_page seen initial theora header
[2009-08-27  13:22:25] INFO connection/_handle_shoutcast_compatible password does not match "GET /example.ogg HTTP/1.1"
[2009-08-27  13:22:28] INFO connection/_handle_shoutcast_compatible password does not match "GET /example.ogg HTTP/1.1"
[2009-08-27  13:22:31] INFO source/source_main listener count on /example.ogg now 1


Note the password errors that happen when firefox connects. I think this may be the problem, but I don't think I'm set up to require a password.

Here is my current icecast config file (there's some weirdness with a local relay... I'm still unclear on if that's necessary at all. When I connect what URL/port should I be using? The same as the port my source is streaming to or a different one?)

Code:

<!-- This config file can be used to configure icecast
     in shoutcast compatibility mode which will allow
     you to connect the Shoutcast DSP (or other Nullsoft
     encoders such as the NSV encoder). Note this is just
     a minimal config, check the main icecast.xml.dist file
     for a complete list of possible configuration options -->
<icecast>
    <limits>
        <sources>2</sources>
   <source-timeout>200</source-timeout>   
    </limits>
    <authentication>
        <!-- Configure the shoutcast DSP to use this password -->
        <source-password>hackme</source-password>
        <!-- This is used for icecast's web interface -->
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>
    <!--directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory-->
    <!-- This is the manufactured mount name for your shoutcast
         compatible stream. Since the shoutcast DSP (and NSV encoder)
         cannot specify a mountpoint, you must enter it here -->
    <!--shoutcast-mount>/stream</shoutcast-mount-->
    <!-- Use this if you are streaming NSV using the nullsoft NSV encoder
    <shoutcast-mount>/stream.nsv</shoutcast-mount>
    -->
    <!-- This is the hostname other people will use to connect to your server.
    It affects mainly the urls generated by Icecast for playlists and yp
    listings. -->
    <hostname>localhost</hostname>
    <!-- You MUST define 2 ports, port and port +1 -->
    <listen-socket>
        <!-- Configure the shoutcast DSP with *this* port
             the shoutcast DSP actually will connect the
             encoder to this port + 1 -->
        <port>8000</port>
   <shoutcast-mount>/stream.ogg</shoutcast-mount>
    </listen-socket>
    <listen-socket>
      <port>8005</port>
    </listen-socket>
    <relay>
      <server>localhost</server>
      <port>8005</port>
      <mount>/example.ogg</mount>
      <local-mount>/different.ogg</local-mount>
      <!--username>joe</username>
      <password>soap</password-->
      <relay-shoutcast-metadata>0</relay-shoutcast-metadata>
      <on-demand>1</on-demand>
    </relay>
    <mount>
      <mount-name>/example.ogg</mount-name>
      <dump-file>/tmp/example.ogg</dump-file>
    </mount>
    <!--listen-socket-->
        <!-- This port *must* be one larger than the one defined
             above and defined as 'shoutcast-compat' -->
        <!--port>8001</port>
        <shoutcast-compat>1</shoutcast-compat>
    </listen-socket-->
    <fileserve>1</fileserve>
    <paths>
        <logdir>/u/ethand/logs/icecast2</logdir>
        <webroot>/u/ethand/icecast2/web</webroot>
        <adminroot>/usr/share/icecast2/admin</adminroot>
    </paths>
    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
         <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
    </logging>
    <security>
        <chroot>0</chroot>
    </security>
</icecast>


Lastly, since I'm dumping everything in here, here's my libshout setup stuff (which I think is fine, since it seems to connect happily enough):
Code:

if(shout_set_host(shout_, "127.0.0.1") != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting shout hostname: %s.", shout_get_error(shout_));
         if(shout_set_protocol(shout_, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting shout protocol to ICY: %s.", shout_get_error(shout_));
         if(shout_set_port(shout_, 8000) != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting shout port: %s.", shout_get_error(shout_));
         if(shout_set_password(shout_, "hackme") != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting shout password: %s.", shout_get_error(shout_));
         if(shout_set_mount(shout_, "/example.ogg") != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting mount point: %s.", shout_get_error(shout_));
         if(shout_set_user(shout_, "source") != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting user to source: %s.", shout_get_error(shout_));
         if(shout_set_format(shout_, SHOUT_FORMAT_OGG) != SHOUTERR_SUCCESS)
            ROS_ERROR("Error setting shout format to ogg: %s.", shout_get_error(shout_));
         if(shout_open(shout_) != SHOUTERR_SUCCESS)
            ROS_ERROR("Failed to connect to icecast server: %s", shout_get_error(shout_));


Oh yeah, and why not, here's access.log:
Code:

127.0.0.1 - - [27/Aug/2009:13:23:29 -0700] "GET /admin/stats.xml HTTP/1.1" 200 1642 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1" 0
127.0.0.1 - - [27/Aug/2009:13:23:31 -0700] "GET /admin/stats.xml HTTP/1.1" 200 1642 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1" 0
127.0.0.1 - - [27/Aug/2009:13:24:16 -0700] "SOURCE /example.ogg HTTP/1.0" 200 19 "-" "libshout/2.2.2" 124
127.0.0.1 - - [27/Aug/2009:13:24:16 -0700] "GET /example.ogg HTTP/1.1" 200 102 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1" 105
127.0.0.1 - - [27/Aug/2009:13:24:16 -0700] "GET /example.ogg HTTP/1.1" 200 102 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1" 99
Back to top
View user's profile Send private message
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 9:30 pm    Post subject: Reply with quote

So I'm out of ideas. I think that libshout may not actually be a "shoutcast client", so I set up a normal configuration. The listener count increases without error, but I still don't actually see any video!

Code:

[2009-08-27  14:23:23] INFO main/main Icecast 2.3.2 server started
[2009-08-27  14:23:23] WARN main/main YP server handling has been disabled
[2009-08-27  14:23:23] INFO connection/get_ssl_certificate No SSL capability on any configured ports
[2009-08-27  14:25:04] INFO connection/_handle_source_request Source logging in at mountpoint "/example.ogg"
[2009-08-27  14:25:04] INFO source/source_main listener count on /example.ogg now 0
[2009-08-27  14:25:07] INFO format-theora/initial_theora_page seen initial theora header
[2009-08-27  14:25:18] INFO source/source_main listener count on /example.ogg now 1
Back to top
View user's profile Send private message
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 9:38 pm    Post subject: Reply with quote

Perhaps there's something screwy with my actual theora stream. Any good way to check this? I'm weirded out that the dump plays in VLC though.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Aug 27, 2009 10:49 pm    Post subject: Reply with quote

the error log messages indicate that you are connecting on a shoutcast style port but issuing a http request on it which will fail fail to match on the password.

you have a lot of commented sectioned in the posted xml, and some of it is taken out of context so it's hard to see what it actually going on. port wise it looks like you have 3 configured

port 8000 http style, normal icecast connection
port 8001 iimplicit shoutcast style connection mapping to /stream.ogg.
port 8005 http style.

can you verify what port and style of connection you intend to use at the source client?

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Aug 27, 2009 11:33 pm    Post subject: Reply with quote

Yeah, sorry about the confusion, without any good way to tell what's wrong I've just been trying everything I can think of. I believe you are correct that I shouldn't have been using the shoutcast stuff at all.

My current setup is the following:

Source - libshout
Protocol - HTTP
Source Port - 8007

The corresponding cleaned up XML config is:
Code:

<icecast>
    <limits>
        <sources>2</sources>
    </limits>
    <authentication>
        <source-password>hackme</source-password>
        <relay-password>hackme</relay-password>
        <admin-user>admin</admin-user>
        <admin-password>hackme</admin-password>
    </authentication>
    <directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory>
    <hostname>localhost</hostname>
    <listen-socket>
        <port>8007</port>
    </listen-socket>
    <fileserve>1</fileserve>
    <paths>
        <logdir>[snipped]</logdir>
        <webroot>[snipped]</webroot>
        <adminroot>[snipped]</adminroot>
        <alias source="/" dest="/status.xsl"/>
    </paths>
    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
         <loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
    </logging>
</icecast>


I am logging into the server on port 8007 as the source and also on port 8007 as the client.

There are no error messages, I just see
Code:

[2009-08-27  14:23:23] INFO main/main Icecast 2.3.2 server started
[2009-08-27  14:23:23] WARN main/main YP server handling has been disabled
[2009-08-27  14:23:23] INFO connection/get_ssl_certificate No SSL capability on any configured ports
[2009-08-27  14:25:04] INFO connection/_handle_source_request Source logging in at mountpoint "/example.ogg"
[2009-08-27  14:25:04] INFO source/source_main listener count on /example.ogg now 0
[2009-08-27  14:25:07] INFO format-theora/initial_theora_page seen initial theora header
[2009-08-27  14:25:18] INFO source/source_main listener count on /example.ogg now 1


Should I obtain a trace with DEBUG level logging information? Are there any clients that can help provide more debug information about the stream? It acts as if it is trying to connect, but nothing comes through.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Fri Aug 28, 2009 12:02 am    Post subject: Reply with quote

without a url to try out, it will be all up to you, check with curl to see if data is coming down and if so, does the data is saved play back ok. You may need to try out the trunk code

for curl use curl -o save.ogg http://.....
for trunk icecast check http://people.xiph.org/~brendan/snapshots/icecast/

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ethan



Joined: 26 Aug 2009
Posts: 8

PostPosted: Thu Sep 03, 2009 7:05 pm    Post subject: Reply with quote

So I've achieved at least partial success. A lot of the problem turned out to be related to the frame-rate. Apparently theora doesn't support variable frame rates, so I added some code to duplicate frames to maintain a constant frame rate and things got better. I can at least watch streams now.

The issue now though is that there's a lot of buffering going on on the client side (firefox), and it seems to get worse over time until I refresh the page. I think it still may be related to the frame rate, although it seems like I'm providing a pretty constant frame rate now, so this shouldn't be a problem anymore.

Does anyone know if there is a good solution for streaming variable-rate video with low latency to a browser? Are there settings I can tweak to prevent buffering? I really don't care about smooth playback, I just want to continuously display the latest available image.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Video Streaming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber