I've got a small program which I use to extract the play length, width and height of .mp4 files.
The problem I'm encountering is that for the files over 2GB in file size, the DirectShowLib seems to not find the video stream so I can't get the correct width/height.
If I open the files using MediaInfo for example, this loads no problem.
My application is compiled for x64 and I'm using DirectShowLib 2.1.0.
Is there something I'm missing.
Below is the code I'm using.
Thanks
Anubis
IMediaDet_MediaDetails=null;AMMediaType_MediaType=null;_MediaDetails=(IMediaDet)newMediaDet();// CHECK FILE EXISTS AND LOADFileInfofi=newFileInfo(_FileName);if(!fi.Exists){thrownewException("File doesn't exist");}// END IFDsError.ThrowExceptionForHR(_MediaDetails.put_Filename(_FileName));// CREATE INFORMATION CONTAINERSint_VideoWidth=0;int_VideoHeight=0;// LOCATE AND PROCESS VIDEO STREAMint_StreamIndex=0;int_StreamCount=0;Guid_StreamType=Guid.Empty;_MediaDetails.get_OutputStreams(out_StreamCount);stringtest=DirectShowLib.MediaType.Video.ToString();while(_StreamIndex<_StreamCount){_MediaDetails.put_CurrentStream(_StreamIndex++);_MediaDetails.get_StreamType(out_StreamType);if(_StreamType==DirectShowLib.MediaType.Video){// LOAD MEDIA TYPE_MediaType=newAMMediaType();_MediaDetails.get_StreamMediaType(_MediaType);// GET VIDEO INFORMATIONVideoInfoHeader_VideoInfo=(VideoInfoHeader)Marshal.PtrToStructure(_MediaType.formatPtr,typeof(VideoInfoHeader));// RELEASE MEDIA TYPEDsUtils.FreeAMMediaType(_MediaType);_MediaType=null;// GET VIDEO PARAMETERS_VideoWidth=_VideoInfo.BmiHeader.Width;_VideoHeight=_VideoInfo.BmiHeader.Height;// EMPTY OBJECT_VideoInfo=null;}// END IF}// END WHILE
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've got a small program which I use to extract the play length, width and height of .mp4 files.
The problem I'm encountering is that for the files over 2GB in file size, the DirectShowLib seems to not find the video stream so I can't get the correct width/height.
If I open the files using MediaInfo for example, this loads no problem.
My application is compiled for x64 and I'm using DirectShowLib 2.1.0.
Is there something I'm missing.
Below is the code I'm using.
Thanks
Anubis
Are you saying _StreamCount is 0? If not, what stream types do you have?
Also, it's important to remember the DirectShowLib doesn't actually parse the mp4 files. DSL just provides the interface to MS's functionality.