The FINAL answer on PTV Live, video duration, and NFO files
#1
I just wanted to post this thread real quick to help anyone with the issues I have faced with PTVL in the past.  As many are aware, there are some users that have issues with tv shows not starting at the right times, durations being incorrect, and the question of what role NFO files play within PTVL and how this information is used to generate channel lineups and accurate guide data.

I have seen many conversations where people have argued as to whether or not the information in your NFO files will affect the way PTVL operates.  I can tell you without a shadow of a doubt that it does.  If your NFO data is incorrect, Kodi will use this incorrect data within it's own media library.  Remember that PTVL can only use the information that it is given.  Just like any computer program if you put in garbage, you will get garbage back.

I initially tackled this issue when trying to incorporate music videos into my channel lineup, using a custom playlist and only local content.  One thing I noticed is every time I switched to a music video channel, it was almost completely random as to where it would land.  Many times I would change channels and see a video that played hours ago, playing again.  The same thing went for tv shows, although the music videos were more of a problem.

Some background:  I imported my music videos using a plugin called justusethefilename, which meant that the videos were being imported with next to no data whatsoever. 

Digging into the NFO file structure there are two sections that carry runtime for a video.  The first is runtime, which is recorded using minutes.  So a movie that is one hour long will show 60 under this tag.  The second tag is durationinseconds.  The question is, which one does Kodi pay attention to?  The answer is both, sort of.  

To experiment I modified all of my NFO files on my music videos and added an approximate runtime tag in minutes, at this point I did not add the durationinseconds.  I already knew this would not be the best option since music videos are typically only a few minutes long, and since the runtime tag uses minutes, I had to approximate and basically round up or down.  This improved my music video channels, but I still noticed issues where the timing was off.

I then went through again and added the durationinseconds tag, entering in the exact duration of each music video in seconds.  After rebuilding the music video channels they played absolutely perfectly.

After some time, I did notice that all of a sudden, one of my music video channels started acting up.  Every time I would exit the plugin and go back in, it would start on the same exact video, from the beginning every time.  I even went into the settings2.xml file and modified the channel time, at times increasing it substantially, only to have the exact same thing take place.

So I inspected the NFO file of the music video that played just before the current one and noticed that I made a mistake and entered a really long duration for this video.  Is what this means is, PTVL thought that this video was hours long instead of only a few minutes.  So starting up when PTVL would calculate where in the schedule it needed to be, it always landed on the very next video due to the excessive duration.

Keep in mind, I never cleared out the runtime tag from my music videos, yet adding the durationinseconds tag fixed my music video channels.  It was at this point that I realized that Kodi uses the runtime tag initially, but if the durationinseconds tag has a value, it will use that instead.  This means that in my opinion, we should all be focused on durationinseconds, seeing that it is more accurate.  

In PTVL more accurate = better channel experience.

Now before anyone starts arguing, I literally confirmed my findings by actually going into the PTVL code and inspecting the values as it was processing a channel, and I was able to literally see the EXACT duration in PTVL matched my durationinseconds listed in my NFO files.  So although I have seen people argue about this, you can go ahead and bury that argument.

So here is what I suggest that anyone who has had any issues do.  Download an amazing app called TinyMediaManager.  This great tool is Java based and runs on pretty much anything.  I have never seen a tool that is so flexible and powerful in my life.  It uses several services for scraping including Imdb, tvdb, moviedb, etc.  It has the ability to scrape your library automatically or to give you the ability to confirm results on searches that don't find an accurate result (instead of it just being scraped in as the wrong show).

Now just a note!  Initially when you import your library and scrape, TinyMediaManager is going to download all of the metadata and images and place all of this data into nicely formatted NFO files automatically.  Initially, these NFO files will be populated with the regular "runtime" tag, which is derived from the scraped data.  

