Detecting a TV Show DVD vs a Movie DVD

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
iJoel
Enlightened
Posts: 124
Joined: Sat Dec 20, 2008 7:25 am

Detecting a TV Show DVD vs a Movie DVD

Post by iJoel »

Now, I'm coding TV Show support into my script/app.
& it is a little hard for me since ironically I only own like 3 TV Shows on DVD.

So I was wondering if I could get some input on my method to detect such DVDs.
You see, I'm already using an online database for DVD Title querying, and inasmuch
I can usually tell if a DVD inserted is a TV Show (as in the database it will specify the season & disc #
which means it's obviously a TV Show).

But when that database fails to tell me what the DVD is,
my script has to deduce what kind of DVD it is Music Video/TV Show/Movie/Concert/etc.
The movie portion is pretty straight forward, in that it chooses the longest title track and
then analyzes it to make sure it's right (checking the resolution/audio/subs for validity), but I'm starting
to implement the TV Show portion now and have coded it as follows.

Scan all the titles in the DVD, store the length of each title and compare them to one another
IF >3 titles are within 2 minutes of each other (ranging from 20 to 24 minutes, and also ranging from 40 to 44)
then the DVD is a TV Show. Also, most TV Show have a title that spans accross all episodes, but my script doesn't really
care about it. I'm thinking about coding a check for that as well, so that my app will be more certain that it is, indeed,
a show.

My script then assumes that it is "season one of disc one of (disc title)", since it was the first disc entered.
My programs assumptions can, of course be changed in the preferences and alternatively, my app asks to manually
put in data for things it doesn't know, but after 1 min & 30 sec of waiting for user input, it assumes on it's own.
If it is forced to assume, it makes a log stating that it has encoded "season one of disc one of (disc title)" & that the
next DVD which matches closely to (disc title) season 1 disc 2 of (disc title), and this will also strike up an entry in
the "Require Data" tab in the App which can then be changed to the correct settings at anytime and it will, in fact,
change the files it's already encoded to make sure the data's valid on both sides (it check's what files are "it's" encodes
by marking the encoded by tag and checking it to make sure).

Next is the way my program has to make assumptions based upon episodes. It knows how many episodes there are based
on how many titles are closely matched in length (time) [and it takes that into account when metadata-ing the files], but the
HUGE problem I can see is that without input from the user, my app is going to have to assume which title is which episode.

Now the code, as it is now, takes the title of each episode, and goes from least to greatest and names the files "(disc title) Disc # Episode #"
starting with episode 1 and ending with the highest numbered title (however many titles there may be).

Now, the ways I've stated do work with the few show DVDs I have, but was wondering if anybody had some input or tips to help
me make it more universal and/or smarter. Thanks ^__^
realityking
Veteran User
Posts: 680
Joined: Tue Apr 24, 2007 12:36 pm

Re: Detecting a TV Show DVD vs a Movie DVD

Post by realityking »

Not so much a suggestion but a question: How would you handle something like Psych, Season 1, Disc 1 where you've got 3 episodes with the following times (rounded):
1. 1:15:00
2. 41:15
3. 41:00

Don't remember if there was a catch all title.

Generally I don't think is possible to safely estimate whether sth. is a movie, tv show, shorts, concert or music video DVD just based on the disc.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Detecting a TV Show DVD vs a Movie DVD

Post by jbrjake »

Not all TV shows are 30/60 minutes long. For example, as you currently present it, your check would fail on Frisky Dingo, where the episodes are in the range of 10:30-11:50 minutes.

EDIT:
It'd also fail on premium channel series that actually are 30/60 min instead of being decimated by commercials. And similarly on stuff like Battlestar Galactica, where they re-edit for DVD release to extend back to a full 60 minutes.
Last edited by jbrjake on Mon Jan 26, 2009 4:44 pm, edited 1 time in total.
Reason: Added more examples
iJoel
Enlightened
Posts: 124
Joined: Sat Dec 20, 2008 7:25 am

Re: Detecting a TV Show DVD vs a Movie DVD

Post by iJoel »

realityking wrote:Not so much a suggestion but a question: How would you handle something like Psych, Season 1, Disc 1 where you've got 3 episodes with the following times (rounded):
1. 1:15:00
2. 41:15
3. 41:00

Don't remember if there was a catch all title.

Generally I don't think is possible to safely estimate whether sth. is a movie, tv show, shorts, concert or music video DVD just based on the disc.
I see. I love that show haha.
Most premiere's and finale's are longer than the usual show.
I can take that into account in my script.
I'll think of a good way, but
maybe if (2 or more titles are in range) of each other, then check if there's another title that
is most likely not a movie (ie below 1h 16 mins). Then if there's a huge title combining them all,
then the app will be satisfied, if not, check how many chapters are in each of the three likely
suspects to be TV Shows, and analyze them checking there timecodes (as TV Shows tend to have
a very short first chapter which ends at the end of it's intro) and more importantly, how many
chapters there are as every TV Show I've watched on DVD has =< 5 chapters and the shortest movie
I own, is 57 minutes and has 8 chapters.

& I can even just that code to work with specials, as they usually have much longer runtimes
then the normal show time as well.

Thanks for the input, that was exactly what I needed info on ^__^.
Not all TV shows are 30/60 minutes long. For example, as you currently present it, your check would fail on Frisky Dingo, where the episodes are in the range of 10:30-11:50 minutes.

EDIT:
It'd also fail on premium channel series that actually are 30/60 min instead of being decimated by commercials. And similarly on stuff like Battlestar Galactica, where they re-edit for DVD release to extend back to a full 60 minutes.
Oops haha, thought I mentioned that I was working on the code to make it work with all show length(s). But yeah, that was coded in yesterday.
The only reason my preliminary app was set to 20-24,40-44, minutes was because that was the times that was working with my show collection;
I thought I mentioned that in my first post ;P, my bad.

But good point on Battlestar Galactica, my app (which I defintly need a name for ha), would most likely fail on that series as it stands now.
When I code the above suggestions, I will make sure it doesn't fail on premium/BSG as well, and it can already detect Frisky Dingo (as long as there are >3 titles with the lengths you specified in each dvd).


Thanks jbrjake & realityking,
I owe you guys.
I wouldn't have considered premium channel shows,
& for some reason, I completely forgot to take into account premieres/finales/specials.

I know it seems roundabout to do it this way.
& maybe a little error-prone, but that's what the
Require Data/Confirmation tab is for. Plus, it doesn't hurt
to try to make it compatible ^__^.

Thanks again ;D.
& any other suggestions are welcome ^__^.
jeffcobb
Posts: 31
Joined: Thu Jan 15, 2009 3:33 am

Re: Detecting a TV Show DVD vs a Movie DVD

Post by jeffcobb »

realityking wrote:Not so much a suggestion but a question: How would you handle something like Psych, Season 1, Disc 1 where you've got 3 episodes with the following times (rounded):
1. 1:15:00
2. 41:15
3. 41:00

Don't remember if there was a catch all title.

Generally I don't think is possible to safely estimate whether sth. is a movie, tv show, shorts, concert or music video DVD just based on the disc.
This I am working on. I live in the US where std TV is predictable to a very large extent; however its a chicken or the egg problem: With what I am working on, this (what track is what) needs to be known once by one person (and they submit a record). Aside from knowing track-episode names, etc it can be handy for picking out the wheat from the chaff. Thus

Now three primary things mess with this logic:
1. Non-US shows (unusual/non-standard show-lengths due to less commercials)
2. Season opener discs where there is often an extended season opener or plain old double episode #1
3. Discs with 1-n longer than usual extras.

I have built two basic things to help deal with this:
1. The "filters" file that is used to decide what is a movie, show, etc is a simple INI-style file that can be customized for odd show lengths. You can have as many of these as you like and just point at the file you need.
2. A really thin kind of scratch pad called ripselect.py that gives me a place to try out custom logic on this.

In short, nothing is perfect but if this info is stored and easily accessible then this isn't a problem. In any event, unless you are running in raw rip mode it will only suggest; as part of the scan there is an export file generated where track types and names can be corrected before the final rip. This also is a simple text file like an INI file. I am not saying I have a complete solution; this is just working well for us. That was until I broke it in an upgrade this weekend but it will be back up soon and should be fine for RO ops anyhow....

Jeff
jeffcobb
Posts: 31
Joined: Thu Jan 15, 2009 3:33 am

Re: Detecting a TV Show DVD vs a Movie DVD

Post by jeffcobb »

jbrjake wrote:Not all TV shows are 30/60 minutes long. For example, as you currently present it, your check would fail on Frisky Dingo, where the episodes are in the range of 10:30-11:50 minutes.

EDIT:
It'd also fail on premium channel series that actually are 30/60 min instead of being decimated by commercials. And similarly on stuff like Battlestar Galactica, where they re-edit for DVD release to extend back to a full 60 minutes.
BTW something I forgot to mention in my previous about this was the point of the ripselect.py tool. While right now all tracks are "typed" by time class (and most/all further decisions are based on that, this is like a base tool to experiment with, particularly with larger datasets. I am thinking of using the pattern of files (not physical layout but more like a histogram of the types detected) and a simple neural net or GA to make better guesses. Time being what it is, that feature is still on the drawingboard though the basics are there now; the logic is simply hard-coded (bleh). Since the value of the guess in my use case is transitory at best, I can hack my export files on those discs that break the norms. It is still a fun puzzle to unknot though :)

However it is my personal goal is to get my DB sharp enough so the whole guessing game becomes irrelevant for 99pct of the users. I have a long ways to go I know but its fun making something cool (to me) work.

Cool part is the wife is a geek too so every new feature added or bug-fixed is better than roses on those special days ;)
Post Reply