PDA

View Full Version : VLC module to play TY files



tx413
01-19-2005, 05:18 PM
Like the title says, I've recently started work again on a module for VLC (the VideoLan client -- see the VLC website (http://www.videolan.org) ).

For now, it works very well for my Series 1 DTivo, both MPEG and AC3 audio. It will probably work with Series 1 stand alone, but I don't have any of those or any other streams, so I can't test them.

I've attached the windows binary (it's a DLL -- put it in your VLC modules directory). It was compiled to work with VLC version 0.8.2.

For playing, I just use "vlc filename.ty". I don't have any vserver integration going yet, so for now it just plays extracted files. Having it connect to your tivo where vserver is running is not far off, though... Also, I haven't done too much testing with VLC's transcoding or streaming, but some of it does work.

It's a work in progress, but will be limited to S1 DTivo unless I can get some other streams to test with.

The source, after some cleanup, will be made available through the VLC project (see website above). I'm trying to get it integrated as an official module in the project.

To give proper code credit, I started with Chris Wingert's mplayer port and went from there.

blueman2
01-20-2005, 02:46 AM
Gave it a try on a S2 DTivo .ty stream just for the heck of it. No joy, of course. Great project, however. I much prefer VLC to other viewers. Keep it up! If you want access to some S2 DTivo .ty streams, let me know and I will host some for you.

mcomer
01-20-2005, 11:12 AM
I also congratulate you, and would be willing to help out. I can host some S2 DTivo streams for you if you need them.

This will be very usefull when finished for those of us that prefer VLC to other players. Good work.

-Matt

tx413
01-20-2005, 12:02 PM
Yes I'd be very interested in some S2 DTivo streams, and any others. I'd like at least 10 minutes of data, if possible. Usually that's around 150 MB. And as many different formats that S2 supports (mpeg & ac3? anything else?).

Shouldn't be too hard to get S2 working. The hardest part was trying to figure out what the VLC codecs needed in order to decode the a/v and keep them in sync. The TY stream format has been well documented for years.

maxx
01-22-2005, 04:49 PM
I also can provide S2 from my Sony SVR-3000 .tivo files as well as host them on my secure server (via dedicated T1). Please PM me if I can be of help.

maxx

tx413
01-29-2005, 06:45 PM
It was brought to my attention that the DLL I posted won't work with the current "official" release of VLC, which is 0.8.1. So I've attached one here.

It works exactly like the previous one; no code changes. That is, S1 DTivo only. I also made a few tests using it to stream, and it worked as well as any other streaming I've done in VLC. (With so many streaming settings, it's hard sometimes to find the "magic" combination in VLC that works well -- at least that's my experience; maybe I just don't know what I'm doing. :) )

dgi
02-10-2005, 01:44 AM
<moron-mode>I downloaded the file in the last post and found that it contains no source code. What are VLC users without Windows supposed to do with it?</moron-mode>

tx413
02-11-2005, 11:58 AM
DGI,

As I said in my earlier post, I'm not ready to release the source. So the only way it's going to run on a non-windows platform is if you help me compile a version for that platform. What specific environment are you interested in?

I have access to lots of Intel hardware, so hopefully that's what you're running.

dgi
02-11-2005, 01:21 PM
What you said was that the source will be part of the VLC project; you didn't say in your first post the current status of it. I have VLC running under Mac OS X. I'd be willing to compile a binary of the current source, or when you add support for .tmf files, whichever you prefer. I just hope I won't have to recompile all of VLC to do it. Have you received any feedback on whether it works with SA TiVo streams? (Because that's what I have…)

stealthdave
02-16-2005, 07:27 PM
DGI,

As I said in my earlier post, I'm not ready to release the source. So the only way it's going to run on a non-windows platform is if you help me compile a version for that platform. What specific environment are you interested in?

I have access to lots of Intel hardware, so hopefully that's what you're running.
I would like to request an x86 Linux module. I can definitely help compile new modules, for Linux and Mac. Also, I'm still willing to mail you a CD or two of S1 stand-alone TiVo streams for debugging purposes. These streams cause serious issues with the current module. Just send a mailing address via PM and I'll send it out next day.