At some point when you are importing your library, it will say at the bottom of the window "Getting MediaInfo".  Now I will admit that at first I didn't know what this was doing, and I was constantly clicking the cancel button because it seemed to take such a long time.  At first I thought it was something I didn't really need, seeing that I had already imported and scraped my library. 

Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.  PTVL could not be any closer to actual real tv.  Channel changing and timing is so accurate I was even able to verify it with a stopwatch, making sure programs were resuming right where they should.  

Sadly they do not have the option to add music videos to TinyMediaManager, so I had to write up a quick VB.NET app to basically scan my music video folder, analyze each file, and create dummy NFO files.  

I'm surprised that there is not an app that already does this.  I know there are scrapers for music videos, but I have never seen any of them properly fill in durationinseconds.

Maybe I should make one.
Reply
#2
MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.
Reply
#3
(2019-09-20, 00:07)bornagainpengui Wrote: MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.

Seems that music videos just never really took off when it comes to Kodi, not enough demand I suppose.  Although just about every person I know loves to come over and having the experience of actual music video channels, unlike the MTV of today which has little to do with music at all anymore.

Such an app would not be that hard, so I think I will start playing around with it on my spare time.  The app I use right now doesn't do any scraping at all, it basically just figures out the duration and uses the filename for the title, but I would like to expand it to actually scrape all of the data AND put the proper duration in for a more seamless experience. There are services like the audiodb that are already used for scraping, we just need an app that puts it together AND generates that coveted durationinseconds tag for each video.  Then you could just import your videos using the generated NFO files, and you are virtually guaranteed no issues when using custom playlists consisting of music videos.
Reply
#4
(2019-09-20, 01:02)soundman1611 Wrote:
(2019-09-20, 00:07)bornagainpengui Wrote: MediaElch supports music videos in its concert section. Sadly you will need to enter the data manually for artist, album, etc but if you have the proper libraries installed it can pick up codec, duration, etc from the files. Getting music video scrapping to work is a herculean, thankless task so I understand the lack of support for it.

Seems that music videos just never really took off when it comes to Kodi, not enough demand I suppose.  Although just about every person I know loves to come over and having the experience of actual music video channels, unlike the MTV of today which has little to do with music at all anymore.

Such an app would not be that hard, so I think I will start playing around with it on my spare time.  The app I use right now doesn't do any scraping at all, it basically just figures out the duration and uses the filename for the title, but I would like to expand it to actually scrape all of the data AND put the proper duration in for a more seamless experience. There are services like the audiodb that are already used for scraping, we just need an app that puts it together AND generates that coveted durationinseconds tag for each video.  Then you could just import your videos using the generated NFO files, and you are virtually guaranteed no issues when using custom playlists consisting of music videos. 
This thread might be of interest to you too then. It scrapes according to the file name, so if your video is Artist - Name of Song.mp4 it'll grab the name and format accordingly.  It may be useful as part of something you might put together in addition to trying to scrape a database for an obscure song.
Reply
#5
(2019-09-19, 23:03)soundman1611 Wrote: Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.

Exporting the video library to separate files adds the runtime and durationinseconds to nfo files too - even music videos. There's no need to use an external program.
Reply
#6
(2019-09-21, 13:40)stubk Wrote:
(2019-09-19, 23:03)soundman1611 Wrote: Then I dug around and realized what TMM was really doing.  The "Getting MediaInfo" process is a very lengthy process, but one you want to wait for.  This is the process when TMM is actually analyzing every video file and inserting the video stream data into your NFO files.  This stream data includes the durationinseconds tag.  It takes forever though, but you only have to do it once.

After the whole process was completed, every single movie and tv show in my library all carry the durationinseconds tag.

Exporting the video library to separate files adds the runtime and durationinseconds to nfo files too - even music videos. There's no need to use an external program. 

