LinHES Forums
http://forums.linhes.org/

[SOLVED] Streaming via MythWeb
http://forums.linhes.org/viewtopic.php?f=25&t=20746
Page 1 of 1

Author:  bkamen [ Wed Jan 06, 2010 10:18 pm ]
Post subject:  [SOLVED] Streaming via MythWeb

Ok, I know the flash based streaming is still experimental...

but what about the ASX streaming?

I try it with a recorded program in HDtv and it's about 5.5GB on the disk.

When I click on ASX and then open with VLC, lighttpd goes bonkers and
sucks up all RAM and SWAP and puts the machine in slog mode.

Should I not expect this to work yet? or do something different to watch via the web interface over my LAN?

Thanks,

-Ben

Author:  Harveythedog [ Sun Jan 10, 2010 5:47 pm ]
Post subject: 

Quote:
lighttpd goes bonkers and sucks up all RAM and SWAP and puts the machine in slog mode.

I've noticed that behaviour too when copying recordings over my network from Mythweb via Firefox. Maybe file a bug report??

Author:  bkamen [ Sun Jan 10, 2010 6:03 pm ]
Post subject: 

I would - but I don't know if it's a bug yet.

I have notices if I transcode the video down to something smaller in size < 1GB (like 700-800MB), then streaming is no problem.

-Ben

Author:  bigB [ Tue Jan 12, 2010 2:30 am ]
Post subject: 

Hi,

I'm noticing that lighttpd likes to hold the entire file in ram while it services it out. I'm trying to work out if this behaviour can be changed, but i think reverting back to apache might be in order.

When you get your file down to 700MB, have a look at the amount of ram lighttpd uses when you download the recording.

BigB.

Author:  bkamen [ Tue Jan 12, 2010 11:45 am ]
Post subject: 

bigB wrote:
Hi,

I'm noticing that lighttpd likes to hold the entire file in ram while it services it out. I'm trying to work out if this behaviour can be changed, but i think reverting back to apache might be in order.

When you get your file down to 700MB, have a look at the amount of ram lighttpd uses when you download the recording.



Yep!

And I've also discovered (although probably not news to readers here) that if you break the stream (close the ffmpeg flash playback or an ASX stream to VLC (which looks great after transcoding)) ffmpeg doesn't die off (not surprising) and lighttpd doesn't give up the file and go idle.

If you try and reload another ASX stream (I only did the same stream), a server 500 error occurs.

What would switching back to apache gain? (not being updated on such details)

-Ben

Author:  bigB [ Tue Jan 12, 2010 8:14 pm ]
Post subject: 

Hi Ben,

to make mythweb kill ffmpeg when the streaming is stopped by the user i edited mythweb/modules/stream/stream_flv.pl, and made the start of the file look like this

Code:
# Shutdown cleanup, of various types
    our $pgid = setpgrp(0,0);

    $SIG{'TERM'} = \&shutdown_handler;
    $SIG{'PIPE'} = \&shutdown_handler;
    END {
        shutdown_handler();
    }
    sub shutdown_handler {
        kill(-1, $pgid) if ($ffmpeg_pid);
    }
# Find ffmpeg


specifically the "setpgrp" and the "kill" lines

BigB.

Author:  bkamen [ Wed Jan 13, 2010 1:05 am ]
Post subject: 

I don't have such a file.

looking in /data/srv/httpd/htdocs/mythweb/modules/stream:

I have:

handler.pl
init.php
set_protocol.php
(dir) tmpl

Author:  bigB [ Wed Jan 13, 2010 4:21 pm ]
Post subject: 

Hi Ben,

Sorry, that was for 0.22. You should be able to find something similar in handler.pl

BigB.

Author:  bkamen [ Wed Jan 13, 2010 6:00 pm ]
Post subject: 

Ahhh, ok..

so what's in there (handler.pl) now is:

Code:
# Shutdown cleanup, of various types
    $SIG{'TERM'} = \&shutdown_handler;
    $SIG{'PIPE'} = \&shutdown_handler;
    END {
        shutdown_handler();
    }
    sub shutdown_handler {
        kill(1, $ffmpeg_pid) if ($ffmpeg_pid);
    }


You're saying I should add the line:

our $pgid = setpgrp(0,0);

and change the kil line to:

kill(-1, $pgid) if ($ffmpeg_pid);

??

Author:  bigB [ Wed Jan 13, 2010 6:02 pm ]
Post subject: 

Thats correct.

Author:  bkamen [ Wed Jan 13, 2010 6:10 pm ]
Post subject: 

Fabulous. Works like a charm!

What does that do exactly? Kill off as root instead of something else?

Thanks!

-Ben

Author:  bigB [ Wed Jan 13, 2010 6:11 pm ]
Post subject: 

Excelent,

In the mean time, i've managed to break mythweb completely :-( But i won't trouble this thread with those issues :)

BigB.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/