Thanks

tx413
02-17-2005, 11:46 AM
Okay, so in order to compile the source for this module, you *MUST* have the entire VLC source / dev environment set up and be able to compile it.

Why? Because there are macros and #include files in my source that come from the VLC source. And the Makefile is generated by the VLC configuration setup. There are many compiler and linker settings that get set there. I suppose I could have hard-coded them into my own makefile, but why do that when the VLC config does it for you?

So stealthdave, if you can get VLC development environments going for Mac OSX and maybe some Linux x86 variant, I can get you the source. As soon as it works for S1 SA & DTivo on x86 & Macs, I'll post the source here. Check your PM for an address to send some S1 SA streams to.

stealthdave
02-17-2005, 09:29 PM
I got the source code from tx413 and compiled modules for both x86 Linux and Mac OS X. The Linux module was compiled on an Athlon XP system running VidaLinux 1.1 (Gentoo-based), but it should work on any i686 or better system. The Mac OS X module was built on a 700MHz G3 iBook running 10.3.8 (Panther) using Fink, but it should work with the standard VLC.app bundle of VLC.

INSTRUCTIONS:
For Linux, decompress the module and copy it to /usr/lib/vlc/demux (or /usr/local/lib/vlc/demux if you compiled from source).

For Mac OS X, you'll need to copy the module to the modules folder inside VLC.app. Decompress the module and, from the command-line, copy it to VLC.app/Contents/MacOS/modules.

Thanks again to tx413 for all his hard work!

- Stealth Dave

Edit - These modules are for version 0.8.1 of VLC, which is the most current stable release.

MacHack
02-18-2005, 11:32 PM
I tried stealthdave's MacOS X .dylib.
10.3.8, + VLC 0.8.1, - fink, + libtydemux_plugin.dylib.bz2.
It doesn't seem to have any effect with it installed or not installed.
Is there any indicator as to whether the module properly loaded or not? It doesn't show up in the Preferences dialog. Are there debug messages that indicate the demuxer is at work?
I'm willing to help debug this further. I'd really like to play streams directly off my tivo using mfs_stream+tivoweb. :-)

Thanks!
MacHack

tx413
02-19-2005, 01:23 PM
Well, without having a Mac I can't test it myself, but...

The .bz2 extension means it's compressed. You decompressed it, right? I'm not sure what tools do this on a Mac.

Also, on the VLC main menu, there should be an option View->Messages to see the debug messages (at least it's there in the windows gui). From there you should be able to see debug messages about what it's doing. VLC tries to find a valid demux & codec to play the file you gave it. When the ty demuxer gets its turn, you should see a message "Valid TY stream detected" or "TY module discarded (header mismatch)". If you don't see one of those messages, then the module isn't loaded.

The module should be in the same dir as the other .dylib modules. If all of this is correct, then I'm out of suggestions. Hopefully stealthdave can help.

MacHack
02-19-2005, 01:45 PM
The file is in the right place.
I'm a software developer who writes device drivers and frequently ports software between platforms. I know what I'm doing. :-)

Just as you said, I saw this message when I tried to play back a file from my Series 1 TiVo.
"tydemux warning: TY module discarded (header mismatch)"
I'm thinking there's probably an endian issue here.
Print out what you expect and what it actually contained. I'm sure it's endian reversed.


Well, without having a Mac I can't test it myself, but...

The .bz2 extension means it's compressed. You decompressed it, right? I'm not sure what tools do this on a Mac.

