I'm using AForge Video Source Player to playback a couple movie clips that exist in my local filesystem within a winforms application.
Example of my playback code:
videoSourcePlayer.VideoSource = new AForge.Video.AsyncVideoSource(new FileVideoSource(fileName), true);
videoSourcePlayer.VideoSource.VideoSourceError += VideoSource_VideoSourceError;
videoSourcePlayer.Start();
I found it odd it didn't showed any videos on production machines although it worked on my development machine. I went ahead and found this among the error logs.
This was outputted from the event VideoSourceError.
Did not find acceptable output video pin in the given source
Can someone tell me how do I solve this ?
Thank you.
Answer: Thanks to valter
Maybe you are missing a video filter for your particular video file. Try installing a filter/codec package.
Related
I'm completely new to this topic and I'm trying to build an app that can do this. I guess what I'm looking for is something similar to the IDM's link grabber. I once read on Stack Overflow(can't find the topic, sorry) about how IDM downloads YouTube videos and other stuff, and someone said when you are watching a video you can see that parts of the video highlights in grey and that means those parts are cached in your pc and what IDM does is gathering those parts and combining them. Someone else said IDM gets the logs from the network tab and uses them for downloading. Can someone guide me or give me a roadmap of what knowledges do I need for this task?
I'm trying to use the DirectShot.Net wrapper from "http://directshownet.sourceforge.net/" to extract frames from a number of video files.
Whenever I run the DxScan sample app. I get a "No combination of intermediate filters could be found to make the connection." This happens for WMV files, MP4 files, AVI files. Any media I point at the sample app.
If I open any of the videos using the GSpot codec tool and ask it to render the graph, it does so without problem. So the machine is definitely capable of playing the content.
I'm on Win 7 64 bit. The same error is thrown targeting x64, x86 or Auto. Including running Visual Studio as an Administrator.
I've modified the sample code to try and find the correct pin containing the video media type as suggested by Romain R below.
I'm using:
IEnumPins epins;
capFilter.EnumPins(out epins);
IntPtr fetched = Marshal.AllocCoTaskMem(4);
IPin[] pins = new IPin[1];
while (epins.Next(1, pins, fetched) == 0)
{
PinInfo pinfo;
pins[0].QueryPinInfo(out pinfo);
IEnumMediaTypes mtypes;
pins[0].EnumMediaTypes(out mtypes);
AMMediaType[] types = new AMMediaType[1];
while(mtypes.Next(1, types, new IntPtr()) == 0){
var majorType = types[0].majorType;
if (majorType == MediaType.Video)
{
//This is never reached
}
}
}
For MP4 files, it's never hitting the commented line above. However for WMV files, the demo will now run correctly.
Presumably, this is because it isn't finding an appropriate MP4 file filter. Which is obscure as the content will play fine in windows media player.
Is this a likely cause?
DxScan sample is building a filter graph in an unreliable way, in particular is makes an assumption that the first pin it grabs from the source filter supplied for a media file is a video pin. It is not always the case. A better graph building approach should be working out fine. You might want to step through to find out at what line you have an error. Most likely, it is going to be connection of Sample Grabber Filter input pin.
UPD. Note that it might so happen that original filter has no input pins, it requires additional filters in between, so called parser/demultiplexer filters which convert streams into video frames and audio samples. DirectShow API offers Render* methods to assist in graph building in terms of suggesting required links of this chain and direct connection DxScan is doing might or might not work out.
That is, DxScan might be not the best sample to start from, MSDN samples/reference for native API are perhaps better for taking off the ground with DirectShow.
Your playground and primary research and API exploration tool should be GraphEdit from Windows SDK (GraphStudio, or GraphStudioNext as alternate improved options), not a DirectShow.NET wrapper library sample.
Which is obscure as the content will play fine in windows media player.
WMP does not use DirectShow for playback.
I want to display live image from the usb PC webcam using C# windows application in Visual Studio 2010. I have searched about that and find the link http://channel9.msdn.com/coding4fun/articles/Look-at-me-Windows-Image-Acquisition but when i tried this code
WIA.CommonDialog class1 = new WIA.CommonDialog();
Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);
if (d != null)
{
settings.DeviceID = d.DeviceID;
settings.Save();
}
I am getting the giving compilation error
error CS0103: The name 'settings' does not exist in the current context
And I am not able to find out the solution for this error.
Can anybody body please tell me what would be the solution for this error?
And Is there any other best method to display live images from usb webcam?
Any help would be appreciated....
Thanks in Advance..
It looks as though you haven't defined a settings object, however it doesn't seem to be in the tutorial either. Personally though I would use AForge.NET library as this provides an extremely easy interface to webcams.
http://aforgenet.com/
Tutorial: http://vimeo.com/7526663
Thanks
AForge.NET is very powerful library. But for testing purporse or simple project you could use WIA. Take a look at this tutorial - small example how to start
hi i am following this link
http://www.codeproject.com/KB/directx/directxcapture.aspx
to capture data from webcam.Its working fine but when i pause and do resume then the file that contains data, its size increases but old data is lost and only new data persists.
can anybody point me towards a working example/tutorial where pause feature works.
i tried/searched many links but still landed nowhere.
can anybody provide me some help!!!
There are a number of comments about this in the article:
Searching "pause" inside the article comments
All search results for "pause" in the article comments
I tried the pause behavior of directShow.net but somehow it did not worked.
when i paused a avi file was created and when i resumed i found that the new contents are written on the previous file. the size of the file increased but the older content was washed away.
So i tried this:
1) When i paused a file say test.avi was generated.
2) when i resumed i renamed test to test1.avi and created new test.avi
file and merged them when user clicks on stop.
In this way i achieved pause feature. though its indirect but its still working for me..
hope i could implement the direct way.
I'm trying to get the duration for an audio file in c#.
I got the following code to work on my local machine but when I deploy it to a windows server 2008 box it always returns a duration of 0 for .avi and .wav files.
WindowsMediaPlayerClass wmp = new WindowsMediaPlayerClass();
IWMPMedia mediaInfo = wmp.newMedia(filePath);
return mediaInfo.durationString
I have windows media player 11 installed on the server.
Any help would be most appreciated
I don't have experience with "WindowsMediaPlayerClass", but I have used TagLibSharp extensively, which is what I try to use for such things - it supports a pretty broad set of formats and that makes it's API much more usable that the built-in support in .NET
http://developer.novell.com/wiki/index.php/TagLib_Sharp
Quite possibly simply using TagLibSharp will solve your problems.
(Note that taglibsharp is maintained by the banshee project, but is hosted # novell for apparently historical reasons. I don't know about the details, but that can make contacting the devs a little confusing)
To retrieve duration info, media file must be opened first.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd564790(v=vs.85).aspx#Y656
To retrieve the duration for files that are not in the user's library, you must wait for Windows Media Player to open the file; that is, the current OpenState must equal MediaOpen. You can verify this by handling the AxWindowsMediaPlayer._WMPOCXEvents_OpenStateChange event or by periodically checking the value of AxWindowsMediaPlayer.openState.
The link also has sample codes for C#.
If you don't like to play the video, you may use the IWMPMedia class:
http://johndyer.name/post/Retreiving-the-duration-of-a-WMV-in-C.aspx
My guess is that the media player isn't installed (it's not by default on server SKUs).
Did you try installing the desktop experience package?