PDA

View Full Version : Extracting streams with VLC



stealthdave
04-07-2005, 07:30 PM
Now that we have some fantastic ty and vstream modules for VLC (thanks, Neal!), we can now use vlc to give us an mpeg fit for DVD, VCD and SVCD use!

To convert a ty stream from the tivo via vstream, first download and install (http://dealdatabase.com/forum/showthread.php?t=42332) the ty and vstream modules for vlc on your platform. (Currently Win32, Mac OS X, and Linux x86 binaries are available, as well as source code.) Next, open a command prompt use the following command:

$ vlc -I rc tivo://tivo/123456 ':sout=#transcode{acodec=mpga,ab=224,samplerate=48000}:std{access=file,mux=ps,url=stream.mpg}' vlc:quit
The #transcode part is the key. This example will give you a nice, standard mpeg-II audio track at 224kbps and a DVD-friendly 48kHz sample rate. For (S)VCD, you'll want to change that to ab=192,samplerate=44100. Want a nice AC3 stream? No problem! Use {acodec=a52,ab=384,samplerate=48000}. If you don't want to do any transcoding, just use 'sout:std{access=file...}'.

To break it down:

the "-I rc" tells vlc to use the "remote control" interface, but really all we want to do is not start the gui.
tivo://tivo/123456 is the link to the stream you want to convert. If you don't have vstream, you can load a ty file (your_program.ty) or possibly even use an mfs_ftp link as well (ftp://tivo:3105/ty/123456.ty for example; this is untested).
The "sout:#..." line tells vlc what to do with the stream, and it's important to keep this line in quotes.

transcode tells vlc how to convert the audio (or video if desired)
std (or 'standard') tells vlc what to do with the stream, in this case save it to a file

"vlc:quit" tells vlc to, well, quit. :)

You can even do full transcoding by specifying a video codec, ala vcodec=xvid,vb=800 (don't forget to change the muxer, too). This will obviously take a lot more processor time, though, whereas just transcoding the audio is pretty easy stuff for most pcs. For more transcoding options, check out http://www.videolan.org.

Note for Mac OS X users: To use vlc from the command-line, you need to use the file that is burried within VLC.app. If you have VLC in your main Applications folder, your command-line will look like this:


$ /Applications/VLC.app/Contents/MacOS/VLC -I rc test.ty ':sout=#transcode{acodec=mpga,ab=224,samplerate=48000}:std{access=file,mux=ps,url=stream.mpg}' vlc:quit

Now you can extract and convert streams to mpeg on the Mac! Thanks to tx413 for not only creating the necessary vlc modules, but also the idea to use vlc for converting the streams to standard mpegs with transcoded audio. My next project will be to create a java-based gui so that you can point-and-click extract your programs on any platform supporting Java and VLC.

- Stealth Dave

lgkahn
04-08-2005, 10:55 AM
the first one didn't seem to work for me.. at least I couldn't find the file stream.mpg anywhere on my disk. Maybe you have to let it finish all the way.. also this seems impractical becuase it opens a player window and converts at actual speed so it will take forever to convert a movie this way.

tx413
04-08-2005, 12:45 PM
the first one didn't seem to work for me.. at least I couldn't find the file stream.mpg anywhere on my disk. Maybe you have to let it finish all the way.. also this seems impractical becuase it opens a player window and converts at actual speed so it will take forever to convert a movie this way.If it opens a player window, then something's not right on the command line. It should NOT open a player window, and the file should be produced quickly. My transcodes go anywhere from 10x to 60x the speed of the program, depending on what I'm doing.

On windows, try using double-quotes around that big argument instead of single-quotes.

Of course all of this can be done via the GUI if you like, but if you use the command line, it's easier to work it all into some sort of batch scripting. I think stealthdave's working on something in that direction.

lgkahn
04-08-2005, 02:51 PM
ok I changed single to double quotes
now it start up.. creates an empty file and then crashes.. below is my crash log.

here is the current batch file:

D:\vlc>cat bs.bat
vlc -I rc tivo://tivo1/187343 ":sout=#transcode{acodec=mpga,ab=224,samplerate=48
000}:std{access=file,mux=ps,url=godfatheriii.mpg}" vlc:quit

D:\vlc>

tx413
04-08-2005, 05:49 PM
ok I changed single to double quotes
now it start up.. creates an empty file and then crashes.. below is my crash log.It's easier to tell what VLC was doing from one of its own log files. Can you add this into the command line
-vvv --extraintf=logger
before your "tivo" argument. It will generate a vlc-log.txt file. Send me that.

stealthdave
04-08-2005, 07:23 PM
ok I changed single to double quotes
now it start up.. creates an empty file and then crashes.. below is my crash log.

here is the current batch file:

D:\vlc>cat bs.bat
vlc -I rc tivo://tivo1/187343 ":sout=#transcode{acodec=mpga,ab=224,samplerate=48
000}:std{access=file,mux=ps,url=godfatheriii.mpg}" vlc:quit