Also, on the VLC main menu, there should be an option View->Messages to see the debug messages (at least it's there in the windows gui). From there you should be able to see debug messages about what it's doing. VLC tries to find a valid demux & codec to play the file you gave it. When the ty demuxer gets its turn, you should see a message "Valid TY stream detected" or "TY module discarded (header mismatch)". If you don't see one of those messages, then the module isn't loaded.

The module should be in the same dir as the other .dylib modules. If all of this is correct, then I'm out of suggestions. Hopefully stealthdave can help.

stealthdave
02-19-2005, 06:10 PM
While I don't have a G4/G5 to test it on, I can tell you that the module is loading on my G3 iBook, it's just not working very well. :) MacHack is probably right; some kind of endian issue or even just binary incompatibility due to the build environment of the G3. Here's the error output that I was able to capture. (See attached file; apparently the forum doesn't like 10k posts. :cool: )

I actually have to stop playback or eventually VLC will crash, and I'm unable to capture any error messages. You'll probably be able to see some of these errors yourself when the CDs that I mailed you arrive. :)

- Stealth Dave

stealthdave
02-23-2005, 11:05 PM
tx413 has been working hard on S1 standalone support! Here are the new modules (one at a time), starting with OS X. The new module no longer crashes when playing S1 streams, and keeps excellent sync. There's an occaisional jittering, but it's minor and tx413 is working on it.

Attached is the OS X module. MacHack, let me know if this works better for you. My dev environment hasn't changed, but maybe the new changes will resolve the issues you were having.

- Stealth Dave

Edit - Linux module now attached

dgi
02-24-2005, 01:07 AM
Well, I tried this new version, and it plays .ty files from my Stand-Alone S1 perfectly (no jitter or anything). However, the "Subtitle Track" option in VLC remains disabled, whereas tivo-mplayer has an option to display captions. This plugin still won't play .tmf files properly, though.

MacHack
02-24-2005, 08:01 AM
I've got a few S1 .ty files that now play. But I still have a few that fail:
they playback with lots of mpeg artifacts (too much being chopped out?) and they have no audio. I'm not sure what recording quality I did them at, but I do recall that some of these were recorded with different TiVo recording settings.


tx413 has been working hard on S1 standalone support! Here are the new modules (one at a time), starting with OS X. The new module no longer crashes when playing S1 streams, and keeps excellent sync. There's an occaisional jittering, but it's minor and tx413 is working on it.

Attached is the OS X module. MacHack, let me know if this works better for you. My dev environment hasn't changed, but maybe the new changes will resolve the issues you were having.

- Stealth Dave

Edit - Linux module now attached

tx413
02-24-2005, 10:21 AM
dgi: Ah yes, subtitles / cc displays. I just never got around to that. It shouldn't take too long; I parse out the CC stream, I'm just not passing it on to the player.

MacHack: If there's any way you can get me a copy of a stream that has artifacts, I could probably fix it. Without something to work with, though, it's impossible. From what I understand, Series 1 SA units have only MPEG audio, right? So I'm not sure why the audio isn't playing unless it's just not parsing the ty file properly and there's a sync issue. VLC won't play any audio if the sync is too far off.

tx413
02-24-2005, 02:47 PM
MacHack:
Of the streams you sent, the first one (step-cr.ty) worked perfectly on my latest build. The others failed; they were not recognized by the TY demux module.

The reason they weren't recognized is that they didn't have the TY PART header as the first chunk. It has as its first 4 bytes: F5 46 7A BD and that's what I look for to make sure it's a valid TY file. Your streams start off immediately with the TY data. Not sure what you used to extract them, but the extract process left off the part header.

So here's what I'll do. VLC has a command-line option to specify which demuxer to use. I'll change the code so that if you specify 'tydemux' on the command line, even though the file doesn't look like a TY file, it'll try to demux it anyway. That should make it read those files.

On another note I've fixed the slight jitter that was present in last night's version (VLC is wonderful to work with; those guys did a great job).

Also, it looks like VLC doesn't support Closed Captions type of subtitles yet. It only supports the full-sentence subtitles like you get in dvd's and separate .srt files. CC are sent as part of the stream (like teletext). The tydemux code is all ready for them whenever VLC supports it. It will only be a 1- or 2-line change to the source.

As soon as I get the command-line force option in, I'll post a new version (with help from stealthdave :)). If it's stable and nobody has any problems the next day or two, I'll call this version 1.0 and post the source.

