Edit DVR-MS Metadata


I was asked earlier this week if I knew of any tools that would let one easily edit the metadata associated with a DVR-MS file.  Specifically, the person wanted to edit the title and description of a recorded show.  There may very well be such a tool out there, but I’d never seen one, so I threw one together:



This tool is a pretty simple wrapper around the code from my Fun with DVR-MS article, specifically the DvrmsMetadataEditor class.  It loads the metadata into a DataGrid, let’s you edit existing metadata or add new metadata (doesn’t let you delete right now), and then saves any additions or modifications back to the target file.  Kind of handy, so I’ve made it available for download.  I hope you find it useful.  Of course, if it ends up destroying your DVR-MS files, blowing up your computer, or something bad like that, I take no responsibility. 🙂


-Steve

EditDvrmsMetadata.zip

Comments (84)

  1. Zig Fowler says:

    Is there a way, with command line options, to specify the amount of compression. A 2.5 GB DVR-MS File is compressed to about 70 MB. This generates a poor quality WMV. Can this be changed?

  2. toub says:

    Sure, just specify a Windows Media Profile (.prx) as the second arg on the command line and that profile will be used instead of the poor-quality default. You can easily create profiles using the Windows Media Profile Editor that’s included with the Windows Media Encoder, available for free on the Microsoft site.

    -Steve

  3. gwalters says:

    Tried using your program on a few files to change the Title Name field. This doesn’t seem to work. The name is changed in the wrapper, but for some reason MCE still shows the old title…do I have to do something in MCE to refresh the file wrappers on recorded TV?

  4. toub says:

    Tim Moore reports a possible solution to your problem at http://thegreenbutton.com/community/shwmessage.aspx?forumid=26&messageid=109007, though I haven’t tried this to see if it works. It has nothing to do with the metadata being stored correctly in the DVR-MS file… what the editor shows is what’s there. Whether MCE uses a cached version of the data from somewhere else is a different story.

  5. thaurgon says:

    Is there anyway I can change protected DVR-MS files that WMC has created so they can be burned to DVD through SONIC?

  6. toub says:

    I don’t believe so.

  7. toomuchwin32 says:

    The download URL for the metadata editor does not work. Is it no longer available for download?

  8. Stephen Toub says:

    Hmmm, I didn’t take it down, and I’m able to access it now. It’s possible there was a blip in network connectivity to the server or something like that. Try again, and please let me know if you’re still having trouble.

  9. toomuchwin32 says:

    Looks like winisp.net was down for a while. It is up now and my download worked. Stephen, I am a Windows internals programmer (working on both usermode and kernelmode stuff), have done a lot of reverse engineering and poking under the hood. So I really appreciated your using SetWindowsHookEx when the existing MCE framework did not give you enough control (just something that I would have done – that or intercepted some API 🙂 ). I also appreciated the abundance of comments in the code (if only all other MSDN samples were so well documented 🙁 ). I am itching to mess around with my new Media Center and create add-ins to solve everyday problems I have. Your article and sample code was a GREAT starting point. Thanks for that.

    By the way, I am looking for a programmatic way to control the IR emitter that my MCE PC uses to control my Dish Network satellite receiver (I want to be able to emit more than just Channel Up- Down and numbers). This is probably outside the scope of the MCE framework itself and I might have to write code to talk to the IR emitter myself. Or maybe MCE does have something for this. I know, I can read the MSDN Media Center SDK reference, but if can you point me in the right direction that would be hugely helpful.

  10. toub says:

    Glad you’ve found the articles useful! I’ve never tried to do what you’re doing with the IR emitter, so unfortunately I don’t have an answer for you. I’d suggest posting your question on one of the Media Center forums at http://www.thegreenbutton.com; hopefully someone there can help you out more. Best of luck, Stephen

  11. Zig Folwer says:

    Hello,

    Let me start buy stating that I think this is a great program. I only have one problem with it. When I have the finished product and copy it to a DVD, it will not play on a stand alone player. When I try to convert it to an avi so it will. It will not let me. I don’t care about the container, I just want it to play on the player. Is there anything you can do to help, maybe some coding. Thanks in advance.

  12. Phred says:

    I have a dvr-ms related question I haven’t been able to find an answer to. Is it possible to insert "chapter" markers into dvr-ms files? What I have in mind is something like the chapters you can set up when you’re burning a DVD.

    Would I use something like the SetMarker method in the WM API? Does the DVR-MS API have a similar call (if so, what)? Finally, would MCE honor those chapter marks and allow me to navigate around using them?

    Thanks, Phred

  13. toub says:

    While there may be a way to set and access chapter-like markers, I’ve never tried, and I don’t know of any way you could get MCE to make use of them even if you could. My suggestion to you would be to check out my position changer add-in, which lets you jump around in a DVR-MS file while viewing it by entering time codes on the remote control’s number pad; it also lets you set bookmarks in videos so that you can later jump to them.

    http://msdn.microsoft.com/library/en-us/dnxpmce/html/positionchangeraddin.asp

  14. Me says:

    Nice util!

    Why is it that Media Center does not show program detail from a wmv file containing all the medata copied from a dvr-ms file.

    dvr-ms metadata looks great in Media Center. Movies for example.

    Am I not copying all the data to my WMV?

  15. Zig Fowler says:

    I have a file that I recorded using media center. The "Is_Protected" and "Is_Trusted" fields are both FALSE. The "WM/WMRVContentProtected" is FALSE and "WM/WMRVContentProtectedPercent" is 0. I still cannot view this in WMP10. It plays just fine in Media Center. It is acting like a protected file but it isn’t protected. Any thoughts? I have a screenshot of the DVR-MS Metadata if that would be helpful.

  16. Zig Fowler says:

    Also, when I mouse over the file, amongst other things like type, title, duration, it displays Protected: No. Again, any thoughts would be helpful, or am I missing something when trying to detect protected vs. non-protected dvr-ms files.

  17. gio says:

    hi you can find a very good site to edit dvr ms files here:

    http://powercompress.reviewsdotcom.com

  18. PtD says:

    I don’t have any problem in editing the DVR-MS files with your very handy utility, but when I go to burn them to a DVD Media Center gets to about 1% complete and then doesn’t go any further. Any ideas?

  19. toub says:

    Glad you like the editing utility. If I remember correctly, this was a known issue with Sonic’s DVD burning solution, but I unfortunately don’t know if Sonic has resolved the problem in any fashion or published a workaround. You might be able to find more information over on thegreenbutton.com. Good luck.

  20. mabudon says:

    Does anyone know of an application that allows you to edit the commercials (or anything else for that matter) out of dvr-ms files?

  21. toub says:

    Several tools are available. I wrote a DVR-MS editor which you can download from my article at http://msdn.microsoft.com/library/en-us/dnxpmce/html/dvr-ms.asp. Scroll to the bottom of the article for a discussion of the tool’s implementation, in the section titled "Editing DVR-MS Files". The source is available, too, if you want to tweak it.

  22. Julius says:

    Dear Stephen,

    I like the articles that you wrote on DVR-MS-files a lot and it inspires me to have some more fun. I wonder, do you have the source-code of the EditDvrmsMetadata.exe available, so I can use it for further exploration? Thanks in advance.

    Julius

  23. toub says:

    EditDvrmsMetadata is just a simple wrapper around around the DvrmsMetadata class, which is available with the article source code.  The app simply retrieves all of the metadata and dumps it into a grid; when you go to save it back, it just retrieves the changed rows and again uses DvrmsMetadata to write back the changed values to the DVR-MS file.

  24. Very useful.  At last I can see the metadata on non Media Center PC’s.

  25. Chad says:

    Nice app, great for what it does. What I was looking for was a little app or script to dump the Metadata for all my dvr-ms files into a CSV so I can import them into excel.

    I didn’t see an "extract" only in the code and I am not dev enough to try.

    Any suggestions?

  26. toub says:

    Using the same library that EditDvrmsMetadata relies on, you can implement this very easily with code like the following (this would be a command-line app that assumes the path to the dvr-ms file is the first arg and that the path to the CSV file to be created is the second):

    using(DvrmsMetadataEditor editor = new DvrmsMetadataEditor(args[0]))

    using(StreamWriter writer = new StreamWriter(args[1]))

    {

      IDictionary meta = editor.GetAttributes();

      foreach(string name in meta.Keys)

      {

           writer.WriteLine(name + ", " + MetadataEditor.GetMetadataItemAsString(meta, name));

      }

    }

  27. Chad says:

    Excellent, Thank you .. now If I can only find a compiler I am set. 🙂 I was hoping for a VBScript. :-p

    What do I need to compile this into a command line tool? I am a dabbler to VBscript but then only for Exchange 2003 … But I can learn, or test one for you. 🙂

  28. toub says:

    I compiled it into a tool I’ve called DumpDvrmsMetadata and posted it to http://toub.members.winisp.net/code/DumpDvrmsMetadata.zip.  Standard disclaimers apply: this is completely untested and unsupported, and if it blows up your computer, it’s not my fault. Etc.  The tool accepts the path to the dvr-ms file as the first argument, and it writes the metadata to stdout.

    As far as getting a compiler, you should download Visual C# 2005 Express Edition: http://msdn.microsoft.com/vstudio/express/

  29. Chad says:

    🙂 Thank you, I downloaded both VP & C# with the SQL SP1 and a few of the web tools. Past time I sharpened the blade … pun intended.

    I will test the little app and give feedback.

    Thanks again,

    Chad

  30. Jason says:

    What would really be useful is a tool that would do this all from the command line (no GUI).

    Basically take a DVR-MS file as argument #1, the Metadata parameter to edit as #2, and the new value as parameter #3. Or something similar.

    That way you could populate DVR-MS meta data via script.

    This would be very useful for users that convert MPEG (or other format) to DVR-MS for use in Media Center.

  31. Danny says:

    Does anyone know if you can copy a TV show off of a DVR receiver somehow and then convert it to an MP$ or windows media player file that you could load on your PC?

  32. John Ericson says:

    A command line program that can read, add and change Metadata in dvr-ms, wmv, wma and asf files already exists.

    Try MetadataEdit.exe that is a sample program that comes with Windows Media Format SDK 9.5.

    I think it will do what you want Jason.

  33. Jeremy says:

    Can anyone give me some pointers as to how to use this to rename dvr-ms files based on the metadata – ie, i want the filename to be <title>:<subtitle>:<genre>.dvr-ms but I’m struggling with C# at the moment and am unable to extract the necessary info from a file to then rename.

  34. Joe says:

    I like the tool but it is not working.  I moved the file out of the recorded tv directory and edited the meta data.   After saving I move the file back but MCE does not show the change in the text field.   I’ve also used the suggestions in the posts to kill ehrec and ehschedule witout success.

    Is there another way to force MCE to pickup the meta data changes?

    Where is recordings.xml?

  35. Stephen Toub says:

    The tool does accomplish its purpose, which is simply to allow the retrieval and modification of the metadata in the DVR-MS file.  I’ve never tried getting MCE to report the modified data, as that was never my goal for the tool, though it might be possible, and others might have been successful in getting it to work for that purpose.

    Recordings.xml on my machine is in C:Documents and SettingsAll UsersApplication DataMicrosofteHomeRecordings.

    Hope that helps.

  36. S Dodd says:

    All very interesting.  I have a Sony PC running Media Centre 2004 with Sony’s Click-to-DVD software.  I can load any size recording, edit out commercials, break the program into multi-parts if it’s huge and won’t fit nicely on one DVD, burn the DVD, and watch it through just about any DVD player. Now we have a new HP Media Centre 2005 computer which came with the Sonic software.  The remote control CD/DVD creator will, with a couple of clicks, directly move a DVR-MS file onto a DVD (no editing).  But the Sonic MYDVD software pre-installed on this computer doesn’t work at all and HP has no solution.  Sonic won’t take support calls on pre-installed software and their website doesn’t really allow for determining whether they have a viable solution.  However, comments on multiple forum sites say not.  I’m going to investigate whether the Sony Click-to-DVD software is available for installation on the HP computer.  Otherwise, I’ll have to see if I can find a way to use tool listed on this blog. 15gb files are what I’m working with.

  37. Aaron says:

    Stupendous work Stephen! Thanks for making this available. I’ve created two command line utilities that your readers may find useful. One will extract the tags for a set of DVR-MS files to XML format, the other will rename files based on a user-configured format string using the metadata as input. The tools are very basic since my needs were pretty simple, but they get the job done. The source code is also available.

    http://www.spicypixel.com/xwiki/bin/view/DvrmsTools/WebHome

  38. toub says:

    Cool.  Thanks for putting those tools together.

  39. Dave says:

    Neat tool.  Has anyone figured out which data needs to be edited to get the various recordings of a show to all appear in the same "sort by title " heading?  Or I am I mistaken in the assumption that the correction can be made in the Metadata?

  40. Hi, I need your help. Is there any way I can capture single frames from dvr-ms files and save them as jpg or bmp images? Thanks

  41. toub says:

    I’m assuming you mean programmatically?  Sure.  There are multiple ways this can be done.  The easiest I’ve found is using WPF, with code similar to that at http://thewpfblog.com/?p=30 used to extract whatever frame you want from the video.  You can then use WPF’s support for saving images to save it out to whatever format you desire.

  42. Troy says:

    What if you want the little picture icon that is associated with a DVR-MS file?  I have a dvr-ms file that I edited then I saved it with what I thought was all the metadata but the icon is not there.  Is there a tool that will copy the icon from one dvr-ms file to another?

  43. toub says:

    I wrote a tool that will do it, but I haven’t found the time yet to clean it up.  As soon as I do, hopefully soon, I’ll post it.

  44. Tom Jeffery says:

    Has anyone figured out which data needs to be edited to get the various recordings of a show to all appear in the same "sort by title " heading?  Or I am I mistaken in the assumption that the correction can be made in the Metadata? i.e like when a series is recorded?

  45. Larry Pierce says:

    I believe the Metadata field that controls the way titles are grouped in Media Center is "WM/WMRVRequestID".  Also, if you make a change to the Metadata title or other fields and those changes are not shown in Media Center, try changing field "WM/WMRVScheduleItemID".  These fields are used in the file called "Recordings.xml" to save information about your recordings.  This is also the file where your series settings are stored.

  46. charles says:

    I’m trying to find the MetaDataEdit.exe file in Windows Media Format SDK 9.5.  However the current  version seems to be 9.00.00.2980 and doesn’t include the MetaDataEdit.exe needed.

    How do I find 9.5?

  47. charles says:

    Hey Stephen,

    I was wondering if I can ask you a few questions regarding metadata in dvr-ms files.

    I am working on deleting commercials out of dvr-ms files so I can keep them on my computer and save space.

    What I notice when i use a program called dvrcut is it loses the metadata tags.  And without this it causes a lot of trouble since I can’t in any detail what I recorded for the episode.

    Would you know how I could pass the data to dvrcut (i have the source it’s also available on the internet) so it would be included when the dvr-ms file is cut and reattached with the frames adjusted to remove the commercials?

    Thank you for your help,

    Charles

  48. toub says:

    Charles, sure.  You can just use the DvrmsMetadataEditor class to read the metadata from the first file and write it to the second.  If you look in the sample code from the Fun with DVR-MS article, you’ll see that several of the apps do this; for example, the DvrmsEditor app that splices together pieces from other DVR-MS files takes the metadata from the first file and writes it onto the output file after it’s been created.

  49. charles says:

    Thank you.  I will check in to this now.  However, I am not affluent in programming as I once was.

    Thank you,

    Charles

  50. Jim says:

    Is there a listing anywhere of all of the metadata tags, possible values of each and what the tags do?

    I’m having a real hard time finding any information about the individual tags.  I ran across a list once but I can’t seem to find it again.

    Thanks

    Jim

  51. grindersguide says:

    Stephen,

    One thing that I noticed is missing from media center is the ability to sort recorded TV shows by the original air date.  It seems like it would be possible to do this with the metadata by setting the recorded date to the original air date.  Have you heard of anything that’s been created to do this?  If not, do you take suggestions for future projects? 😉

  52. toub says:

    To do that as a simple console app you run every now and then (easily scheduled through Task Scheduler to run periodically) should be very straightforward.  You just loop through every .dvr-ms file and copy its WM/MediaOriginalBroadcastDateTime attribute (if it has one) to its WM/WMRVEncodeTime attribute.  The only tricky part is that WMRVEncodeTime is a QWORD representing the equivalent FILETIME, so you’ll need to convert from a string format like "2004-02-12T00:00:00Z" to a FILETIME value like 633086190017940000.

    Another option is to build in MCML an app that displays all recorded shows within MCE in order by their original recording date.  That would be a bit more work, but you could make a very nice app out of it, and it wouldn’t require any file modifications to the .dvr-ms files.

    -Stephen

  53. silverkings12 says:

    Have you had a chance to post the program for inserting the icon into a dvr-ms?

  54. idbirch says:

    Is there anyway I can edit the duration field?  Some DVR-MS files output by VideoReDo have incorrect durations and I’d like to be able to change these.  I’m currently playing around with a hex editor but is there an easier way?

  55. idbirch says:

    Is there anyway I can edit the duration field?  Some DVR-MS files output by VideoReDo have incorrect durations and I’d like to be able to change these.  I’m currently playing around with a hex editor but is there an easier way?

  56. Thomas Schmidt says:

    Hi Stephen,

    the link to your fun article in MSDN is not working anymore. Can post a current link please.

    Thanks,

    Thomas

  57. toub says:

    The article was unfortunately accidentally taken down.  I’ve been trying to get it back up, and I’ll post when it’s available again.

  58. Bill Martin says:

    where can I get it? I don’t see any download link.

  59. Kprigge says:

    Stephen,

      I am no programmer by any stretch.  I was sent the link for your Metadata edit program from VideoReDo (very good program by the way).  I am on MCE200.  Is your program really for the computer savee? or is it safe for me to run it.  I take your "blow up the computer" comment seriously.

    -Karl

  60. Kprigge says:

    Stephen,

      I tried out your program and it seemed to work well, but now the "balloon" that pops up when you mouse over a dvr-ms file no longer shows all the information it used to.  Just the file type and size.  Is there some default setting somewhere that defines what is displayed?  Thanks.

    -Karl

  61. Tim says:

    Is it possible to add parental control values to dvr-ms (that are unrated)? I have tried editing WM/ParentalRating but I am unsure if this is the correct entry to use or what values are acceptable. (have tried PG-14, PG-MA), but vista media center still plays the files (despite it being configured not to play anything over TV-G without a pin)

  62. BermudaLamb says:

    The app looks pretty straightforward.  Any idea how to get an image (like a dvd cover) to show up in the Media Center?

  63. BermudaLamb says:

    Can the application be enhanced?  Specifically, can it be modified so that the columns are dropdown comboxes, allowing text entry, but also offering suggested values?

    Would it also be possible to have it be able to import a dvdid.xml file?

  64. BermudaLamb says:

    I’ve written my own mini application to extract the information from a dvr-ms file.  Any idea how to get the type of the metadata element.  Your Editor shows three columns name, value, and type.  From your examples I’ve been able to figure out the name and value components but where can I get the type?

  65. Dana says:

    One thing to pay attention to, Vista users, is the file’s permission settings. Make sure that all users have full rights to the file (Right click/Properties/Security/…)

  66. Any change it would be possible to use the new format .wtv files with this utility?

    At the moment it doesn’t recognize the files.

    kind regards,

    .Nico

  67. http://www.dvr-msconverter.com can help you converte DVR-ms to avi, mpeg, wmv, mp4, mpg, etc.

  68. Vics says:

    Now that Vista can deal quite easy with Metadata, no software is needed to change any properties of DVR-MS files, just right click on it, choose properties and go to the Details tab, there you will find a very big list of things you can change, i.e. Title, Subtitle, Episode Name, Artits, Year, TV Network, Channel Number, Station call Sign, Program Description, Rerun, HDTV content, directors, producers, writers, parental rating and on …

  69. DVR MS Converter is good for me to slove the problem

  70. DVR MS Converter is good for me to slove the problem

  71. Rilesman says:

    Is it possible to add metadata fields, for example season number and episode number?  I assume the type would still be a string

  72. Rohan says:

    Hi there,

    Not sure if anyone is still monitoring this forum, but I am simply trying to get a different name to appear for my files in VMC – at the moment they are all there as "Manual Recording". I have tried editing any field that looks like it could be title using your utility and/or the file properties in Vista but to no avail. Any ideas? Thanks Rohan

  73. rasd says:

    [b][url=http://www.movie-mac.com/…/how-to-import-tod-to-imovie-on-mac.html]Mac TOD to iMovie Converter[/url][/b] is perfect solution for you to import TOD to iMovie on Mac. It provides you a simple way to convert TOD to iMovie. Beside, with this TOD to iMovie Converter, converting TOD to other video formats like MP4, WMV, AVI, FLV etc is also allowed. With TOD to iMovie Converter, [b][url=http://www.movie-mac.com/…/how-to-import-tod-to-imovie-on-mac.html]import TOD to iMovie[/url][/b] is not a difficult problem any more.

  74. Rich says:

    Is this tool still around? I can't seem to find an active link.