Originally posted by dotorg:
First, I can use the httpd.tcl in the distribution to download the video off a program currently on the box just fine. Under Linux, mplayer plays it just fine too. Under Windows, I'll be damned if I can find any players that will play the file though -- even tmpegenc doesnt' recognize it as an MPEG file. Any ideas why?
Also, I'm getting a LOT of frame errors on the ethernet interface. Throughput is about 16K/sec out of ExtractStream via httpd.tcl, which from what I read is an order of magnitude or more slower than it should be.
The httpd.tcl interface to the tyStream has lots of bugs. Mostly, it runs all the data thru TCL causing bad stuttering, loss of data, and embedded html.
In fact, I'm amazed the mplayer was able to read a raw tyStream (even a good one, not hammered by tcl). I've never had good luck at all with mplayer -- what version are you using?
For mplayer to work, it's got to ignore the tyStream-specific data at the front of every chunk, not get baffled by the PES headers (that, for example, say the packets are zero length), disregard out of sequence packets (which can only be resolved by knowing how to interpret the non-standard data at the front of the chunk.
This is quite a find! Your second error may be caused by running the data thru the tyStream. You're better off using "ExtractStream -s [fsid's] >[file] and using the resulting file.
I've been working on a modification that will work in Linux with Netscape 4.x, but not yet windows.
You may want to try this approach... since you seem to have better luck than I've ever experienced!
My Netscape browser is setup with the following MIME type:
Description: MPEG2 Video
Mime Type: video/x-mpeg2
Suffixes: mpv2,mp2v
Application: /usr/bin/nc2vlc %s
The "nc2vlc" script looks like:
Code:
It's really just a clean-up wrapper for /usr/bin/nc2vlc.doit, which looks like:
Code:
Putting netcat in a "while" loop keeps it alive (it sometimes needs to start twice before latching onto the listening netcat on the TiVo) while the "while" loop around vlc starts it back up if it crashes (so you don't loose your place in the stream).
On the tivo side, there's a script to kill mplex and netcat and ExtractStream, and start it working on another tyStream.
Code:
In httpd.tcl, I've modified three routines: action_NowShowing, action_tystream, and session.
Code:
Session just got uglier... I removed the response to the browser when "action_tystream" is getting called:
[code]
proc session {chan addr port} {
set head_req 0
while {[gets $chan line] >= 0} {
if {$line == "\r"} break
if {$line == ""} break
if {[regexp -nocase {^get +(.*) +http/[0-9]+\.[0-9]+.?$} $line dummy path] == 1} {
continue
}
if {[regexp -nocase {^head +(.*) +http/[0-9]+\.[0-9]+.?$} $line dummy path] == 1} {
set head_req 1
continue
}
}
if {$path == ""} {
close $chan
return
}
if {[regexp {^/([-_A-Za-z0-9]*)(.*)} $path dummy action part] == 1} {
if {[info procs "action_$action"] == "action_$action"} {
if {$action != "tystream"} {
puts $chan "HTTP/1.0 200 OK\r"
puts $chan [format "Date: %s GMT\r" [clock format [clock seconds] -format "%a, %d %b %Y %T" -gmt true]]
puts $chan "Connection: close\r"
puts $chan "Content-Type: text/html; charset=iso-8859-1\r"
puts $chan "\r"
if {$head_req == 1} {
close $chan
return
}
action_ $chan $part
}
} else {
puts $chan "HTTP/1.0 200 OK\r"
puts $chan [format "Date: %s GMT\r" [clock format [clock seconds] -format "%a, %d %b %Y %T" -gmt true]]
puts $chan "Connection: close\r"
puts $chan "Content-Type: text/html; charset=iso-8859-1\r"
puts $chan "\r"
if {$head_req == 1} {
close $chan
return
}
action_ $chan ""
}
close $chan
}
[/code]
Make sure the scripts are marked executible, and there are some hard-coded paths in their you might want to change to match your system.
httpd.tcl >/dev/null 2>/dev/null &
With this, you'll want to start httpd.tcl to pipe both stderr and stdout to /dev/null... although, as an initial test you might want to run it from the command line and see what's coming out of stderr and stdout.
Now, when you select from the nowshowing list, it returns it's IP address, which is sent (via a file) as an argument to /usr/bin/nc2vlc. "nc2vlc" cleans up (kills) all running nc's, vlc's, and nc2vlc.doit's, then calls nc2vlc.doit; which pipes a netcat into vlc. Simultaneously, on the TiVo, /hack/bin/doehtml is called with the tyStream FSID's of the program. This starts up ExtractStream, mplex, and netcat on the TiVo, killing any running mplex/nc's first.
I've left some comments in doehtml and httpd.tcl for Windows. This should help Windows users get started (Nick Hull posted the other day concerning how WMP would want to recieve data via an html interface). Note that I've seen folks need to recompile netcat on the windows side, rather than use pre-compiled binaries, and the "-w" ooption in windows often fouls up the connection between netcats.
Note that I've switched sides of who's the listener and who's the receiver. It doesn't really matter, but the listener usually doesn't exit, while the other side usually exits if the listener exits. Worst case, wrap netcat in a while loop (like it is in nc2vlc.doit); switch the sides of the sender/listener if necessary.
RSS
View unverified member's comment - posted by topset