D:\vlc>So, I guess you're using Windows then? :)

Okay, first, have you verified that you have vserver (http://tivo-mplayer.sf.net) installed on your TiVo and that it's running properly? You can verify whether or not it's running by telnetting to your tivo and running "ps x | grep vserver".

Once you've verified that vserver is running, can you play the stream from the gui? Try that, and also try running vlc with -vv as tx413 suggested.

lgkahn
04-08-2005, 07:49 PM
yes as I mentioned previously vserver works and I can do plist and play streams fine.. I will attach the logging info later tonight and post

lgkahn
04-09-2005, 12:42 AM
I figured out what was wrong your post is wrong on post 1 of this thread..
it is missing the /ty

the command should be this:

start /wait vlc -I rc tivo/ty://tivo1/187343 ":sout=#transcode{acodec=mpga,ab=224,samplerate=48000}:std{access=file,mux=ps,url=godfatheriii.mpg}" vlc:quit

not

start /wait vlc -I rc tivo//tivo1/187343 ":sout=#transcode{acodec=mpga,ab=224,samplerate=48000}:std{access=file,mux=ps,url=godfatheriii.mpg}" vlc:quit

then it works fine

lgkahn
04-09-2005, 12:52 AM
spoke too soon.. now it gets farther but freezes after a certain point 58 meg done ,with my godfather iii stream and just consumes close to 100% of the cpu here is the log

tx413
04-11-2005, 10:05 PM
spoke too soon.. now it gets farther but freezes after a certain point 58 meg done ,with my godfather iii stream and just consumes close to 100% of the cpu here is the logThe log looks good; can't tell what makes it lock up. It could be the vstream or the demux. Can you extract the program using another tool and see if VLC will play / transcode the TY file?

Sorry I can't give you any other help. If it's the stream, and I could take a look at it, I could fix that.

94SupraTT
04-12-2005, 05:43 PM
$ vlc -I rc tivo://tivo/123456 ':sout=#transcode{acodec=mpga,ab=224,samplerate=48000}:std{access=file,mux=ps,url=stream.mpg}' vlc:quit

That works on my SD-DVR40 running 4.0.1b to my XP Pro box but it locks up around 17mins when encoding. It actually locks up my PC and I have to reboot. The video is encoded up to 17mins but thats all I can do. Also the only way I can get this to run is within VLC.

lgkahn
04-12-2005, 07:46 PM
ok will pull the stream off using mfs_ftp

lgkahn
04-13-2005, 11:54 PM
same problem with stream on local disc so it must be the demuxer..
here is the last part of the log..
same as when on tivo notice the short PES there must be a problem in the
error handling for that case..

you want to look at it or you want me to post the stream on an ftp server somewhere .. it is 2.6 gig


[00000269] ty demuxer debug: parsing ty chunk #428
[00000269] ty demuxer debug: parsing ty chunk #429
[00000269] ty demuxer debug: parsing ty chunk #430
[00000269] ty demuxer debug: parsing ty chunk #431
[00000269] ty demuxer debug: parsing ty chunk #432
[00000269] ty demuxer debug: parsing ty chunk #433
[00000269] ty demuxer debug: parsing ty chunk #434
[00000269] ty demuxer debug: parsing ty chunk #435
[00000269] ty demuxer debug: parsing ty chunk #436
[00000269] ty demuxer debug: parsing ty chunk #437
[00000269] ty demuxer debug: parsing ty chunk #438
[00000269] ty demuxer debug: parsing ty chunk #439
[00000269] ty demuxer debug: parsing ty chunk #440
[00000269] ty demuxer debug: parsing ty chunk #441
[00000269] ty demuxer debug: parsing ty chunk #442
[00000269] ty demuxer debug: parsing ty chunk #443
[00000269] ty demuxer debug: video rec type 0x0b has short PES
[00000269] ty demuxer debug: parsing ty chunk #444

konfoo
04-14-2005, 12:30 PM
Same as mine. Well, close. Reproducable every time.

Output:
[00000250] ty demuxer debug: parsing ty chunk #254
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: parsing ty chunk #255
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: Invalid record type 0x20
[00000250] ty demuxer debug: video rec type 0x0b has short PES
Segmentation fault

konfoo
04-14-2005, 12:46 PM
I looked at the ty demux source and it appears that p_block_in is being freed @ line 514 but reused @ 548, causing the segfault. I may be mistaken since I've spent about 2 minutes looking at the source. ;)

Edit see here for a fix:
http://www.dealdatabase.com/forum/showthread.php?p=219936#post219936

tx413
04-14-2005, 11:18 PM
I looked at the ty demux source and it appears that p_block_in is being freed @ line 514 but reused @ 548, causing the segfault. I may be mistaken since I've spent about 2 minutes looking at the source. ;)Good catch, konfoo. Definitely a bug there. Your fix works, but could cause a little jump in the sync at that b-frame. I'll make a proper fix and post new binaries Friday I hope. This should solve Igkahn's problem.