SnapStream Forums

Go Back   SnapStream Forums > SnapStream Developer Network > Development Discussion
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 04-05-2005, 05:51 PM
Registered User
 
Join Date: Oct 2004
Posts: 16
Questions regarding Offline ShowSqueeze / licensing issues project...

Being someone who runs both Linux and Windows at home, showsqueezing to WMV format is not ideal for playing back video. (Yes, I know, this is a common complaint "Divx support was removed in 3.4" yada yada yada. I'm not here to complain...Divx is not ideal in the first place)

...So I embarked upon a mission to create an add-on that would allow me to use one my desktop PC to reencode files from my HTPC. (I use the PVR250 and 150, so I'm stuck in MPEG2 format for all new recordings)

The process I'm using involves copying the MPEG2 file from my HTPC to my desktop PC, re-encoding the file ffmpeg, copying the re-encoded file back to my Beyond TV (HTPC) and deleting the original (huge) MPEG file.

I've designed it to be very flexible...allowing me to encode it in any format that libavcodec supports (natively, or externally such as Xvid).

My concern is regarding transfering the show "metadata" from the MPEG2 file to AVI file. (My wife wants to watch "her show", she doesn't care what format its in as long as it looks good).

Unable to get the BTV API to work on my remote PC without purchasing a BTV Link license (something that owning one television... other than this issue, is of no interest to me): I built a quick/dirty web app that runs on my BTV box.
Its sole purpose is to retrieve the show information of the old show and dump that information back to the new show (with additional ShowSqueeze properties) using simple POST commands to the web server and BTV's web services.

I have a C# app that runs (unfortunately) using MS IIS on my BTV box.
The C# app accepts two commands:
1. Output show information (which is XML formatted for convenience)
2. Dump showsqueezed information to the "re-encoded" show mimicking that of the original show (and appearing to be "showsqueezed").

So "the point" ... my problem is both Technical and Legal in nature:
Not wanting to violate licenses: Is this acceptable (updating the show properties remotely using IIS on my HTPC [BTV box]). If not, then is there some other way to update the details (including those that are not accessible through WebAdmin), that would be acceptable under the license agreement for BTV.

Any assistance is appreciated... I built this add-on for myself, but if I can release it and its source code without incuring legal fees, then I'd like to make it freely available to the rest of the community here... Mucking about between public and commercial licenses is not one of my strong points, so I'd rather err and on the side of caution ...

Thanks!
--
Acousticiris

Last edited by acousticiris; 04-06-2005 at 06:39 PM.
Reply With Quote
  #2 (permalink)  
Old 04-08-2005, 11:41 AM
btvbuddy's Avatar
Registered User
 
Join Date: Mar 2004
Posts: 247
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

In no way should you interpret my comment as Legal Advice. I am not a lawyer nor am I licensed in any part of the world as a lawyer.

I thought the Snapstream response was that users must own or buy a copy of Beyond TV Link for you to release and allow this type of remote software to be used, how that is enforced on your side is something you need to consider as well.

Good Luck!
Reply With Quote
  #3 (permalink)  
Old 04-08-2005, 12:41 PM
Registered User
 
Join Date: Oct 2004
Posts: 16
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

At least as far as I can tell, that may be the case. This is the reason I haven't shared my code as yet.

I am curious if anyone can answer my second query though: is there an alternative to how I am doing this that is on less shaky ground (or even, perhaps, more reliable...because this hasn't been the most reliable way to do it).

Obviously I have no desire to rob Snapstream of a license ... even if it would seem to be something that shouldn't require a separate license ... I didn't write their software, so it's not my choice.

I will say, from a user standpoint that having to purchase a third piece of software to do such a simple task would be a waste of money...and from a developer standpoint it would be severly limiting with regard to what I could produce using the API. It's those types of things that cause me to consider open-source alternatives much more closely in spite of the fact that I *love* Beyond TV. If they desire a vibrant development community around their app, they have to be flexible with their terms,...
Reply With Quote
  #4 (permalink)  
Old 04-09-2005, 04:20 AM
Registered User
 
Join Date: Jul 2004
Posts: 69
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Does the application on the HTPC need to be web-based? My solution would be to have a standalone application on the HTPC, that regularly looks for files in a directory.
Then the files would be copied from the desktop PC to the HTPC into this directory, with the filenames kept the same (with just the extension changed).
The application should then be able to find the original file in the Library using the API functions, extract the metadata, overwite the file, and store the metadata for the new file.
The only link between the HTPC and desktop PC is the copying of files.
Reply With Quote
  #5 (permalink)  
Old 04-09-2005, 07:48 AM
StephaneM's Avatar
Registered User
 
Join Date: Dec 2003
Location: France
Posts: 1,297
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Quote:
Originally Posted by acousticiris
So "the point" ... my problem is both Technical and Legal in nature:
Not wanting to violate licenses: Is this acceptable
According to the license, you cannot use the API remotly without requiring the user to have a BTV Link license. The agreement does state that a proxy that would circumvent this requirement is not authorized (for instance creating an application that runs on the BTV Server and that offer some remotes interface to access the API from another application on the network, though you could create such interface that only works locally).

The only remote usage that is permitted is throuhg a web browser, if and only if your web server is on the BTV Server.

Regards,
Stéphane.
__________________
P4 820D - 2 GB
ATI X1800 XL - PVR 150 x 2
XP Pro SP2 - DX 9c - Catalyst 6.9 - CyberLink PowerDVD 7 Video & Audio Decoder.
Beyond TV 4.2 - BTV XMLTV Importer - Web Based Program Guide - Firefly, Firefly Mini, Streamzap, USB-UIRT or MCE Remote Tool
Reply With Quote
  #6 (permalink)  
Old 04-10-2005, 08:34 AM
merrypig's Avatar
...
 
Join Date: Oct 2002
Posts: 4,411
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

and even then SS were ambigious about how much they would sanction.

SS did at one point admit the EULA was flawed and said they'd rethink it. Evidently they didn't think about it too much.
__________________
Sleep well Kismet
Reply With Quote
  #7 (permalink)  
Old 04-11-2005, 07:22 AM
IGx89's Avatar
WMP9 Plugin and IGCutter
 
Join Date: Sep 2003
Location: Minnesota, USA
Posts: 278
Send a message via MSN to IGx89
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

You can edit show metadata without going through BTV, since metadata is stored in the actual video (both MPEG-2 and WMV). I can e-mail you more details if you're interested.
Reply With Quote
  #8 (permalink)  
Old 04-25-2005, 09:36 PM
Registered User
 
Join Date: Sep 2003
Posts: 196
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Quote:
Originally Posted by IGx89
You can edit show metadata without going through BTV, since metadata is stored in the actual video (both MPEG-2 and WMV). I can e-mail you more details if you're interested.
I am very interested in knowning how to do this, for both WMV and AVI (xvid) files. Can you post it or point to it or even PM me?

Thanks!
Reply With Quote
  #9 (permalink)  
Old 04-30-2005, 09:07 PM
Registered User
 
Join Date: Oct 2004
Posts: 16
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

That might be where the problem arises... I'm writing out an AVI file using ffMpeg (not MPEG-2 or WMV).
I am storing some metadata in the file (and it is viewable by most AVI file players), but it's three fields, not the wealth of fields that BTV is able to display.
Realistically, I want to be able to update the database record for a compressed file so that BTV sees it as though it is not only the "original show", but also a showsqueezed version of the original show (though, I'll pass on the showsqueezed part if I can at least get the "original air date", recording date and other fields to update properly so that they don't expire improperly).

I *don't* care about streaming the file. I just want a smaller version of it in identical quality that can be recompressed a little faster than real-time (and can be put on my linux box, dell axim, or anywhere else I wish to play it regardless of OS). WMV doesn't provide this.

The two problems I have run into *regularly* (other than the potential legal issues that I'm unsure of) is that whether locally or remotely, the BTV API seems to just...stop working. I can re-encode (locally or remotely) about 50 files or so if the BTV server is not busy (on a weekend when I have fewer recordings) ... or about 10 when it is busy (weekdays) before having to reboot the box because the SOAP connection to the object required to update the show data appears to die.
I've hex edited the database and I'm pretty sure I know what the db format is (and even if not, I have the format down enough to be able to edit it). Of course, while BTV is running, the DB is locked so I can't effectively edit it in any way that would be useful.

It's really simple, I just want to be able to update *all* of the information about a recording using a script or app. I don't care if I'm limited to only doing it locally on the box (though it would be nice if I could do it remotely without purchasing another application). The Web UI doesn't provide me enough, the API is too unreliable, and the database isn't accessible while BTV is running. So, I guess my question is ... is there another way short of using a different HTPC app all-toghether? I'm rather fond of BTV/Beyond Media.
Reply With Quote
  #10 (permalink)  
Old 04-30-2005, 09:28 PM
IGx89's Avatar
WMP9 Plugin and IGCutter
 
Join Date: Sep 2003
Location: Minnesota, USA
Posts: 278
Send a message via MSN to IGx89
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Quote:
Originally Posted by Soundman
I am very interested in knowning how to do this, for both WMV and AVI (xvid) files. Can you post it or point to it or even PM me?

Thanks!
In WMV files BTV stores all the show details as attributes, named "SS-xxxx" and a few "WM\xxxx". The Windows Media Format SDK includes an API and sample code to modify WMV attributes, so I was able to easily design code to copy attributes from one file to another and integrate it into IGC Processor. I've zipped up that code and put it on my server for you to look at; it's not commented, and it's in C++ (if you're using C#, it's very similar and probably even easier), but should be easy enough to understand: http://www.igx89.com/AttributeCopier_src.zip

Now, MPEG-2 files are a bit different. I found that BTV also stores metadata in MPEG-2 videos, but there doesn't appear to be a format standard, let alone an API, for metadata storage in MPEG. A little hex editing and diffing was all I needed though:

BTV-generated metadata is stored in the last 8218 bytes of MPEG-2 videos. Specifically, bytes 8218-8215 are "00 00 01 BF" (a "Private Stream 2" packet according to MPEG specifications, containing any sort of data), bytes 8214-8213 are "20 14" (8212 in decimal; the length of the packet), there are a few other bytes, and then the name/value pairs (delimited by "00") containing metadata info start. They end when "00 00" is reached, and then the rest of the packet (a large majority) is just junk bytes. The metadata-copying code for that I integrated into my custom build of mpgtx, basically just looking for "00 00 01 BF" at that certain location at the end of files, and then copying those 8218 bytes to the new files. Very simple

(PS: Sorry I didn't respond sooner; the topic reply notification got lost in my inbox )
Reply With Quote
  #11 (permalink)  
Old 05-05-2005, 10:34 PM
Registered User
 
Join Date: Sep 2003
Posts: 196
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

IGx89. Excellent. This is great information about how to copy all the show attributes from one WMV file to another. Problem is that the URL you gave for the source code yields a 404 Not Found.

It is GREAT for you to have added this feature to IGCutter. I'll try the new version with this feature soon.
Reply With Quote
  #12 (permalink)  
Old 05-06-2005, 09:33 PM
IGx89's Avatar
WMP9 Plugin and IGCutter
 
Join Date: Sep 2003
Location: Minnesota, USA
Posts: 278
Send a message via MSN to IGx89
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Sorry about that, my web host went MIA and I've been having quite a chore in rebuilding everything . That link should work now.
Reply With Quote
  #13 (permalink)  
Old 05-16-2005, 10:56 PM
Registered User
 
Join Date: Sep 2003
Posts: 196
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

IG89, One more thing. You did a great job of identifying how to read meta-data from MPG and WMV files. Do you happen to know of a utility that can write the info to a .AVI file? I am experimenting with converting to xvid (avi) format, and I don't like using the Snapstream API to copy the show attributes since it often times out with an exception and is only useable on the machine SS is running on, etc.
Reply With Quote
  #14 (permalink)  
Old 05-18-2005, 12:42 PM
Registered User
 
Join Date: Oct 2004
Posts: 16
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

Curious ... I know SS keeps a database, and a hex editing of that DB contains the show information. Does SS actually write out the header information to the AVI file upon the usage of its API, or does it just store that data in the database ... to only be lost if the database becomes corrupted?
I'm curious on two fronts... I love hex editing and if it is storing the data in the AVI file, it probably won't be too difficult to figure out exactly how it is doing so, and I, like Soundman, would like to eliminate my usage of the API all together since it is not as reliable as it could be...
Reply With Quote
  #15 (permalink)  
Old 05-18-2005, 04:37 PM
Registered User
 
Join Date: Oct 2004
Posts: 16
Re: Questions regarding Offline ShowSqueeze / licensing issues project...

I just answered my own question...

They are stored in the actual AVI file. I'm (obviously) not an expert in multimedia formats, but it appears pretty simple. Easy enough to find by just going to the tail end of the file and you can see ATTR, follwed by a 32-bit integer representing the byte count, followed by 4 bytes of data that I'm not sure of (again, don't know the format well), then a set of null terminated properties and strings.

I'm guessing this is some standardized format, or some non-standard format that happens to work because of the way an AVI file is parsed.
-- <RIFF>[32-bit size]
---- <AVI >LIST[32-bit size]
------ hrdl[32-bit size]
------ movi[32-bit size]
---- <idx1>[32-bit size]
(this appears to be the end of the video/audio stream information on a simple xvid encoded video)
---- ATTR[32-bit size][4 bytes of unknown]
---- series of null terminated strings using <property name>NULL<value>NULL until it reaches the end of the file.

That seems like a reasonable method for parsing what's there, and editing it. Haven't had much time to look deeper, the 4 bytes of unknown data probably represent something important but I was only using a single AVI file that I squeezed using my external re-encoding tool and BTV's API to set the properties. After checking out a few others, I'm sure it will reveal itself ... my hope is that I can just drop the ATTR section and recompute it using my own values either scraped from a web site like TV Tome or simply copied (and supplimented with showsqueeze information) from the original MPG.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HD and showsqueeze issues nevik Beyond TV and Beyond TV Link 0 12-18-2007 11:17 AM
HD post processing issues / questions enigma9o7 Beyond TV and Beyond TV Link User-to-User Troubleshooting & Support Forum 5 12-27-2006 07:56 PM
Showsqueeze issues Terminal Beyond TV 4.x 15 10-19-2005 02:05 PM
Next Project Questions Deuce911 Development Discussion 15 02-02-2005 04:49 PM
Offline showsqueeze jip SnapStream Discussion 1 03-08-2004 02:03 PM


All times are GMT -6. The time now is 12:23 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0 RC1
©2004-2009 Snapstream Media