I tried exactly what you are talking about and it did not work 100%.  I did a file search on my library folders searching for durationinseconds tags with a zero and literally hundreds if not thousands of episodes all had zero, after exporting my library to separate files, aka individual NFO files.  Yes, by what I have gathered Kodi does update these tags, but it seems that it only updates the tags after the video has actually been played.  I don't think Kodi is pulling media info of each video as it initially scans your library.  For the reason that doing so would probably make library scanning very slow if you are importing a lot of content, so it makes sense that it obtains this data when you play a file.  So yes, eventually Kodi would have updated all of these tags, but not before you have played every video in your library.
Reply
#7
Do you have the Mediainfo libraries installed?
Reply
#8
(2019-09-21, 19:06)bornagainpengui Wrote: Do you have the Mediainfo libraries installed?

I do, however, I still had issues.  I think that in regards to Kodi's programmers this is just not very important.  So far I have been using TinyMediaManager and I can say that I have 100% success without a single exception. I even confirmed this by writing a quick VB.NET app that actually scanned and read every single NFO file and brought any file with a 0 in DurationInSeconds to my attention, and there was none.  My PseudoTV Live experience is absolutely 100%.  It has gotten to a point where both my roommate and I have almost forgotten that it's not really live TV.  The experience is complete in my book and I love it.  PTV has become my default inside of Kodi.  Actually I even took the Python Example Screensaver and modified it to automatically load PTV when the screensaver is initiated.  So basically, PTV is the screensaver.  If you didn't know any better you would have no idea.  When you turn my TV on, it's automatically on TV and you can begin surfing channels.  TMM is great because it also gives me complete control over the media, and in the rare case where information is incorrect, I can go in manually and set it straight.

It's funny because it messes with people's heads.  When someone comes over that doesn't know any better they start flipping channels and they think something creepy is going on.  Because I have my Kodi setup attached to an old 80's console TV, and all of my shows are older, 70s and 80s.  Complete with classic MTV and VH1 channels, and I have a basic old school weather channel that pulls data using Weatherbit.IO as well.

Using Watchdog along with this just completes it.  I have a temporary folder that I drop new movies or TV shows into, then I use TMM to populate the NFO files, then I move them into the Kodi folders and Watchdog updates it automatically from there.
Reply
#9
(2020-01-08, 00:03)soundman1611 Wrote:
(2019-09-21, 19:06)bornagainpengui Wrote: Do you have the Mediainfo libraries installed?

I do, however, I still had issues.  I think that in regards to Kodi's programmers this is just not very important.  So far I have been using TinyMediaManager and I can say that I have 100% success without a single exception. I even confirmed this by writing a quick VB.NET app that actually scanned and read every single NFO file and brought any file with a 0 in DurationInSeconds to my attention, and there was none.  My PseudoTV Live experience is absolutely 100%.  It has gotten to a point where both my roommate and I have almost forgotten that it's not really live TV.  The experience is complete in my book and I love it.  PTV has become my default inside of Kodi.  Actually I even took the Python Example Screensaver and modified it to automatically load PTV when the screensaver is initiated.  So basically, PTV is the screensaver.  If you didn't know any better you would have no idea.  When you turn my TV on, it's automatically on TV and you can begin surfing channels.  TMM is great because it also gives me complete control over the media, and in the rare case where information is incorrect, I can go in manually and set it straight.

It's funny because it messes with people's heads.  When someone comes over that doesn't know any better they start flipping channels and they think something creepy is going on.  Because I have my Kodi setup attached to an old 80's console TV, and all of my shows are older, 70s and 80s.  Complete with classic MTV and VH1 channels, and I have a basic old school weather channel that pulls data using Weatherbit.IO as well.

Using Watchdog along with this just completes it.  I have a temporary folder that I drop new movies or TV shows into, then I use TMM to populate the NFO files, then I move them into the Kodi folders and Watchdog updates it automatically from there. 
If I may ask....what versions for PTVL and Kodi are you running to get these results. I have tried PTVL many times and could never get a satisfactory result eventually ending up using Steveb1968's version of PTV. Would like to give PTVL a shot again using what you've outlined here. Any information is greatly appreciated.

