I noticed that there are three threads mentioning Mpeg2VideoInfo, but I think that a new thread would be better because it explains my problem more specific.
I try to get the StreamBufferSink working with Mpeg2. I figured out how to add the Mpeg2 de-multiplexer. But still things go wrong. With AMMediaType structure data I can add the de-multiplexer to the graph, but LockProfile fails. It has partly to do with the video data (Mpeg2VideoInfo). I did not provide the data structure yet because I do not know how to iniatialize. I used the property page from the demultiplexer. Looking at the settings from my code it lookes okay (the only thing that is really important is the mapping, the property page just shows the proper numbers). When configuring the pins via the property page (instead of the code) then a Mpeg2VideoInfo is provided. Then LockProfile succeeds. BUt when recording starts, no audio/video is recorded. I was wondering why? Maybe there is still a mismatch in the formats. I was also wondering which audio format I must use (for a Hauppauge PVR150-MCE). The hardware MPEG2 encoder provides an Mpeg2-stream but I do not know it it is Mpeg1-audio or Mpeg2-audio. I also do not know if this is causing the problem or are other settings incorrect?
I will try to dump that. But even than, no file recording happens.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 656 pin is a little bit specific but that also counts for the Hauppauge Mpeg2 encoder that should be connected to it. I added the pin to directshowlib because it made life easier. An alternative is to add the specific pin Guid to your own program. Renderstream expects a Guid not a specific pin type. The Guid can be found in the .inf file for the corresponding TV-card or in the registry. And probably also by code, that would be the easiest method.
The article is one of the best, but the example is C++. Another but is that for the Hauppauge card the Mpeg2 stream will mostly be used for Mpeg2 and dvr-ms file saving (I think). Has your Hauppauge TV-card no preview pin? Or is it USB? Which card type you have?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! Only, the link does not work. I downloaded DxSbe.zip, a SourceForge example (I can not check that right now). I forgot the exact results, I think it did not work. The one I got work (without Mpeg2) is a C++ version from the thecodeproject and that one was also using DVEnc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I checked DxSbe.zip, this example works. I was wondering what I have to with ReadConfig. And I also do not understand ReadConfig. A key is read, but it is unclear why that is needed. Also unclear what the exact key is.
(int)HKEY.CurrentUser, @"Software\Microsoft
does not look similar to
HKEY_CURRENT_USER\Software\Microsoft\DVR
I just wondering how important this is, I do not use this yet. Also is DVR added by default?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made a dump of the Mpeg2VideoInfo as the property page is making it. The dump is specific NTSC, so not usable for PAL. Also The Mpeg2VideoInfo contains a byte array at the end or the last field looks confusing. It is not meant for a DWORD or a WORD. The value in cbSequenceHeader maps exactly to the remaining space in bytes which is not specified. So it will be a little bit guessing for me how to initialize the attributes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got video and sound via StreamBufferSource! I made a number of modifications:
- Added DsError checks because the renderStream deMux failed without giving an error
- Added the Mpeg2 hardware video encoder explicit (the reason that the renderStream failed)
- Added cat and med to renderStream
- Used a modified DirectShowLib version so
RenderStream is able to build the graph with a specific capture pin (Pin656) which my capture device provides
I noticed that after some time, the program gives an error. I did not figure (out) yet, what is causing this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe the Hauppauge card outputs mpeg2 streams. Working with these is a little different.
I would recommend starting with GraphEdit. It allows you to play with filters manually rather than programmatically. Once you have it working in graphedit, then you can translate that to code. At least you will know what filters you need to add, and what order to connect them in.
There's a good artical here that talks about working with mpeg cards.
This code was still too rough to even be included as a sample. I just barely got it working. However, I thought it might be useful, and apparently it was.
As for the error, check out this thread to see if the symptoms appear to be the same:
Well I saw other programs that did not work and were coded badly. This example explains itselfs. I think the video and audio data needs to be updated to get no errors when using CreateRecorder. Parts of that you already coded.
I am strugling with the de-multiplexer. It seems that the normal De-Multiplexer can not render audio/video (via the proper decoder) to the default audio/video renderer. I found one from Pinnacle that seems to work better in graphedt. I tried to analyse the Mpeg2 stream, but my Mpeg2 decoder gives major type Stream and media subtype Mpeg2_Program. For analysing via PSI Parser this will not work. I think that the de-multiplexer cause more problems, tomorrow I will test my program with the Pinnacle version. Problem might be the audio format (Mpeg1AudioPayload1 and 44,1kHz).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The code changes were very little (in my own code), so I did created my first dvr-ms file right now with my own program (using the Pinnacle demux). There was no need to populate the data structures because this demux have fixed output pins. Maybe there are still problems with the current data, maybe it just a combination of mpeg2 decoder and de-multiplexer. Maybe there are more people with similar experiences.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
THanks for the information. Then it should going to work! At this moment I do not know if the audio is really Mpeg1, I only know this works. I will go on step by step. Today I made some changes to the audio/video data and in DxSbe2 both demultiplexers seems to work now. Only, DxSbe2 does not release the resources properly yet. I loose audio and also when the graph is just aborted, this does not give an output file. I added code for stopping the graphs. Did not make code to release the filters properly, that is a little bit more work. I will try to port the changes to my application, it might be possible that I have similar problems as first in DxSbe. Advantage of DxSbe it is very basic so no interactions with other features.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Main problem seems to be the stream ID, the ones (eg 0xba, oxbb) that can be selected via the Mpeg-2 Demultiplexer property page, do not work. The ones used in DxSbe works. Apart from this, also the AMMediaType data needs to be properly formatted (including video info and bitmap information header).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I noticed that there are three threads mentioning Mpeg2VideoInfo, but I think that a new thread would be better because it explains my problem more specific.
I try to get the StreamBufferSink working with Mpeg2. I figured out how to add the Mpeg2 de-multiplexer. But still things go wrong. With AMMediaType structure data I can add the de-multiplexer to the graph, but LockProfile fails. It has partly to do with the video data (Mpeg2VideoInfo). I did not provide the data structure yet because I do not know how to iniatialize. I used the property page from the demultiplexer. Looking at the settings from my code it lookes okay (the only thing that is really important is the mapping, the property page just shows the proper numbers). When configuring the pins via the property page (instead of the code) then a Mpeg2VideoInfo is provided. Then LockProfile succeeds. BUt when recording starts, no audio/video is recorded. I was wondering why? Maybe there is still a mismatch in the formats. I was also wondering which audio format I must use (for a Hauppauge PVR150-MCE). The hardware MPEG2 encoder provides an Mpeg2-stream but I do not know it it is Mpeg1-audio or Mpeg2-audio. I also do not know if this is causing the problem or are other settings incorrect?
I will try to dump that. But even than, no file recording happens.
The 656 pin is a little bit specific but that also counts for the Hauppauge Mpeg2 encoder that should be connected to it. I added the pin to directshowlib because it made life easier. An alternative is to add the specific pin Guid to your own program. Renderstream expects a Guid not a specific pin type. The Guid can be found in the .inf file for the corresponding TV-card or in the registry. And probably also by code, that would be the easiest method.
The article is one of the best, but the example is C++. Another but is that for the Hauppauge card the Mpeg2 stream will mostly be used for Mpeg2 and dvr-ms file saving (I think). Has your Hauppauge TV-card no preview pin? Or is it USB? Which card type you have?
If you like, you can try http://www.LimeGreenSocks.com/DShow/DxSbe2.zip. I'm using it on my Hauppauge WinTV PVR USB2. Might be close enough to be useful.
Unlike my DxSBE sample, this one doesn't using DVEnc. It uses the MPEG straight from the hw.
Thanks! Only, the link does not work. I downloaded DxSbe.zip, a SourceForge example (I can not check that right now). I forgot the exact results, I think it did not work. The one I got work (without Mpeg2) is a C++ version from the thecodeproject and that one was also using DVEnc.
Make sure the trailing period (.) doesn't get included in the URL.
I checked DxSbe.zip, this example works. I was wondering what I have to with ReadConfig. And I also do not understand ReadConfig. A key is read, but it is unclear why that is needed. Also unclear what the exact key is.
(int)HKEY.CurrentUser, @"Software\Microsoft
does not look similar to
HKEY_CURRENT_USER\Software\Microsoft\DVR
I just wondering how important this is, I do not use this yet. Also is DVR added by default?
I made a dump of the Mpeg2VideoInfo as the property page is making it. The dump is specific NTSC, so not usable for PAL. Also The Mpeg2VideoInfo contains a byte array at the end or the last field looks confusing. It is not meant for a DWORD or a WORD. The value in cbSequenceHeader maps exactly to the remaining space in bytes which is not specified. So it will be a little bit guessing for me how to initialize the attributes.
Yes, the dot was the problem!
I got video and sound via StreamBufferSource! I made a number of modifications:
- Added DsError checks because the renderStream deMux failed without giving an error
- Added the Mpeg2 hardware video encoder explicit (the reason that the renderStream failed)
- Added cat and med to renderStream
- Used a modified DirectShowLib version so
RenderStream is able to build the graph with a specific capture pin (Pin656) which my capture device provides
I noticed that after some time, the program gives an error. I did not figure (out) yet, what is causing this.
sorry i restarting this thread.
I'm having problems with the the renderpins method
// use the media type to render the stream
hr = icgb2.RenderStream(null, amt[0].majorType, pPin[0], null, null);
The exception message is "Class not registered" my specific capture pin is also 656. Can you share your custom Directshowlib?
I have a Hauppauge WinTV card.
I believe the Hauppauge card outputs mpeg2 streams. Working with these is a little different.
I would recommend starting with GraphEdit. It allows you to play with filters manually rather than programmatically. Once you have it working in graphedit, then you can translate that to code. At least you will know what filters you need to add, and what order to connect them in.
There's a good artical here that talks about working with mpeg cards.
http://www.codeproject.com/directx/MPEG2_Capture_Device.asp
This code was still too rough to even be included as a sample. I just barely got it working. However, I thought it might be useful, and apparently it was.
As for the error, check out this thread to see if the symptoms appear to be the same:
http://msdn.microsoft.com/newsgroups/default.aspx?query=%22SBE+creates+the+second+backing+file%22&dg=microsoft.public.win32.programmer.directx.video&cat=en-us-msdn-graphics-dx&lang=en&cr=US&pt=9c954c37-1ed1-4846-8a7d-85fc422d1388&catlist=8FAA1A23-8726-4970-BB29-E2EF4552F734%2C774F24A2-F71F-425F-AC2B-DC48AB0DA5C9&dglist=&ptlist=&exp=&sloc=en-us
Well I saw other programs that did not work and were coded badly. This example explains itselfs. I think the video and audio data needs to be updated to get no errors when using CreateRecorder. Parts of that you already coded.
I am strugling with the de-multiplexer. It seems that the normal De-Multiplexer can not render audio/video (via the proper decoder) to the default audio/video renderer. I found one from Pinnacle that seems to work better in graphedt. I tried to analyse the Mpeg2 stream, but my Mpeg2 decoder gives major type Stream and media subtype Mpeg2_Program. For analysing via PSI Parser this will not work. I think that the de-multiplexer cause more problems, tomorrow I will test my program with the Pinnacle version. Problem might be the audio format (Mpeg1AudioPayload1 and 44,1kHz).
The code changes were very little (in my own code), so I did created my first dvr-ms file right now with my own program (using the Pinnacle demux). There was no need to populate the data structures because this demux have fixed output pins. Maybe there are still problems with the current data, maybe it just a combination of mpeg2 decoder and de-multiplexer. Maybe there are more people with similar experiences.
I wrote a small application that record a BDA channel to a dvr-ms file with the SBE Sink filter and i never have toubles with the Microsoft Demux...
Digital TV here in France nerver broadcast MPEG-1 audio tracks but only MPEG-2 or AC-3 so i don't know if this is the problem.
THanks for the information. Then it should going to work! At this moment I do not know if the audio is really Mpeg1, I only know this works. I will go on step by step. Today I made some changes to the audio/video data and in DxSbe2 both demultiplexers seems to work now. Only, DxSbe2 does not release the resources properly yet. I loose audio and also when the graph is just aborted, this does not give an output file. I added code for stopping the graphs. Did not make code to release the filters properly, that is a little bit more work. I will try to port the changes to my application, it might be possible that I have similar problems as first in DxSbe. Advantage of DxSbe it is very basic so no interactions with other features.
Main problem seems to be the stream ID, the ones (eg 0xba, oxbb) that can be selected via the Mpeg-2 Demultiplexer property page, do not work. The ones used in DxSbe works. Apart from this, also the AMMediaType data needs to be properly formatted (including video info and bitmap information header).