SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Software

Notices

SageTV Software Discussion related to the SageTV application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the SageTV software application should be posted here. (Check the descriptions of the other forums; all hardware related questions go in the Hardware Support forum, etc. And, post in the customizations forum instead if any customizations are active.)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-17-2008, 01:29 PM
vca vca is offline
Sage User
 
Join Date: Jul 2008
Posts: 21
MKV files will not seek (FF/REW) properly

I have been using comskip, videoredo and staxrip for a week now, to strip out commercials and compress to H.264 format in MKV containers shows I want to keep. This is working fine with one oddity.

Initially when I put a new MKV file into my imported videos directory Sage will play it just fine, FF/REW and random seeking all work and the progress bar shows the correct times and overall duration.

After a while (not sure how long or why yet) I can go back to the same show and play it from the beginning fine, but if I try to seek or FF/REW the video will just jump back to the start of the show. When this happens Sage is showing some really strange values for the overall length (usually very large numbers like 77:44:56 on a 1 hour show).

I have not turned on Sage's option to periodically rescan the media directories for new files to import.

I can play the MKV file with other programs and it is still ok. As well, if I rename the MKV file slightly Sage will play it just fine again through the browse for media option.

I've seen a bunch of messages about Sage getting the duration wrong on imported videos because it might scan the directory during the time when the file was being copied, but I don't think this is the case with me as the problem is showing up some time after I have viewed the file successfully through Sage.

One other thing, I am generating a .properties file from the exported .XML metadata file and I am not including the Duration= property (because when I did Sage was having problems playing the files at all).

Has anyone seen something similar?
Reply With Quote
  #2  
Old 07-17-2008, 03:28 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Then you need to use mkvmerge to remux the video. Whatever tool you're using to create the mkv file is not putting the proper queue table in the file.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #3  
Old 07-17-2008, 10:07 PM
vca vca is offline
Sage User
 
Join Date: Jul 2008
Posts: 21
More information

I read in some other threads that Sage is using the time and date from the file system to determine the length of the show (by taking that time and subtracting the start time from it). To test to see if this was the problem I wrote a short program to allow me to manipulate the Windows file time stamps, but this did not change the problem.

While doing this I took a look at the XML file that had been written out for the MKV file, it contains:

airing channelId="16318" duration="3600" favoriteId="69364" sageDbId="40475" startTime="2008-07-03T06:00:00.00Z"

which seems reasonable (and one of the times I set the MKV file to in testing was one hour later than this time).

Later I noticed this entry:

mediafile duration="2559" sageDbId="103448" startTime="2008-07-11T04:39:47.02Z" type="TV"

