in

andy vt's tools & blog

Automating lazy

Converting to WTV with XML metadata writes wrong duration

Last post 07-24-2010 9:45 AM by HD Junkie. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 03-17-2010 11:27 PM

    Converting to WTV with XML metadata writes wrong duration

    I just upgraded to 1.2.2.1 and converted a 41:56 mkv to wtv.  It worked great, but the duration on the file reads as 420 minutes.  That's off by a factor of 10.  The metadata file duration was 2517, and the wtv's metadata now reads 251700000000.  I compared that to another video of ~35 minutes, and its metadata reads 22167691440.  If I remove one 0 off of the 42 minute file everything is good.

  • 03-24-2010 10:34 AM In reply to

    • babgvant
    • Top 10 Contributor
    • Joined on 10-02-2006
    • Chicago, IL

    Re: Converting to WTV with XML metadata writes wrong duration

    Duration is a calculated/read-only field in SBE files, no idea why it's wrong.
  • 03-24-2010 11:30 AM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

    I've now seen it go wrong both ways -- higher by a factor of 10 as previously mentioned, and recording the seconds as defined in the sage metadata file rather than converting that to the "ticks" or whatever media center wants (looks like a 00:00 duration in MCE).  For now I'm working around it in my own script by grabbing the computed duration of the original file using mediainfo, multiplying that by 10^7, and then applying that back to the generated .wtv file using the metadata powershell scripts posted elsewhere on this forum.  Not really ideal for everybody, but since I'm writing powershell scripts to do all of my processing anyway it wasn't that much more difficult to do this at the end of my "mkv to wtv" script.

  • 03-24-2010 11:38 AM In reply to

    • babgvant
    • Top 10 Contributor
    • Joined on 10-02-2006
    • Chicago, IL

    Re: Converting to WTV with XML metadata writes wrong duration

    You're able to write the value? 
  • 03-24-2010 11:49 AM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

    Yes.  Duration is an editable metadata field, and I can write it manually using http://blogs.msdn.com/toub/archive/2005/05/12/416874.aspx or programmatically using http://babgvant.com/forums/t/760.aspx (modified to get the metadata classes from todvrmslib.dll).

    As background to understand what I'm doing:  I've written some scripts that will convert mpeg2/ac3 wtv files to h264/ac3 mkv using a variety of tools cobbled together to suit my own needs.

    • W7's built-in WTV to DVR-MS converter, since the WTV to MPG conversion in dvrmstb failed for me in 1.2.2.0 but worked fine for dvr-ms files (I should retry that with 1.2.2.1)
    • DVRMSToolbox to convert DVR-MS to MPG, since Handbrake doesn't like DVR-MS files
    • Handbrake to convert MPG to MKV, since it does a much better job encoding.  I had tons of quality/interlacing issues when trying to do this in dvrmstb so I stopped.

    In the process of converting dvr-ms to mpg, the sagetv metadata xml file is written.  Unfortunately I wasn't planning ahead, and I didn't save that metadata file for all of my prior conversions.  Thus now when I can successfully convert back from mkv to wtv, I have to try and get some metadata myself.  My mkv to wtv script will re-generate that metadata file if it doesn't exist, and todvrms does its thing with the metadata file, setting title, description, etc as available.  Everything works except the duration field, so I go back after creating the wtv file and re-write the duration value in the metadata.

    When I saw the off-by-10 error, I was converting using a metadata file created in step 2 above.  When I saw the "recorded seconds rather than seconds x 10^7" error I was using my own manually generated metadata file.  I haven't yet been able to create a metadata file that will get the duration right on the first try.

  • 03-26-2010 10:37 AM In reply to

    • babgvant
    • Top 10 Contributor
    • Joined on 10-02-2006
    • Chicago, IL

    Re: Converting to WTV with XML metadata writes wrong duration

    Interesting.  I'll have to take a look at that.  Thanks
  • 04-23-2010 9:35 PM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

    In the process of converting dvr-ms to mpg, the sagetv metadata xml file is written. Unfortunately I wasn't planning ahead, and I didn't save that metadata file for all of my prior conversions. Thus now when I can successfully convert back from mkv to wtv, I have to try and get some metadata myself. My mkv to wtv script will re-generate that metadata file if it doesn't exist, and todvrms does its thing with the metadata file, setting title, description, etc as available. Everything works except the duration field, so I go back after creating the wtv file and re-write the duration value in the metadata.
    mcitp and exam 70-630 notes as well more about 70-680 exam and mcp dumps

  • 05-03-2010 10:57 AM In reply to

    • babgvant
    • Top 10 Contributor
    • Joined on 10-02-2006
    • Chicago, IL

    Re: Converting to WTV with XML metadata writes wrong duration

    The next rev of todvrms will set the duration field for wtv files.
  • 07-22-2010 12:18 PM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

    babgvant:
    The next rev of todvrms will set the duration field for wtv files.
     

    This is exactly what I'm looking for as well, is there an ETA for the next version of todvrms?

  • 07-22-2010 12:58 PM In reply to

    • babgvant
    • Top 10 Contributor
    • Joined on 10-02-2006
    • Chicago, IL

    Re: Converting to WTV with XML metadata writes wrong duration

  • 07-22-2010 2:09 PM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

     I got good news and bad news.

    Good - the duration is set initially

    Bad - once you playback the file, and close out of MC, the duration gets set to 0

     

    Let me know if I did somehting wrong.

     

    thanks

  • 07-24-2010 9:45 AM In reply to

    Re: Converting to WTV with XML metadata writes wrong duration

    I wonder if it has something to do with the way 7MC gets metadata from the internet. Such as, the file is unrecognizable from its online database and therefore nulls out the data. Is the duration present when you check its properties?
Page 1 of 1 (12 items)
@2008 andy vt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems