Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all 1079 articles
Browse latest View live

Get a BITMAPINFO structure by using IMFVideoDisplayControl.GetCurrentImage

$
0
0

Hello,

What I'm trying to do is the following:

I have a video player and I would like to get a BITMAPINFO structure.

Media Foundation offers the possibility to get a BITMAPINFOHEADER by using IMFVideoDisplayControl.GetCurrentImage.

So far I got the Header and put it in the bmiHeader section of the BITMAPINFO.

What I still got to do is populate the bmiColors section of the BITMAPINFO structure.

How can I do this?

My function looks like this:

BITMAPINFO* ToTopoBuilderMF::GetCurrentImageBitMapInfo()
{
  BITMAPINFO*       pbmfh = NULL;
  BITMAPINFOHEADER  Bih;
  BYTE*             pbDIB;
  DWORD             pcbDib;
  LONGLONG          llTimeStamp;

  Bih.biSize = sizeof(BITMAPINFOHEADER);

  if (m_pVideoDisplay)
  {
    m_pVideoDisplay->GetCurrentImage(&Bih,&pbDIB,&pcbDib,&llTimeStamp);
    pbmfh->bmiHeader = Bih;
      
  }

  CoTaskMemFree(pbDIB);
  return pbmfh;
}

Best Regards,

Alin Ionascu


Output Format of a Video Device

$
0
0

Hello,

I am an absolute beginner in Media Foundation so I have a basic question. I am trying to find out the output format of a video device(my webcam) and print it out on screen. I want to figure out the major type and the subtype. So I want something like{ MFMediaType_Video, MFVideoFormat_RGB32 }.

This is what I have:

BYTE* my_name=NULL;
UINT32 size=0;

//m_ppDevices is a valid video capture device(webcam)	
m_ppDevices->GetBlobSize(MF_DEVSOURCE_ATTRIBUTE_MEDIA_TYPE, &size);	
my_name = new BYTE[size];

m_ppDevices->GetBlob(MF_DEVSOURCE_ATTRIBUTE_MEDIA_TYPE,my_name, size,NULL);

std::cout<<my_name<<std::endl;

This prints out "vids". Which is fine for my "Major Type". I just can't get the subtype. Any help would be appreciated.

unresolved external symbol _MFEnumDeviceSources@12

$
0
0

Hi,

I'm new to windows MF / C++ programming and i have a basic code that lists capture devices. But the linker still can't resolve the only 2 Media Foundation functions called in the code. But, the headers of the MF functions are well included in the code and the libraries of the linker are well pointing on the lib files of the headers. So, what is wrong with the code or the configuration? Thanks.

// ListCaptureDevices.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <new>
#include <windowsx.h>
#include <d3d9.h>
/* include Media Foundation main library */
#include <mfidl.h>
#include <Mfapi.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <mfreadwrite.h>
#include <mferror.h>
#include <strsafe.h>



using namespace std ;


void WINAPI manage_hresult_s_ok(HRESULT, string) ;

void WINAPI manage_lresult_s_ok(LRESULT result, string) ;

// manage return values that should be S_OK
void WINAPI manage_hresult_s_ok(HRESULT result, string message){
   if (result != S_OK) {
     cerr << message << endl ;
   }    
}      
void WINAPI manage_lresult_s_ok(LRESULT result, string message){
   if (result != S_OK) {
     cerr << message << endl ;
   }    
}      