(note there are angle brackets around these, but I've left them off in case the board thinks they are html tags and complains)

What's odd about the above time is it is almost 8 days later (which might have been when I actually got around to compressing the file from MPG to MKV), now if you do the math on it you get 190 hours and 40 minutes between the first and second start times.

Turns out that on this file the Sage media player shows 190:40:59 as my current position in the file. As you can see in this screen capture:



You can also see from the description at the top of the image that Sage thinks the recording started on 3-July at midnight (as is in the first entry in the XML file).

Another odd thing here is that there are two durations, the first is the standard 1 hour, and the second of 2559 is about correct for the show after I trimmed the commercials out of it. There is also one more broken date in the XML file, in the segmentList there is this line:

segment duration="2559" filePath="e:\videos\TVShows\House\House-SportsMedicine-40475-0.mkv" startTime="2008-07-11T04:39:47.02Z"

The XML file I am talking about was written by the "SageRecordings XML file generator, by nielm.
Reply With Quote
  #4  
Old 07-22-2008, 12:49 PM
vca vca is offline
Sage User
 
Join Date: Jul 2008
Posts: 21
Quote:
Originally Posted by vca View Post
I have been using comskip, videoredo and staxrip for a week now, to strip out commercials and compress to H.264 format in MKV containers shows I want to keep. This is working fine with one oddity.

Initially when I put a new MKV file into my imported videos directory Sage will play it just fine, FF/REW and random seeking all work and the progress bar shows the correct times and overall duration.

After a while (not sure how long or why yet) I can go back to the same show and play it from the beginning fine, but if I try to seek or FF/REW the video will just jump back to the start of the show. When this happens Sage is showing some really strange values for the overall length (usually very large numbers like 77:44:56 on a 1 hour show).
Over the last few days I've tried a number of experiments and I now think I know what is going on.

Turns out Sage is very dependent on two of the three time stamps a file has. It uses the "created" time as the time the recording started, and the "modified" time as the time the recording finished. It takes the difference between these as the duration of the show.

Now if you do some commercial removal you will probably create a brand new MPG file and this file will have the current time as its "created" time and its modified time will be a few minutes later (the time when the editing tool finished writing its output - this will be repeated if you copy the file from one drive to another or run the file through some video compression process...).

This results in some problems for Sage, the most obvious is its calculation of duration now gives you a show that's only a few minutes long. The second issue is that when Sage sees your new file it will incompletely cross reference it with the data about the original file, and it appears to keep the startTime of the "airing" record of the original file but it looks at the new file's created time and picks up that and uses it for the startTime of the mediafile record.

Since you probably do your actual commercial editing some hours or days after the show is recorded this results in the display of strange large times on the time bar (as I showed in the screen capture).

You can nearly fix this problem by copying the created and modified time stamps from the original recording's MPG file and setting them into the commercial free file - except Sage now will think that the commercial free file is longer than it really is and this will result in another error in the time bar.

To completely fix the problem you need to copy the created time from the original MPG file to the edited MPG file's created time. Then you need to determine the correct duration for the edited file (for me these are compressed to H.264 and stored in MKV containers, so I use the mkvinfo utility program to tell me the true duration), then add this duration to the start time and use the result to set the apparent "modified" time. Essentially you are telling Sage that the commercial free file started recording at the same time as the original, but it finished recording somewhat earlier due to the deleted commercials.

You also should do all of these modifications in a directory that Sage does not "see" and this directory should be on the same drive as the edited file will be finally moved to, this way when you move the file into your archive directory the created and modified time stamps will not be messed up by the operating system (if the file is on a different drive then the operating system will probably change the created time and cause Sage to mess up).

Perhaps the Sage authors should be rethinking their use of these file time stamps, its rather too easy to change these causing Sage to mess up. Obviously this will happen in the video editing scenario, but also when you are moving files around (perhaps copying them to a new, larger, replacement drive) or during a restore from a backup (I would think most backup programs will restore the time stamps, but you never know...).
Reply With Quote
  #5  
Old 07-22-2008, 12:57 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
If this were the case then why would files I process through VideoRedo to correct bad timelines not be affected by what you describe. The newly created file, while it has at least nearly the same temporal length as the original file is going to have different created and modified dates because it only takes a few minutes to process a recording. You may want to contact support about your problems.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
  #6  
Old 07-22-2008, 01:18 PM
vca vca is offline
Sage User
 
Join Date: Jul 2008
Posts: 21
Quote:
Originally Posted by Taddeusz View Post
If this were the case then why would files I process through VideoRedo to correct bad timelines not be affected by what you describe. The newly created file, while it has at least nearly the same temporal length as the original file is going to have different created and modified dates because it only takes a few minutes to process a recording. You may want to contact support about your problems.
Initially I thought all was fine, but then I placed some of these commercial edited files back into directories that Sage watches and something "wonderful" happened... If I put a file into my archived videos directory and then deleted the original recording Sage would show the recording as gone, and I could browse and play the trimmed file just fine (even though it has the incorrect time stamps like your files will have), but after some time (anywhere from a few minutes to about a day) the file would REAPPEAR in the recordings listing! At this time it would also have all the original metadata reattached and the only difference I could see would be it would have the blue "A" icon and if you looked in the detailed information (metadata) it would show the new (correct) directory path and file name (even though this is now an .MKV rather than .MPG file).

However, once this has happened the media player's timebar will now have the screwed up time stamps and is practically useless. The file itself is perfectly fine and Sage will even play it with a correct timebar if I just rename it (but then the metadata link might go away).

So perhaps you have not revisited one of your trimmed files after a long enough delay (which might be just doing a scan for media changes or stopping and restarting sage)? Or you have changed their names sufficiently that Sage does not cross link them to the original file (my compressed files have the same name with just the final .MPG being changed to .MKV)? I think the timebar gets screwed up by the cross linking. Have you checked your recordings directory for these files reappearing (it was a surprise to me when it happened (as I have not seen anyone mention this) and I ended up deleting two shows before I figured out what was going on)?

I'm running Sage from a download of about a month ago, so probably 6.3.9 or 6.3.10, what version are you running?
Reply With Quote
  #7  
Old 07-22-2008, 01:24 PM
Taddeusz Taddeusz is offline
SageTVaholic
 
Join Date: Nov 2004
Location: Yukon, OK
Posts: 3,919
Well, I don't archive files and I don't trim commercials. So it hasn't been an issue. The only thing I use VideoRedo for is to correct the occasional bad timeline or error filld recording. I let the Comskip plugin skip the commercials for me using the eml files created by Show Analyzer.

I'm really not interested in archiving anything. IMHO, there's nothing out there important enough worth saving like that.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3
Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver
Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD
Reply With Quote
Reply


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

Advanced Search
Display Modes

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
Automated VideoRedo (DOS batch files) grauchy SageTV Customizations 3 09-08-2011 10:01 PM
SageTV V6.3.10 Release Candidate Narflex SageTV Beta Test Software 0 02-28-2008 06:07 PM
New version of cyclic backup of Sage config files jimbobuk SageTV Software 40 01-10-2008 09:25 AM
Seek issues in PVR150 recorded files... shodge SageTV Software 2 08-06-2006 07:22 PM


All times are GMT -6. The time now is 01:38 PM.


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