I have used asp.net C# (4.0) VS 2010.
I have .avi video file already stored in my source.
I want to play that video on page load.
I already tried with Google too many times but not satisfied with results.
I need step by step solution to follow.
Anything that i have to import or else that i want to know?
I can play video using you-tube links but i don't want to do that.
I already tried with
string path = "MYFILE.avi";
Page.Controls.Add(new LiteralControl("<video width='320' height='240' controls='controls'><source src=" + path + " type='video/avi'></video>"));
But this gives me following error
No video with supported format and MIME type found
Please help.
This relates to this question here on SO: Does HTML5 <video> playback support the .avi format?
Reading up on it via the links in that question you'll see that the only formats that is talked about is WebM, MP4/H264 and Ogg/Theora. There is currently (as far as I know) no browser that supports playing .avi-files with the video-tagg. Either convert it to one of the supported formats or use the embed-tag to include it (though that is a really old way to do it. You can read about that here: http://www.templatemonster.com/help/how-to-embed-video-into-html-page.html
This is not a C# or Asp.net question, it is HTML/HTML5 problem.
I can easily say DON'T use AVI because it is not cross-platform, but I don't know what is your situation.
You can Try :
<embed type="video/x-msvideo" src="MYFILE.AVI" autoplay="false" autostart="false" width="600" height="420">
and you should try your existing solution with FireFox or Chrome also it may works,
The funniest joke that WAV and AVI are proprietary for Microsoft, but IE does not recognize wav and AVI with HTML5 while other browsers does. I have tried WAV but not AVI.
and you can make a generic solution such:
if (browser = ie) then
<embed ...
else
<video width='320' height='240' ...
end if
Related
I have a C# desktop application that needs to play video files.
I am currently using the WMPlib, along with Interop.WMPLib and AxInterop.WMPLib.
Using this I can play WMV videos, but I need to be able to play more formats, such as MKV, MP4, AVI, OGV and MOV.
Digging through MSDN I found a comment that said that it only supported the "default codecs", but didn't specify which ones they were... I can't seem to find a list of the supported codecs for this lib online either..
How can I implement multiple format playing? Am I even able to do it? The documentation for this isn't exactly very clear and my googling only got me this far..
thanks in advance!
VLC is a media player that can play just about any unencrypted audio/video file. You can use its functionality as a library in .NET, e.g. with libvlcSharp.
Hello I am working on video files and would like to learn video's length, frame width and height, and total bitrate. I have seen solutions for ID3 tags but they don't seem working for movies(.mov extension)
Find and download/buy ISO/IEC 14496-12 (MPEG-4 Part 12)
The mvhd and tkhd boxes (and possibly others... it's been a while!) will give you the information you're looking for. The MOV file format is quite easy to parse.
Provided that the file is playable within DirectShow, you can build a pipeline for this file and without running it check the pipeline properties to find out details like duration is resolution. This method is not specific to .MOV and works out well for other formats. In C# you typically interface to DirectShow via DirectShow.NET.
See related:
Grab frame from .mov file using DirectShow.net
Getting MP4 File Duration with DirectShow
how to get the duration from a mp4 media file by C#
In my opionion the best way is use of MediaInfo. It not requires any additional codecs installed etc.
See my answer in this post:
unable to load MediaInfo Library
I am trying to make a video download application for desktop in C#.
Now the problem is that following code works fine:
WebClient webOne = new WebClient();
string temp1 = " http://www.c-sharpcorner.com/UploadFile/shivprasadk/visual-studio-and-net-tips-and-tricks-15/Media/Tip15.wmv";
webOne.DownloadFile(new Uri(temp1), "video.wmv");
But following code doesn't:
temp1="http://www.youtube.com/watch?v=Y_..."
(in this case a 200-400 kilobyte junk file gets downloaded )
Difference between the two URLs is obvious, first one contains exact name for file while other seems to be encrypted in some way...
I was unable to find any proper and satisfactory solution to the problem so I would highly appreciate a little help here, Thanks.
Note:
from one of the questions here I got a link http://youtubefisher.codeplex.com/ so I visited there, got the source code and read it. It's great work but what I don't seem to get is that how in the world that person came to know what structures and classes he had to make for downloading a YouTube video and why did he have to go through all that trouble why isn't my method working?
Someone please guide. Thanks again.
In order to download a video from youtube, you have to find the actual video location. Not the page that you use to watch the video. The http://www.youtube.com/watch?v=... url, is an html page (much like this one) that will load the video from it's source location and display it. Normally, you have to parse the html and extract the video location from the html.
In your case, you found code that does this already - and lucky you, because downloading videos from youtube is not simple at all. Looking at the link you provided in your question, the magic behind the madness is available in YoutubeService.cs / GetDownloadUrl():
http://youtubefisher.codeplex.com/SourceControl/changeset/view/68461#1113202
That method is parsing the html page returned by a youtube watch url, and finding the actual video content. The added complexity, is that youtube videos can also be a variety of different formats.
If you need to convert the video type after downloading, i recommend FFMPEG
EDIT: In response to your comment - You didnt look at the source code of YoutubeFisher at all, did you.. I'd recommend analysing the file I mentioned (YoutubeService.cs). Although after taking a quick look myself, you'll have to parse the yt.playerConfig variable within the html page.
Use that source to help you.
EDIT: In response to your second comment: "Actually I am trying to develop an application that can download video from any video site." You say that like its easy - fyi, its not. Since every video website is different, you cant just write something that will work for everything out of the box. If I had to do it though, heres how i would: I would write custom parsers for the major video sharing websites (Metacafe, Youtube, Whatever else) so that those ones are guarenteed to work. After that, I would write a "fallover" if you will. Basically, if you're requesting a video from an unknown website, it would scour the html looking for known video extentions (flv, wmv, mp4, etc) and then extract the url from that.
You could use a regex for extracting the url in the latter case, or a combination of something like indexof, substring, and lastindexof.
I found this page # CodeProject, it shows you how to make a very efficient Youtube downloader using no third party libraries. Remember it is sometimes necessary to slightly modify the code as Youtube sometimes makes changes to it's web structure, which may interfere with the way your app interacts with Youtube.
Here is the link: here you can also download the C# project files and see the files directly.
CodeProject - Youtube downloader using C# .NET
A project I am currently working on at work requires the ability to convert videos from other formats to the WMV format. We need to be able to convert virtually any video format that is commonly used to a WMV format. I am looking for a solution allot like On2's flix engine converts other video types to .flv videos. I am aware of the encoder that windows offers, but it has a very limited list of video types that it can convert from. Please let me know if you have any suggestions or opinions, or recommendation of software I can use to do this. I need to be able to do the conversions in batch and I need to be able to do them programmatically with C#.
Have you had a look at ffmpeg?
It seems to be at the core of many open source video conversion utilities, so I imagine you could use it in the scenario you describe.
SUPER, the name is really covering the load!
Well, first you have to be able to decode the file format. You need to set this up with directshow, which is very hard to work with. You can take a look at the mediaportal project for a directshow file player written in C#. Instead of using the video renderer at the end of the directshow graph, you would reencode the video and audio and mux them into a .wmv file. This is a very involved project to get right. You essentially have to mimic a player's ability to play any format and handle failure.
I've been very satisfied using Quick Media Converter.
I'm working on an ASP.NET app that allows users to upload video files. After the user uploads, I need to determine some of the attributes of the media - namely it's duration/length, resolution, and codec (if possible).
What's the simplest way to approach this? Should I use the WMP SDK - this seems to involve actually instantiating the media player on the server. Is there anything in the framework to do this, or do I need to rely on an external library?
I'm not concerned about displaying or streaming the video back to the user.
There is nothing in the framework, you will need some sort of library. The best I've seen (but it has been a year or so since I've looked) is taglib-sharp:
http://developer.novell.com/wiki/index.php/TagLib_Sharp
The site seems to be down right now, but I see that it's been ported to fink (for OSX) only a couple of months ago, so I assume that is temporary.
oops, just saw that you're not the first to ask a question along these lines and I'm not the first to suggest taglib-sharp:
View/edit ID3 data for MP3 files
(note: it supports audio and video files).
hth