int _tmain(int argc, _TCHAR* argv[])
{
	 unsigned int nbListedMediaSources ;
     // the interface defining the criteria store
     IMFAttributes * mediaSourcesCriteriaAttributesInterface ;
     manage_hresult_s_ok(MFCreateAttributes(&mediaSourcesCriteriaAttributesInterface, 0), "error creating attributes")  ; // initial size at 0,
     // set the criteria as video capture device type
     mediaSourcesCriteriaAttributesInterface->SetGUID(MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_GUID) ;
     IMFActivate *** mediaSourcesActivationObjects = 0 ;
     // list all video capture devices avalaible
     HRESULT listing_result = MFEnumDeviceSources(mediaSourcesCriteriaAttributesInterface, mediaSourcesActivationObjects, &nbListedMediaSources) ;
     manage_hresult_s_ok(listing_result, "error while getting the capture devices list") ;
     cout << "found " << listing_result << " capture devices" ;
     /*
     !!! DONT FORGET
     should (once done with IMFActivate pointers from listed media sources) release the pointers
     and call CoTaskMemFree to free tha array memory which was automatically allocated
     */
	return 0;
}

Seeking in Media Source

$
0
0

Hi,

I have developed a Media source, while seeking with my media source i will dispatch from nearest key frame for that new seek position. But the key frames are dropped by the framework without sending it to decoder. So the decoder is failing to decode while seeking. In this case i'm sending new seek time as Event data in MESourceStarted, MESourceSeeked, MEStreamStarted, and MEStreamSeeked events as described in MSDN.

How to notify the framework to send those key frames to decoder without dropping it?

if i mention my key frames time as Event data in the above mentioned events, the framework delivers key frame samples to decoder. So decoder will be able to decode properly but these frames also displayed by video renderer. How to avoid this situation in Media Source during seek?

Multimedia support in a .NET 3.5 application

$
0
0

I have an application that is being developed in C# using WPF/Silverlight at the front end. On button clicks, I need to initiate streaming video, voice chat, text chat and if the user desires, even desktop sharing sessions.

My questions:

1.
Are there any third party components which would enable the above communication channels? Even separate components to enable video streaming, voice chat, text chat and desktop sharing will do.

2.
In case there are no third party components, is there any way that the .NET Framework itself can be leveraged to provide the above?

I have also been looking at the Live Meeting Service API. It seems to address my concerns to some extent. Please let me know your ideas.

Other than the above, any help on architecting such an application would be greatly appreciated.

Loopback recording using IMFAsyncCallback

$
0
0

Hi,

i have plan to put my loopback recording of the systems audio mix in a seperated thread to not block the main thread and to avoid audio loss i experienced and as measured and described by othershere.

But before i start implementing the Async Callback and then create an Async Result and put a work item into a "private" work queue there are a few things i would like to know. First and most important question is :

Can i write audio samples with the sink writer while also writing video samples at the same time ? Because i have 2 streams on my sink writer i also have 2 MFTs there, one for video and one for audio. MSDN says that by default a MFT is using synchronous methods, but can the sink writer be accessed multithreaded so that it can deliver to the MFTs for the streams simultaniously ? Does a MFT directly get the sample pointer and process the data instantly when the ->WriteSample function is called, does the sink writer accept orders from multiple threads and send the sample pointers as soon as possible to the MFTs so that they can process the data ( the sink writer calls ->ProcessInput on the MFT right ) ? This would imply that the sink writer would use his own work queue right ?

And another question would be how to hold audio sync then. My app encodes real time/live the system audio and the backbuffer of games. Currently my app is working and the only thing left is audio synchronisation, my audio plays a bit to fast ( speeded up ) and ends before video ends. How to work with IAudioClient->Start() and Stop() on real time encoding apps, is it just math or is there a straight foward manner ?

regards

coOKie




I do not know why the encoder 9 automatically stop encode

$
0
0

Enviorment: windows server 2008 , media encoder 9, my software use encoder9 secondary development 

problem: When I create 1 encoder and start encode , file or apture card, everything is ok. But when I create 3 encoders and start encode, the one or two of them will automatically stop in a few minutes later, and there is no any exception and the errorcode of stopped encoder is 0. Because the encoder stopped without any sign ,so I don't know how to find the reason of that, can you help me? thank you, best wishes to you, please help me!

Editing video file to blank out non relevant video data

$
0
0

