SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-14-2016, 04:39 PM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
How to get dvd duration

I have hit a snag on my IOS client and sure could use some help. I am supporting downloading of content to the IOS device to be able to watch offline. The way it works is when the IOS client wants to download an item the server side starts ffmpeg to do the transcoding and segmenting. The segments are then downloaded as they become available. I am showing a progress bar with the percent complete as the media is being downloaded. Since I have no way of knowing until the media is completely encoded what its file size is I am using the duration of each HLS ts file and then using the media duration sent from the server to calculate the percent complete. I searched the forums for countless hours about a year ago trying to find a way to get the duration of a ripped main movie dvd which is what all of my dvd rips are. I couldn't find an answer and posted the question before on 4/30/2015 here:
http://forums.sagetv.com/forums/show...837#post571837 and didn't get an answer I could use. I then found I could use the -i option on ffmpeg and it would report the duration. For a dvd rip I had to run it on each of the vob's and sum them up. I coded this and thought I was home free but testing this morning is showing ffmpeg is reporting a wrong duration for some dvd's. VLC reports the correct time for these dvd's and sagetv shows the correct time when do a view video detail so Sage has it some place! I am using the latest version of ffmpeg so no option there. I do see I have a .properties file for each media item with a RunningTime= line in it. My files end with ScrapedBy=Phoenix. Will the RunningTime be there if someone is not using Phoenix? Now that the code is open source has anyone discovered an api means to get this? If not can I assume every sage 7+ install will have the .properties file and will have the RunningTime= line?

Thanks!
David

Last edited by davidb; 04-14-2016 at 04:44 PM.
Reply With Quote
  #2  
Old 04-14-2016, 10:55 PM
wnjj wnjj is online now
Sage Icon
 
Join Date: Jan 2009
Posts: 1,514
All of my DVD's show 0 seconds on V7. I don't run Phoenix. So I'd say the duration is not generally available.
Reply With Quote
  #3  
Old 04-15-2016, 05:34 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
So when you go to watch a ripped dvd do you have the green progress slider at the bottom? Just to get the right of the progress bar where mine shows the duration does yours without Phoenix show 0?

Thanks
David

Quote:
Originally Posted by wnjj View Post
All of my DVD's show 0 seconds on V7. I don't run Phoenix. So I'd say the duration is not generally available.
Reply With Quote
  #4  
Old 04-15-2016, 05:47 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Once you start playing a DVD, they player/navigator can get the length of that title. But DVDs don't have a "length", a DVD is a container that can contain a number of titles of varying lengths, some of which can loop indefinitely (menus), so a "DVD" doesn't have a length.

This is also why (IIRC, it's been a while since I switched to converting to use MKVs) Sage doesn't save your position/progress in a DVD.
Reply With Quote
  #5  
Old 04-15-2016, 05:57 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
I realize a dvd contains menus and can contain more than one title but in my case I rip all of my dvd's with dvdshrink to just the main movie. When I watch or go to "Video Detail" I se the duration of the media item. Since I am using Phoenix I am unclear if Phoenix is providing this information or Sage is. Also Sage does remember the watched position of my ripped dvd's(or Phoenix??) and prompts me when starting to resume where last watched or at the begining.

So is phoenix where Sage is getting the duration?

David

Quote:
Originally Posted by stanger89 View Post
Once you start playing a DVD, they player/navigator can get the length of that title. But DVDs don't have a "length", a DVD is a container that can contain a number of titles of varying lengths, some of which can loop indefinitely (menus), so a "DVD" doesn't have a length.

This is also why (IIRC, it's been a while since I switched to converting to use MKVs) Sage doesn't save your position/progress in a DVD.
Reply With Quote
  #6  
Old 04-15-2016, 07:12 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by davidb View Post
So is phoenix where Sage is getting the duration?
It's possible. But the problem is there's not going to be a reliable way to do it for the "DVD" case, since there isn't a valid/single duration for a full DVD rip.
Reply With Quote
  #7  
Old 04-15-2016, 08:10 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
I seem to have run into a dead end trying to get the duration for the main movie from SageTV. I have found that the Open Source Handbrake encoder will show the correct duration. Unfortunately I find no way of just getting the duration info and just stopping. HandbrakeCLI the command line transcoder wants to keep going! On the good side I can give it an output of device NUL and it doesn't create the file but keeps encoding till complete. It looks like I can create the HandbrakeCLI process, process the output lines asynchronously and when I get the "duration" line kill the process using the process id when it started. This acts like, sounds like and really is a crude H A C K!!!!!! But hack or not it should give me the duration! This means someone using the SageRemote IOS app will have to have handbrake installed on the server though. But it is free but it is 54 Meg I would rather not have to have the user install.


David
Reply With Quote
  #8  
Old 04-15-2016, 08:46 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by davidb View Post
I have found that the Open Source Handbrake encoder will show the correct duration.
But is it the correct duration? Or does it just pick the length of the longest VTS? Is that always the right one?

This reminds me a lot of non-licensed players and Blu-ray, where they just default to playing the longest playlist, which may or may not be correct.
Reply With Quote
  #9  
Old 04-15-2016, 08:58 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 134
I have tried it on about a dozen of my dvd rips and it is reporting the same duration as sage is showing when I view video-detail. But then again all of my dvd rips are just the main movie rips. I am not going to support DVD menus in the IOS sageremote app so I would think the longest VTS would be the reasonable choice.

David

Quote:
Originally Posted by stanger89 View Post
But is it the correct duration? Or does it just pick the length of the longest VTS? Is that always the right one?

This reminds me a lot of non-licensed players and Blu-ray, where they just default to playing the longest playlist, which may or may not be correct.
Reply With Quote
  #10  
Old 04-16-2016, 12:02 AM
wnjj wnjj is online now
Sage Icon
 
Join Date: Jan 2009
Posts: 1,514
Quote:
Originally Posted by davidb View Post
So when you go to watch a ripped dvd do you have the green progress slider at the bottom? Just to get the right of the progress bar where mine shows the duration does yours without Phoenix show 0?

Thanks
David
No, the green progress bar shows the whole movie and works fine. 'Video detail' is where I see 0. The 'resume playback' option comes up sometimes but only works occasionally.

My DVD's are all in video_ts folder structures from DVD shrink.
Reply With Quote
  #11  
Old 04-16-2016, 09:50 AM
wnjj wnjj is online now
Sage Icon
 
Join Date: Jan 2009
Posts: 1,514
Does FastMpeg2Reader.java have what you need? It looks like it's parsing .ts files and extracting duration.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong DVD duration MovieFreak Sage My Movies 14 06-01-2011 12:09 PM
BMT not getting movie duration in sage V7 rnadeau Batch Metadata Tools 2 06-20-2010 11:38 AM
Incorrect Show Duration skyeclad SageTV Software 2 05-03-2010 09:42 AM
Buffer Max Length and Duration? ktuimala SageTV Software 2 07-23-2009 10:48 PM
VBR MP3 duration miscalculation nielm SageTV Beta Test Software 8 01-18-2007 06:51 PM


All times are GMT -6. The time now is 12:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.