0

I was happily improving my C++-program where I read videos via directshow. Now I tried to also write videos which was also nicely working.
Then came the search for an appropriate codec (thought about vob/ogg)...
However, suddenly today the video was displayed really slowly.
And now that I uninstalled any additional codecs I installed before, the video won't play at all.
The reason seems to be CComQIPtr< IMediaSeeking, &IID_IMediaSeeking > pSeeking( pGraph ); and hr = pSeeking->SetPositions( &Startzeit, AM_SEEKING_AbsolutePositioning,NULL, AM_SEEKING_NoPositioning ); gives an error, SetPosition is not supported at that time... acutally at any time.
also hr=pSeeking->GetDuration(&duration) returns 0 and the corresponding AM_MEDIA_TYPE mt; I use to get the framepersecond has an empty format-type. (pbFormat is Null).

Did I unintentionally installed/uninstalled something important?
Have you heard of similar problems?
As I said, some days ago the same video and source-code was working fine (I commented by changes out by now).
I would like to give you more source-code but it is kind of long but if you think it would be helpful I will add it of course.

Regards,
Julian

Here is the source-code: http://pastebin.com/jMdWejH9
It's of course only a part of the whole code, but I think this is the main part as here are all filters inserted.
Keep in mind that this actually worked until some days before!^^
The first part is the variable-deklaration (all important variables as fas as I could tell, the second is the function called)

Community
  • 1
  • 1
Julian
  • 493
  • 4
  • 22
  • How do you build your graph? Register your graph in the [running object table](http://msdn.microsoft.com/en-us/library/windows/desktop/dd390650(v=vs.85).aspx) and connect to it with GraphEdit or [GraphStudioNext](http://code.google.com/p/graph-studio-next/) to look what filters where loaded. – CPlusSharp Nov 12 '12 at 18:25
  • Might be a wrong/missing demultiplexer/parser. – wimh Nov 12 '12 at 18:34
  • If you have your playback unexpected way and/or with issues, the first thing to check is the effective topology of the graph. Seeing unexpected filters on it you will understand what's wrong. Or otherwise you would be able to post it here. – Roman R. Nov 12 '12 at 19:14
  • @CPlusSharp Thanks for your suggestion! I inserted the source-code at the end of my question. I can't actually say I know much about building filters or heard about GraphEdit or GraphStudioNext. I just needed to get the picture delivered by the camera so I stitches something up until it worked. please keep in mind it actually worked until I recently installed and uninstalled the same codec-pack... – Julian Nov 12 '12 at 22:38
  • @Wimmel do you know How I can figure out which one I'm using and which one I would need? I think I could figure out how to get it then^^ – Julian Nov 12 '12 at 22:39
  • @RomanR. I don't really understand how I would see unexpected filteres within the source-code I wrote on my own... Or is that different from the effective topology? I inserted the source-code I was talking about at the end of my question. could you take a quick look at it or tell me how I can get the effective topology, please? – Julian Nov 12 '12 at 22:42
  • If you render a file in DirectShow, the framework uses the installed codecs/filters in the system. If you remove some codecs it takes another or breaks because it can't render. To know wich filters the framework uses you can try to render the file in GraphEdit or GraphStudioNext. (Just drop the file on one of these programms and see the filtergraph). We got the best results with the codec pack ffdshow-tryouts and the Haali Media Splitter for our player. – CPlusSharp Nov 13 '12 at 07:03
  • Why do you grab every single frame and present it? You can use the vdeo-renderer for this. – CPlusSharp Nov 13 '12 at 07:07
  • @CPlusSharp Thanks for your suggestion! I will try to analyze my video-file with the programs you mentioned. I try to get every frame or more precisely every pixel of every frame as the program is supposed to analyze the camera's output. I wrote some functions for basic image-correction and to find different shapes appearing over brightness-treshholds when some other circumstances are met, producing a histogram etc. I suppose this could also be done writing some filters directly in directshow, but for that I'm too inexperienced, so I guessed getting the image's bytearray will do for this. – Julian Nov 13 '12 at 10:18
  • @CPlusSharp Thanks again for your advice! the program told me that the microsoft dvd-decoder was used now. After installing ffdshow-tryouts everything works again! I would give you an upvote and a green hook if this would have been an answer instead of a comment^^ – Julian Nov 13 '12 at 11:37
  • @Julian: you look at real topology you are *de facto* having by placing graph on ROT and/or using spy. Then you will match the witnessed onto your source code and realize that some filters you add from code, and others are added for you. If and when those "automatic" filters change, you might have unexpected results. – Roman R. Nov 13 '12 at 12:21

1 Answers1

1

If you render a file in DirectShow, the framework uses the installed codecs/filters in the system. If you remove some codecs it takes another or breaks because it can't render. To know wich filters the framework uses you can try to render the file in GraphEdit or GraphStudioNext. (Just drop the file on one of these programms and see the filtergraph). We got the best results with the codec pack ffdshow-tryouts and the Haali Media Splitter for our player.

CPlusSharp
  • 881
  • 5
  • 15
  • Thanks! Say, do you also know how to solve another codec-problem? I tried using the ffdshow video codec (mjpg) and the AVIStreamWrite-function of the avi_utils libary to save a video in another program. using Microsoft RLE, Video 1, Intel IYUV, Cinepak and Lagarith codecs, everything works well. just with fdshow it tells me imediately it has an address-violation for writing to a hanging process... is there some other de-/encoder missing or isn't that compatible? – Julian Nov 13 '12 at 12:50
  • I'm no expert for ffdshow, but ffdshow works a little different then the other codecs you mentioned. ffdshow has a bunch of different codecs internally. What codec from inside ffdshow do you use? Maybe you should ask this question on the ffdshow forum or as sepperate question. – CPlusSharp Nov 13 '12 at 14:57