Input: offset, duration

The video is stored in an .m4v format and i need to open the video file and edit the contents of the file at the given offset for the given duration and write the file back to the same location. Is there an example that i can look at or can i get some pointers on how to proceed ?

thanks in advance


How to play multi video in same EVR

$
0
0

My OS is win7

i want to use same mediasession control multi video playback

i don't have any idea

please help

thnak you

MFT H264 decoder is working fine in release mode but not working in debug mode

$
0
0

I am developing a media player for windows. I have recently developed a H264 decoder using MFT. When i run the build in debug mode, am not able to see the decoded frames. But some pink color frame is displayed. 

But while running in release mode, i am getting the actual decoded video frames. 

Anyone know why is it behaving differently for different methos of building?

Does the USB video class driver support burst mode capture ?

$
0
0

Hi,

I have a HP HD 5210 web camera.

The web cam supports high burst capture.

Does the latest UVC driver support this feature - high burst capture ?

My OS is windows 7 64-bit.

If the 'high burst capture' feature is supported in the UVC driver,

can you point me to Media Foundation SDK samples that use this operation ?

Thanks for your help

Nikhil.

H264 Decoding using Source Reader and Custom Bytestream

$
0
0
I am trying to decode H264 data on Win 7.  My source of compressed H264 data is not a file or network, the source is the memory itself. I get the H264 compressed data in the memory frame by frame. I want to synchronously decompress each frame as I get it. I am trying to follow the example in the link http://msdn.microsoft.com/en-us/library/dd389281(VS.85).aspx. But the example uses a URL to create the source reader. But since my source of compressed data is memory I am thinking of writing custom byte stream which reads data from memory.

1. Is it the right approach?

2. If the data is read from file(as in a normal case) then there must be a memory copy required before the decompression happens. Can I avoid this memcpy since I already have the data in memory?

How to get information about SPS and PPS from HEVC steam?

$
0
0
Hello!
In my application I use media source containing HEVC media type. 
To decode video from this media source I want to use my own plug-in.
But my plug-in needs SPS and PPS information, which isn't contained in bit stream from media source.
I checked it while analizing byte array contained in media source.
Could you tell me how I can get information about SPS and PPS from HEVC bit stream?

how to uninstall Classic Style Ui in windows 8? - Yomi need help!!

$
0
0
well, hello I am Brazilian, my English is not perfect but I need help!

Classic Style Ui installed on my windows 8, it brings back the start button windows 7 .. but I installed unintentionally and now do not know how to uninstall and get back to the main interface of windows 8! can someone help me uninstall Classic Style Ui!
thanks!!
by: Yomi :)

How to reinitialize crashed mediaelement?

$
0
0

Hi

i am creating a video player which plays video through playlist.

i am testing the application with HD videos like 1080 p. after playing playlist for some 10 hours

suddely there show nothing in the screen. i am using Dispatcher timer for the playlist to switch to next in the list

where timer keepon going but there come nothing in the screen. i think Mediaelement crashed.

to start again i have the close and reopen the application. i there any way that playing the video without

reopening the mediaelement.

Thank you


MediaElement opening url streams

$
0
0

private void Radio_Click(object sender, RoutedEventArgs e)

{ mediaElement1.Source Radio = new Uri "url-of-radio-stream"; }

Hello, i'm trying to make an WPF application that can stream radio in my app, using the MediaElement in C# visual studio 2012.

and what i want is to have multiple buttons with names of radio stations but since I can't find .asx files of radio streams I like, i've heard that with the WPF-application it can also play from a URL, how can I make that work?

Jens,

AAC Encoder returning MF_E_TRANSFORM_NEED_MORE_INPUT despite feeding it plenty of input

$
0
0

Using Media Foundation to generate MP4 audio and video file.  Don't want to use the file sink approach - we are generating the container ourselves and just need the transform to compress the audio data.