After that, there's S2 support and maybe .tmf support.

-neal

MacHack
02-24-2005, 04:54 PM
The .ty streams came from mfs_stream, http://tivo:2000/blah.
I'd appreciate it if you could attempt to match by the filename suffix... or add that as a Preference option. I'd prefer to not have to pass command line arguments to VLC under MacOS X.
You said you noticed that it starts off with TY data? Is it possible for you to identify a ".ty" file that starts this way as one that tydemux should handle?
In other words, could you be a little more tolerant of poorly formatted .ty files? Or is there something in the .ty header that you need to correctly demux the data? It'd be very cool if these media detection features were configurable in a Preference panel.

Thanks a lot! I'm looking forward to trying out the next version!
--MacHack


MacHack:
Of the streams you sent, the first one (step-cr.ty) worked perfectly on my latest build. The others failed; they were not recognized by the TY demux module.

The reason they weren't recognized is that they didn't have the TY PART header as the first chunk. It has as its first 4 bytes: F5 46 7A BD and that's what I look for to make sure it's a valid TY file. Your streams start off immediately with the TY data. Not sure what you used to extract them, but the extract process left off the part header.

So here's what I'll do. VLC has a command-line option to specify which demuxer to use. I'll change the code so that if you specify 'tydemux' on the command line, even though the file doesn't look like a TY file, it'll try to demux it anyway. That should make it read those files.

-neal

tx413
02-24-2005, 09:14 PM
Here's the latest windows binary. It now supports all Series 1 Tivos .ty format files that I have (with some caveats). Also, I took MacHack's suggestion and if the filename ends in .ty, it will try to process the file even if the header doesn't look right.

NOTE: Unfortunately this binary will only work with VLC version 0.8.2. My development environment is set up for the latest version, and is not compatible with the older 0.8.1 source. So if you're not using 0.8.2 yet, you can download one of the daily builds here: http://vthr.via.ecp.fr/~videolan/