Thanks,
Mark
Reply
#10
I installed Tiny Media Manager and pointed it to my media folder. It seems like it's finished scraping since I see no indication that it's doing anything. I checked random episodes for a tv show and opened their .nfo files and they all have a runtime of 25. There is no entry for duration in seconds. If I go to the media files tab of TMM it shows the proper runtime of 22mins 51s for a particular episode. Don't know what i'm doing wrong?
Reply
#11
(2020-05-21, 03:10)gonzo90017 Wrote: I installed Tiny Media Manager and pointed it to my media folder. It seems like it's finished scraping since I see no indication that it's doing anything. I checked random episodes for a tv show and opened their .nfo files and they all have a runtime of 25. There is no entry for duration in seconds. If I go to the media files tab of TMM it shows the proper runtime of 22mins 51s for a particular episode. Don't know what i'm doing wrong?

It seems like it has now added the duration in seconds. The weird thing is that the runtime is still set to 25:
Quote:<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--created on 2020-05-20 18:03:24 - tinyMediaManager 3.1.5-->
<episodedetails>
  <title>Turtle Tracks</title>
  <originaltitle/>
  <showtitle>Teenage Mutant Ninja Turtles</showtitle>
  <season>1</season>
  <episode>1</episode>
  <displayseason>-1</displayseason>
  <displayepisode>-1</displayepisode>
  <id>148870</id>
  <uniqueid default="true" type="tvdb">148870</uniqueid>
  <rating>7.6</rating>
  <userrating>0.0</userrating>
  <votes>240</votes>
  <plot>April O'Neil, ace reporter for Channel 6, investigates recent break-ins, allegedly by Ninjas. Resulting in the thefts of numerous technologies, however, a chance encounter with a gang of thieves soon leads her to a bigger story when she is saved from the criminals by four mutant ninja turtles.
The Turtles take April back to their lair, and, after getting better acquainted, April learns they are good hearted mutants. They decide to investigate the thefts together and their efforts lead them into an encounter with the mysterious ninjas, The Foot Clan, and their leader, Shredder.</plot>
  <runtime>25</runtime>
  <thumb>https://artworks.thetvdb.com/banners/episodes/74582/148870.jpg</thumb>
  <mpaa/>
  <premiered>1987-12-10</premiered>
  <aired>1987-12-10</aired>
  <watched>false</watched>
  <playcount/>
  <studio>Syndication</studio>
  <credits>David Wise</credits>
  <credits>Patti Howeth</credits>
  <director>Yoshikatsu Kasai</director>
  <actor>
    <name>Cam Clarke</name>
    <role/>
    <thumb/>
    <profile/>
  </actor>
  <actor>
    <name>Jennifer Darling</name>
    <role/>
    <thumb/>
    <profile/>
  </actor>
  <actor>
    <name>Pat Fraley</name>
    <role/>
    <thumb/>
    <profile/>
  </actor>
  <trailer/>
  <dateadded>2016-03-29 09:04:22</dateadded>
  <fileinfo>
    <streamdetails>
      <video>
        <codec>h264</codec>
        <aspect>1.33</aspect>
        <width>708</width>
        <height>478</height>
        <durationinseconds>1371</durationinseconds>
        <stereomode/>
      </video>
      <audio>
        <codec>AAC</codec>
        <language/>
        <channels>2</channels>
      </audio>
    </streamdetails>
  </fileinfo>
  <!--tinyMediaManager meta data-->
  <source>UNKNOWN</source>
  <original_filename>1x01 - Turtle Tracks.m4v</original_filename>
  <user_note/>
</episodedetails>

Is this normal? Just hoping PTV uses the seconds instead of the runtime like you mentioned in your post.
Reply

Logout Mark Read Team Forum Stats Members Help
The FINAL answer on PTV Live, video duration, and NFO files1