1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

TiVo-VideoReDo-AutoProcessor Program

Discussion in 'TiVo Home Media Features & TiVoToGo' started by dlfl, Jul 19, 2007.

  1. Jul 29, 2007 #21 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Dan,

    I've modified TVAP to output dvr-ms files but I'm seeing a strange problem:

    If I do:

    TiVo -> QSF -> dvr-ms
    (or)
    TiVo->AdScan w/ autocuts->dvr-ms

    the output files seem OK.

    However if I do

    TiVo->QSF->dvr-ms->AdScan w/autocuts->dvr-ms

    The output file is bad -- over twice the size it should be, won't open in WMP11, and won't play when opened in VRD.

    Is this known behavior? I can work around it by just forcing the intermediate file (the QSF'ed one) to be mpeg instead of dvr-ms when doing both QSF and AdScan. The output file seems OK then.

    I've only tested with one 40 MB tivo for which AdScan doesn't define any cuts. That untypical file could be triggering odd behavior I suppose.
     
  2. Jul 29, 2007 #22 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    Try the same steps with VRD manually. If they still happen then report them over on the VRD forum. (these things are DanR's area not mine)

    Dan
     
  3. Jul 29, 2007 #23 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    TVAP will now output DVR-MS files. MetaData transfer is still on the TO DO list.

    The problem with QSF+AdScan w/ AutoCut for DVR-MS output was resolved.
     
  4. Jul 31, 2007 #24 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    I got the Toub dvr-ms class library connected to TVAP and displayed the 32 metadata items it found in a .dvr-ms created from a .tivo with VRD -- see the attached image.

    Titlle and description aren't there -- I assume this is what we want to get from TivoDecode and add in with the Toub library (?). What else?

    I wonder if adding metadata requires a re-write of the whole file? In other words does the added metadata make the file longer or does it already have space allocated for metadata growth?
     
  5. Jul 31, 2007 #25 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    Editing metadata in a DVR-MS file is simple. There is a COM interface you use to open the file, then you just set the various values. Getting the values from a .tivo file is a little trickier, but the latest version of tivodecode has this functionality. The cLI version of tivodecode has it implemented in such a way that it simply dumps the XML data from the .tivo file to disk. I rewrote the code in an MFC app and pulled the XML into a simple CString. When I get time I'll try to port that over to, at the very least, a simple ActiveX control that allows you to call a a function with the .tivo file path and get a BSTR with the XML in return. From there you can feed the XML into MSXML, parse the data you want, and copy it into the DVR-MS file.

    If I have enough time I'll try to do all the heavy lifting and write a function that allows you to feed it the path of the .tivo file and the DVR-MS and the ActiveX will do all the work of copying over the data. I'm a little busy this week, and I'm going out of town this weekend, so it'll probably be next week before I have time to actually do any of this. Stay tuned.

    Dan
     
  6. Jul 31, 2007 #26 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Thanks, Dan

    Yes, the Toub DVR-MS class library (managed .NET dll assembly) provides a wrapper for the COM interface. I've got the processes of reading metadata, adding more metadata and writing it back to the file going fine using this library. Happy to see it doesn't change file size and is very fast because it doesn't have to re-write the entire file (tested on 1 GB+ file).

    All I'm missing now is getting the metadata from the .TiVo file.
     
  7. Aug 7, 2007 #27 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    Here is the ActiveX control I promised....

    http://www.3wdesigns.net/TiVoMetaDecode.zip

    I didn't have a lot of time to add all the fancy XML parsing, so you'll have to do that yourself. This ActiveX control has two functions GetMetaData and GetMetaData2, both of which take a single parameter which is the path to the TiVo file. The reason there are two is because each TiVo file has two chunks of meta data. The second, accessed via the 2 function, has a little more data in it but I'm not sure if it's necessary for what you're doing or not.

    Anyway let me know if you have any trouble with it.

    Dan
     
  8. Aug 7, 2007 #28 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Thanks Dan!

    I got it hooked into my C# program and it seems to work. However the string returned doesn't make sense, at least put into the standard C# string type which is 16-bit unicode. I tried to assign the function return to a byte array but it won't compile because the functions definitely return type "string". I suspect I need to convert to UTF-8 or something like that. What can you tell me about the structure of the returned strings, i.e., one byte per character or ?

    When interpreted as 16bit unicode it looks like hieroglyphics! I think if I know the actual encoding type it will be easy to re-encode it. Then I can get on with the XML parsing.
     
  9. Aug 7, 2007 #29 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    It's a multi-byte string, not unicode. Try using the multiByteToWideChar function if you need to convert it to unicode.

    Dan
     
  10. Aug 8, 2007 #30 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Well, I've spent several hours trying to "crack" this string (i.e., get something that looks like xml).
    The multiByteToWideChar function exists only in C++ land but I've tried all kinds of combinations of UTF encoders and decoders. No matter what I do I see almost all byte values are either greater than 127 or 0, i.e., outside the normal ASCII range.

    The string object returned is only 336 unicode chars long while the xml chunk for the same .tivo file produced by TivoDecode is about 7kb. I don't see how that much info could be in such a small string (??).

    The prototype for the ocx functions as imported by C# says they return "string" type objects which are unicode by definition.
     
  11. Aug 8, 2007 #31 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    I don't know how C# works, but in C++ you have the option of compiling the entire project as either multi-byte or unicode. Do you have such an option? If so try turning it over to multi-byte mode and see what happens.

    Other then that I'm stumped. I tested it in the MS ActiveX test container and it properly grabs the XML string, so something is happening when you're pulling it into your C# project.

    Dan
     
  12. Aug 8, 2007 #32 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Dan,

    Any chance you could do a version of your .ocx that returns UniCode strings? I've searched a lot and can't find anything to help here.
     
  13. Aug 8, 2007 #33 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    Crap I know what's wrong! It has nothing to do with unicode/multi-byte. I have my MAK hard coded into the ocx. Your MAK obviously doesn't match, so you're getting a trashed response. I'm fixing it now and will post a new version in a few minutes.

    Dan
     
  14. Aug 8, 2007 #34 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    OK I uploaded a new version. This one now takes two arguments for each function. The file path and the MAK.

    Dan
     
  15. Aug 8, 2007 #35 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Hmmm... I wiped the first .ocx from my system (unregistered it) and removed it from my C# project, then put in the new version making sure it was the only .ocx of that name. Registered it and hooked to my program -- all went as before.

    Only problem is the functions still only take one argument (??). This shows in the prototypes that automatically show up as "hints" and they will only compile if I just pass one string argument.

    I downloaded from the same link you gave before. Also did a binary file comparison of the two .ocx versions and they are different.
     
  16. Aug 9, 2007 #36 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    There may be something in your C# project. In C++ when you import an ActiveX control it creates a header file with prototype functions for what's in the control. From then on if you make any changes to the ActiveX control you have to remove all references to it and delete the header file before it will recreate it with the new prototype functions.

    Alternative you can simply find the prototype functions and update them manually. The structure of the functions are exactly the same except they now take one more string argument.

    Dan
     
  17. Aug 9, 2007 #37 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    You are correct -- I created a new test C# project on another computer and hooked in your control -- and the prototypes are correct now. So there is something from the old .ocx still stuck in my project even though I hunted down everything I could think of and removed it.

    I removed the control from the new test project and I notice there are still two .dll files with "TivoMetaDecode" as part of their names and a file named "<project name>.csproj.ResolveComReference.cache" in the bin\debug directory. I assume C# created these automatically because I know they didn't come from your download and I know I didn't create them. I suspect these must be deleted before hooking in the new .ocx version. No suspicious header files are to be found but I think C# just stores the info a different way.

    It will be a few hours before I can apply this knowledge to the TVAP project since I'm at a different location at the moment.
     
  18. Aug 9, 2007 #38 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Dan, your TivoMetaData component works great! I have all the pieces demonstrated now to get metadata from TiVo files and put it in DVR-MS files.

    I'm planning on the items discussed in the VRD help for the panel on "MCE/DVR-MS Output". If you or anyone else has any suggestions on what other items should be included, just let me know.

    I'll also need to have the program ask for the MAK upon initial startup then save it in its XML configuration file. (I don't see the MAK in the registry anywhere -- if anyone knows where to get it let me know.)

    Thanks!
     
  19. Aug 10, 2007 #39 of 418
    Dan203

    Dan203 Super Moderator Staff Member TCF Club

    37,512
    180
    Apr 17, 2000
    Nevada
    The MAK in the registry is encrypted, so you'll need to collect it yourself.

    I'm glad it's working out. I look forward to trying it out once you get it working. :)

    Dan
     
  20. Aug 15, 2007 #40 of 418
    dlfl

    dlfl Cranky old novice

    6,998
    18
    Jul 6, 2006
    Near...
    Two major enhancements:

    1. Reads metadata from TiVo files. (Title, Subtitle, Description, Genre and Recording Time/Date for now.) You can see it by right-clicking on a file name and it is automatically inserted into DVR-MS output files.

    2. Comes in a Windows installer package now.

    Thanks to Dan203 for the ActiveX component (TivoMetaDecode.ocx) that reads the metadata from the TiVo files.

    Note: The metadata is read when the tivo file is initially detected by TVAP and is stored in its XML file. This means the XML format changed and your previous XML files will be invalid so TVAP will force a cold startup where you have to set your default options and destination directories. It will also ask you to enter your MAK since that is needed to read the TiVo metadata. (See readme for more details.)
    The MAK is also stored in the XML file which is another reason your current XML file is invalid and a cold start is needed (sorry!)

    ftp://upload:upload@videoredo.net/VRD Add-Ons/TiVo-VideoReDo-AutoProcessor/
     

Share This Page