MacHack, there are some issues with 3 of those streams you sent me; they have a slight video jerking (or jitter or whatever you call it). The problem is somewhere in the video data, because I used TyTool to convert them to MPEG and when played on VLC (as MPEG) they still had the jerky video. However, one of the 3 mux choices in TyTool ("split mux files" -- why are there 3 and what's the diff?) actually produced a file that played smooth. So I guess jdiner is modifying the video data. I'll continue to look at these, but more samples would help.

StealthDave, the latest source is in the usual place whenever you can get around to producing new binaries. Thanks again for your help in that.

Edit: The issue with those 3 streams mentioned above has now been corrected.

MacHack
02-24-2005, 09:58 PM
Use tystudio to download a stream or two. I think the ones that fail to work correctly were ones downloaded using tystudio.
tystudio 0.5.0 for MacOS X can view and demux my bad streams.

--MacHack



Here's the latest windows binary. It now supports all Series 1 Tivos .ty format files that I have (with some caveats). Also, I took MacHack's suggestion and if the filename ends in .ty, it will try to process the file even if the header doesn't look right.

NOTE: Unfortunately this binary will only work with VLC version 0.8.2. My development environment is set up for the latest version, and is not compatible with the older 0.8.1 source. So if you're not using 0.8.2 yet, you can download one of the daily builds here: http://vthr.via.ecp.fr/~videolan/

MacHack, there are some issues with 3 of those streams you sent me; they have a slight video jerking (or jitter or whatever you call it). The problem is somewhere in the video data, because I used TyTool to convert them to MPEG and when played on VLC (as MPEG) they still had the jerky video. However, one of the 3 mux choices in TyTool ("split mux files" -- why are there 3 and what's the diff?) actually produced a file that played smooth. So I guess jdiner is modifying the video data. I'll continue to look at these, but more samples would help.

StealthDave, the latest source is in the usual place whenever you can get around to producing new binaries. Thanks again for your help in that.

DonovansBrain
02-25-2005, 09:45 AM
Here's the latest windows binary. It now supports all Series 1 Tivos .ty format files that I have (with some caveats). Also, I took MacHack's suggestion and if the filename ends in .ty, it will try to process the file even if the header doesn't look right.


I've tried the Windows plugin using today's (25th) VLC nightly on a UK .ty (Series 1 obviously) and I get no audio and blocky/jerky video playback :(

Do you want me to send you a UK .ty stream? I have one here at work (and therefore on a very fast connection), but it's 2.8GB :-).

Can I split it using TyTool? If so, how. Basically, what do you want format- and size-wise to test with?

I can get a smaller stream extracted with mfs_ftp over the weekend if you like.

Paul

tx413
02-25-2005, 01:27 PM
New update (to be found in previous post) which fixes an issue with some TY files which have bad GOP header packets in the stream. Not sure how these bad packets get produced, but they're taken care of now. MacHack, that was the issue with your test streams. Thanks for the larger ones.

And just when I thought I was finished with Series 1.... :)
DonovansBrain: Please check that the module is getting loaded. Look at the "messages" output from VLC and make sure there's mention of "TY module". What you describe is what happens if you play a TY file on a plain VLC. Their mpeg demux / decoder is good enough to almost play the video, but the audio doesn't get parsed out. If it's loaded, then there's something in UK streams I need to deal with.

Yes, UK test streams would be great. I'm a little wary of 2.6Gb file sizes; something from 15-250 Mb would be great. PM me with details when you can.

I updated the file located in the message 3 posts back.

stealthdave
02-25-2005, 05:53 PM
Get 'em while they're hot! New ty modules for VLC on Mac OS X and Linux! Please note that unlike Neal's module, these only work with 0.8.1, which is the latest stable release. (We have slightly different build environments set up.)

- Stealth Dave

MacHack
02-25-2005, 09:04 PM
When I attempt to play a stream directly off my tivo via tivoweb/mfs_stream, I get:

tydemux warning: TY plugin discarded (stream unseekable)

Is seeking really necessary when you're just throwing out all the TiVo TY headers? :-) This occurs with the latest build from StealthDave.

--MacHack

DonovansBrain
02-26-2005, 08:50 AM
I'm not sure what happened when I tried the plugin at work, but trying StealthDave's last plugin for 0.8.1 on OS X at home seems to work fine.

tx413 - I'll PM you with details on how to get hold of a UK stream I've uploaded.

tx413
02-26-2005, 11:49 AM
There's no real requirement that the stream be "seekable." An older version of the code did lots more probing around the stream before it started playing, and the requirement was necessary then.

I can easily remove that requirement, but allow sliding the seek bar if the stream is capable of seeking.

neal

MacHack
02-26-2005, 01:38 PM
I already can seek around using the slide bar. So far, VLC crashed only once when I was jumping around quite a bit. Crashed in:

Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000010
Thread 6 Crashed:
0 org.videolan.vlc 0x00013310 EsOutSend + 0x54 (crt.c:300)
1 libtydemux_plugin.dylib 0x00f8da80 TyDemux + 0x884 (ty.c:579)
2 org.videolan.vlc 0x000155c4 Run + 0xe8 (crt.c:300)
3 libSystem.B.dylib 0x900246e8 _pthread_body + 0x28

The requires-seek requirement you're marking the module with is preventing streaming playback.
If you open a file and choose the "Treat as a pipe rather than a file" option, this simulates a web streamed file.
You can also try out streaming mode (which is close to web streaming) if you specify a URI to vlc.
vlc stream:///path/to/tyfiles/XYZ.ty
If you make tydemux work with stream://, http:// and others should work without much more effort.

--MacHack


There's no real requirement that the stream be "seekable." An older version of the code did lots more probing around the stream before it started playing, and the requirement was necessary then.

I can easily remove that requirement, but allow sliding the seek bar if the stream is capable of seeking.

neal

tx413
02-26-2005, 06:08 PM
Wow, cool. I've never used the mfs_stream / tivoweb combination before. But after the "seekable not required" modification, the module works great with mfs_stream! I like it, and there's some interesting possibilities for those who use mfs_stream.

I started VLC and selected "open network stream" and typed in this long and complicated URI:

http://tivo:2000/903954243/.2F.var.2F.hack%20-s%2012345%2012346/showname.ty

and it played perfectly. The details of that URI are the mfs_stream parameters.

If I just click on the link in tivoweb/mfsstream, however, it tries to download the entire file before playing it. I'm sure there's a way to fix that. Like modify the URI or MIME type so that it passes the entire URI off to VLC (which is the proper thing to do). Or maybe install the VLC browser plugin.

So I guess we now have another web-enabled tivo streaming solution. There's a few out there already, right?

MacHack: The crash info you posted says it crashed inside VLC after the tydemux module sent VLC some strange audio data. Not sure why it would crash, and I can't replicate that problem. If you can consistently reproduce it, I'd be very interested in getting a copy of that stream so I can fix the error.

So here's the latest binary DLL for VLC/windows v0.8.2, and, as promised, the source code for those of you who can compile your own. I'm working on getting the source included as a part of VLC, so if you make any useful modifications, please let me know.

Until I can get some Series 2 streams to work on, the next project is to get my old vstream module working again for VLC. That allowed streaming straight from the Tivo, but used the vstream program on the tivo side instead of mfs_stream or tivoweb.

neal

P.S. Guess I should probably continue this thread in the normal Extraction / Streaming forum, instead of here in the development forum.

Edit: NOTE: The pre-compiled windows version for VLC 0.8.2 will ONLY work with VLC nightly build 20050226 available here: http://vthr.via.ecp.fr/~videolan/ . This is due to VLC version checks; the build date is encoded in the version number for nightly builds and only modules that match it will get loaded.

stealthdave
02-26-2005, 07:27 PM
New OS X / Linux modules! These use the latest source posted by Neal.

One suggestion for Neal. Perhaps it's time to implement some sort of versioning system? I've posted 3 separate modules so far, with no discernable way to tell them apart. A version number would also go a long way when you start fielding more bug reports. :)

tx413
02-26-2005, 07:49 PM
Stealthdave: I actually do have version numbers, but I suppose they're not published. The latest is 1.0.2. It's in the source, just not in the filename.

iamchris
03-08-2005, 10:24 PM
...not knowing anything about VLC modules, but I have to ask...

what's the chance y'all could build this module for PocketPC (ARM) ?

It'd be worth a try...

CG

tx413
03-10-2005, 02:37 PM
Wow I didn't know VLC could be compiled for the ARM processor. But no, I don't have any facilities to build the module for the pocket pc / ARM.

Do you really have a pocket pc that can hold 100's of megabytes worth of a TY file? Or is it external storage?

iamchris
03-10-2005, 11:26 PM
Indeed, I have VLC for my Dell Axim, and it looks like it has the right hooks for plugins.

I'm mostly interested in streaming from vserver, but there are people who use those compactflash microdrives to hold a few gigs of video.

I've had limited success with streaming a transcoded video, but the transcoder crashes, and there's no seeking support.

Ty support is the way to go.

If I got you basic info for a cross-compile, could you give it a whirl?




Wow I didn't know VLC could be compiled for the ARM processor. But no, I don't have any facilities to build the module for the pocket pc / ARM.

Do you really have a pocket pc that can hold 100's of megabytes worth of a TY file? Or is it external storage?

tx413
03-10-2005, 11:39 PM
If there's a gcc cross-compiler for ARM that will work under cygwin then I can do it. Otherwise I'm not so certain. The VLC build environment is not very forgiving when you start changing things. It uses many many libraries and not all of the latest versions work, and there's other issues.

So what do you mean by "basic info for cross-compile" anyway?

dgi
03-11-2005, 01:05 AM
Here's the info. (http://developers.videolan.org/cgi-bin/viewcvs.cgi/trunk/INSTALL.wince?rev=9999&view=markup) Looks like a job for stealthdave.