Can't upload videos

Dec 20, 2011 at 10:45 PM
Edited Dec 20, 2011 at 10:46 PM

Hello, I've installed the latest version of Media Garden. When I try to upload a video from my computer, the browser says the page was interrupted. This happens without it even calling the POST method in the controller. 

Any ideas?

[Edit: Obviously I've installed the Video module as well. Images are working fine.]

Coordinator
Dec 21, 2011 at 2:47 AM

How big is the video?

For large files, I've been FTP'ing them up to the media folder, then you can import them in the Media Query box instead.

Dec 21, 2011 at 3:06 AM
Edited Dec 21, 2011 at 3:10 AM

Not large at all, only 7 megs. But I'm thinking it could be that it doesn't know how to handle the codec, since another video in the same folder worked. It's really hard to debug since it's not even getting to the controller, so I'm not sure where to start.

Also, when you import into media garden with a weblink, does it treat the source as a reference or is it actually downloading the content into the Orchard system? [Nevermind, I see it's storing the reference]

Coordinator
Dec 21, 2011 at 3:09 AM

What is the extension/codec of the file? Technically it should let you upload *any* file and then MediaGarden will attempt to determine the file type from extension, so it should be hitting the controller.

With a weblink it only stores a reference; it will download the file's headers to check MIME type but it won't store the file on your site.

Dec 21, 2011 at 3:23 AM

It's a video downloaded from Google. VLC says vp8 is the codec so I guess that means webm. 

Dec 21, 2011 at 3:27 AM

When I drop the video into the orchard media folder and then do a search it comes back with "No matching media formats found at videos\videoplayback.webm (with MIME type '' and file extension 'webm')"

Coordinator
Dec 21, 2011 at 3:55 AM

Strange ... webm is supported, I'll have to investigate. Do you have a link to the file so I can test?

I should just clarify the difference between file extensions, codecs, and MIME types; because these concepts can lead to unrealistic expectations.

The file extension indicates a *container* format. So we have common container formats like mp4 and webm. These themselves can contain a variety of video codecs, however, and a particular codec might be found in a variety of containers! So, whilst mp4 is typically found to be h.264 video, this is not always the case we'll often find other video codecs, and in fact mp4 can also contain just audio.

It's extremely difficult to probe a video container and find out the "true" codec. Media Garden currently makes no attempt to do this. I'd love to have this in the future, but currently it's only possible through the extremely complex procedure of running a command-line utility and parsing the output, obviously this is only possible in full trust and it's far from ideal.

Then we have MIME types. When a file is transferred over the internet the MIME type tells the receiving client what type of file it is; so it shouldn't matter *what* extension it has, the MIME type will tell us what sort of file it is and therefore what we can do with it. For video and audio we still have this container problem; a single MIME type could cover a variety of video codecs that actually need different players. To compound the problem, a lot of servers are badly configured and report incorrect MIME types; and there are various anomalies of software that force servers to intentionally report wrong MIME types for some files.

You can determine MIME types via the system registry, but again it can be misconfigured, and this also requires full trust.

The only foolproof way of determining MIME (for the purposes of Media Garden) would be to inspect "magic numbers" which are key numbers usually found in the first few bytes of a file that will tell you the file type. Unfortunately there's no decent and up-to-date library I could find that would do this, and the information seems hard to come by.

The short version is: only the file extension is taken into account in Media Garden. I leave it up to the user to manually select a different media type / format if the system gets it wrong.

Dec 21, 2011 at 5:01 AM

Hey, I don't have any super easy way to get it on the web at the moment. That said, I realized that using Media Garden for what I need won't work anyway. If you want me to upload it for your own edification I'm sure I could do so tomorrow.

Coordinator
Dec 21, 2011 at 9:05 AM

I just meant a link to where you downloaded it on Google ... out of interest, what are you trying to use Media Garden for? It's flexible enough to accommodate scenarios you might not realise...

Dec 21, 2011 at 9:25 AM

 

Ah, I'm basically making a new take on a media search engine. I want it to interface with several of the video sites and wrap around their underlying videos.

While the page links are static, the videos on Youtube etc. have temporary addresses that you can't link to directly.

I guess I could extend Media Garden to store the page link but then scrape the page as part of the view.

Coordinator
Dec 21, 2011 at 10:15 AM

I'd originally planned to have an embedding system like this. The pipeline can be extended for that sort of custom processing - which is why I made the web reference start downloading the file, so you could actually download more of it if you wanted to scrape HTML, or download the whole thing if it's an XML feed, to scrape further media information. I wanted to also be able to scrape title, description, etc. as the content is imported. Then that data would be indexable by Orchard.

I don't mind helping out getting this integration done, it's a feature I wanted anyway. The place to start looking is MediaGarden\Pipeline which is where you'll find various events to hook into. IMediaHeaderFilter, IMediaLocationFilter, etc., and see how some of the other modules interact with them.

Dec 21, 2011 at 11:01 AM

Alright, I'll look into it.

For the actual scrapping, I have already made a module tentatively titled EmbeddedContent that works as follows.

You define an EmbeddedSource that has a Name, Regex Match, Source Code (although I should call this Projection or Transform I think) and whether to operate directly on the content or on the fetched request. These sources are configurable from the Admin side menu. Then you create EmbeddedContent that has a source assigned.

A service exposes the available sources and allows you to do a transform wherein the Regex Match is run on the content to form groups and then the groups are replaced in the Source Code. 

Thus far I've only thought about using it to do view injections and focus on HTML code, but there isn't any inherent reason why it couldn't be used to scrape for metadata to be used by MediaGarden. Would you mind talking about having that be a potential dependency for MediaGarden in order to facilitate the scrapping?

Also you bring up a good point, which is that a single content source might have multiple sources of information associated with it. A single content item might have an associated HTML file, XML/JSON feed and perhaps service processing.

Coordinator
Dec 21, 2011 at 3:12 PM

How I originally wanted to do it was a separate module called e.g. MediaGarden.Embedded, which would contain formats and filters for common media sites, and establish conventions to make it easy to add more.

Doing it thru a database is nice and configurable, but I wonder if this will cover all situations; you might want to hook in custom code, which is why I designed all the existing formats as code-based. There could be multiple values to scrape from the page which need mapping to the correct storage parameters (think: embed code, title, description, author, movie length, thumbnail, tags, and much more besides) - mostly this is easily done with a line or two of code, but very difficult to model as a db-configurable system, and also consider that the sources and therefore regex's will change over time as different websites themselves are updated ... you want a solution that can be preloaded with support for popular sites and update accordingly.

However you can of course give your module a dependency on MediaGarden, then have a filter which will plug your scraping into Media Garden's pipeline (you'd need to do this anyway, as it'll have to be a separate Media Type as well as defining a media player which will display the embed code).

Actually it's possible to do all this without a hard dependency, using Orchard's event bus. I can convert some of Media Garden's interfaces to be IEventHandler instead of IDependency; that way you can create the same interface in your module and avoid the project dependency, the event bus will match up the messages anyway.

Dec 21, 2011 at 9:27 PM

So it seems to me that the best thing to do is have the source filter get metadata and not touch any of the headers or anything, just treating each site as a Format. I can build out an extension in Embedded to make MetaDataSource or something in order to handle feeds and scrapping.

Then there would be some way to make a viewmodel that all the existing Viewers can use, haven't figured that out yet.

Coordinator
Dec 21, 2011 at 10:02 PM

During the source pipeline, there's a dictionary you can add any data you want into while the source is being processed.

Then when the media items are actually imported, content items are created; so you can populate any data you want on the items during that. For instance, for images there;s a PixelDimensionsPart which stores the width and height of the image. They are actually determined in the ImageSourceFilter, and stored in the IMediaSource.Metadata dictionary. In the DefaultContentFilter the PixelDimensionPart is populated if both it and the metadata are there. You could create your own IMediaContentFilter which populated title, description etc. from metadata scraped in your own IMediaSourceFilter.

Then you create your own Viewer to display embedded content, and it doesn't even need to be aware of all the metadata. It might just be an iframe which only needs a Url to load. You can still look up metadata thru the MediaPart.

Dec 23, 2011 at 3:27 AM

Alright I pretty much have it working. You can add a link from Youtube or Vimeo and it will figure out what Format to use. The formats extract the video token from the url and then the Filter queries the Youtube/Vimeo feed to get the metadata for the video, which is stored in the Media Source. Right now they both have their own viewers, but I might combine that into one.

Anyway, it's to the point where it is displaying videos, etc. but I need to clean up the feed code a bit since it can return stuff that is breaking NHibernate. Also, how do you specify whether something is indexable or not?

Dec 23, 2011 at 5:49 AM

One other question. I can't quite figure out how the View is generated for the content. I just named mine Media.Embedded-Youtube.cshtml and it is working. But I don't want to display it in the admin view and can't figure out how to keep it from doing so.

Dec 23, 2011 at 9:43 AM
Edited Dec 23, 2011 at 10:26 AM

Another issue, but you might not know the answer to this one. 

I've started pulling tags from the feeds, and it was working for a while but then started throwing an exception on Tag creation

could not insert: [Orchard.Core.Common.Models.CommonPartRecord#98][SQL: INSERT INTO Common_CommonPartRecord (OwnerId, CreatedUtc, PublishedUtc, ModifiedUtc, Container_id, Id) VALUES (?, ?, ?, ?, ?, ?)]

A duplicate value cannot be inserted into a unique index. [ Table name = Common_CommonPartRecord,Constraint name = PK__Common_CommonPartRecord__0000000000000105 ]]

 

I am just setting Metadata["Tags"] with a comma delimited string after seeing that Media Garden handles the rest. Any ideas?

Apr 28, 2012 at 1:26 AM
mikkelfishman wrote:

When I drop the video into the orchard media folder and then do a search it comes back with "No matching media formats found at videos\videoplayback.webm (with MIME type '' and file extension 'webm')"

i got the same.

sample link:

http://www.808.dk/?code-html-5-video

===========

2--can not play .mp4(white page, and  only can download)

===========

html5 video?

Apr 28, 2012 at 1:31 AM
Edited Apr 28, 2012 at 1:41 AM

3-- can not upload C:\Users\Public\Videos\Sample Videos\Wildlife.wmv which is built-in inside   win 7.

it is too big size(25M)? or   because of .wmv   format?