The video H.264 part is working fine using the Media Foundation H.264 encoder.

However, using similar code to do the AAC audio does not work.

This line:

FAudioMFTransform->ProcessOutput(0, 1, &FAudioMftOutputDataBuffer, &status);

returns MF_E_TRANSFORM_NEED_MORE_INPUT, regardless of how many times ProcessInput is called, and despite all transform configuration, media type selection etc. succeeding.  (ProcessInput also succeeds).

How can I track down why this is happening?

volume controls

$
0
0

I do not have volume any more, When I go to sound to adjust volume its not highlighted for me to adjust says no active mixer devices. What can I do to correct this?

A Bug of AVI Media Source

$
0
0

I find a problem of system AVI media source.

I have some avi files with mp3 audio, and topoedit can playback these files correctly.

my app want to pass through the audio stream to ts container, i found some bytes of first audio frame was dropped by AVI media Source, so i can't generate right ts stream. I also have check the media type, not found the data.

Does somebody know why?


haha

About AAC decoder config

$
0
0

Hi all,

I have developed a MKV media source, it's ok to play video, but audio is not, and i have check aduio parameter, it's correct. This is my config and file info:

WAVEFORMATEX afmt;
WAVEFORMATEX* wfe = &afmt;
ZeroMemory(wfe, sizeof(WAVEFORMATEX));
wfe->nChannels = Channels;
wfe->nSamplesPerSec = SamplingFrequency;
wfe->wBitsPerSample = BitDepth;
wfe->wBitsPerSample = wfe->wBitsPerSample==0?16:wfe->wBitsPerSample;
wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;

int size = sizeof(HEAACWAVEINFO) + CodecPrivate.GetCount();
HEAACWAVEINFO* pWaveInfo = (HEAACWAVEINFO*)malloc(size);
memset(pWaveInfo, 0, size);
memcpy(&(pWaveInfo->wfx), wfe, sizeof(WAVEFORMATEX));

pWaveInfo->wAudioProfileLevelIndication = 0xfe;
pWaveInfo->wPayloadType = 0;//raw aac
pWaveInfo->wStructType = 0;

pWaveInfo->wfx.cbSize = size- sizeof(WAVEFORMATEX);

if(CodecPrivate.GetCount() > 0)
	memcpy((BYTE*)(pWaveInfo + 1),CodecPrivate.GetData(), CodecPrivate.GetCount());

HRESULT hr = MFCreateMediaType(&pType);
if (SUCCEEDED(hr))
{
	hr = pType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
}

hr = MFInitMediaTypeFromWaveFormatEx(pType, (const WAVEFORMATEX*)pWaveInfo, size);
hr = pType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_AAC);

free(pWaveInfo);
pWaveInfo = NULL;
General
Unique ID                                : 230449330490480222084075823367818245987 (0xAD5EED37552E8C35B04FFC7FF40AF763)
Complete name                            : E:\clips\Jack_Jac_Attack__720p.mkv
Format                                   : Matroska
Format version                           : Version 1
File size                                : 154 MiB
Duration                                 : 4mn 44s
Overall bit rate                         : 4 542 Kbps
Encoded date                             : UTC 2012-09-05 04:07:16
Writing application                      : mkvmerge v2.4.0 ('Fumbling Towards Ecstasy') built on Oct 11 2008 20:13:15
Writing library                          : libebml v0.7.7 + libmatroska v0.8.1

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 4mn 44s
Nominal bit rate                         : 4 608 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.209
Writing library                          : x264 core 80 r1378+57 6f6b50a
Encoding settings                        : cabac=0 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=0 / wpredp=2 / keyint=250 / keyint_min=25 / scenecut=40 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=4608 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : Main
Codec ID                                 : A_AAC
Duration                                 : 4mn 44s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Default                                  : Yes
Forced                                   : No

thanks

BR

Julis


haha

Viewing all 1079 articles
Browse latest View live