Click here to Skip to main content
Click here to Skip to main content

DirectShow Video and Audio Trimming

By , 18 Mar 2008
 

Introduction

Sometimes, users ask a question about video and audio trimming and then search the utilities that can do this. But what about programmatic implementation of this task? This article will show how it appears from the programmer's position. First of all, I will tell you about the platform and necessary media interfaces. It will be Win32 and core Windows media technology named DirectShow. Moreover, we need «K-Lite Codec Pack» installed with Media Player Classic, which is used for playing media files.

Our application consists of two parts:

  1. A DirectShow Transform Filter, which actually does the necessary media splitting
  2. A Console Application, which demonstrates how this filter can be used

The code, which is shown in this article represents the idea of this process and is not a complete application. However it can be a hard foundation of such popular application types, such as different media (video and audio) splitters.

Background

Let's look at the DirectShow Transform Filters -- what are they? First of all, they allow a programmer to do any manipulation with the media samples, which goes through these filters. But what do we need to exclude specified intervals from the media stream? The answer may be so: we need to discard any samples, which we don't want to see in the output. If we stop here we will have the media file without specified intervals of data, but the cut parts will be filled with the last sample, which have been played before the cut interval started. And this is not the result we want to see. To avoid this, we need not only simply exclude time blocks from the media stream, we need to take the next samples and correct their times, such that they shall go from the point where the cut is done. It will give us the effect that the sample goes through our filter without any pauses and break effects will not appear. To make this more general, we need to use the previous rule for all excluded intervals. We need to stride the next samples block at the summary time, which represents the sum of cut interval times. To see it in more detail, look at the application code.

Using the Code

To run the application code, you need copy the chicken.wmv file to C:\. It is necessary, because we use the manually built graph for rendering, which takes the input file from the specified location. We don't use the code graph building, because it’s a demo application and is targeted to core principles demonstration, but not for all DirectShow application specific needs. The second thing that you need to start the demo code is to register the filter in your system using a shell command like regsvr32 DShowMediaSplitFilt.ax. Then start the Demo.exe and after the execution process is finished, you will see the proceed.wmv file in C:\, which represents the result of time block exclusion process.

The graph, which is used here, is shown below:

DShowMediaSplit

You can see that we use two filter instances to make the video and audio exclusion synchronized. Also we use the IReferenceClock synchronization in our application for all graph filters. Look at the filter code:

 // DirectShow Media Split Filter header file by Kovalev Maxim
#ifndef __DSHOWMEDIASPLITFILT_H__
#define __DSHOWMEDIASPLITFILT_H__
#pragma warning (disable:4312)
#include <streams.h> // DirectShow (includes windows.h)
#include <initguid.h> // Declares DEFINE_GUID to declare an EXTERN_C const
#include <vector>
using std::vector;
// {1A21958D-8E93-45de-92DA-DD9544297B41}
DEFINE_GUID (CLSID_DShowMediaSplit, 0x1a21958d, 0x8e93, 0x45de, 0x92, 0xda,
    0xdd, 0x95, 0x44, 0x29, 0x7b, 0x41);
struct TimeBlock
{
 TimeBlock (LONGLONG startTime, LONGLONG endTime)
 {
  this->startTime = startTime;
  this->endTime = endTime;
 }
 
 LONGLONG startTime;
 LONGLONG endTime;
};
// {EC634576-4C86-464e-99D7-AC7AFEFB2FF0}
DEFINE_GUID (IID_IDShowMediaSplitFilt, 0xec634576, 0x4c86, 0x464e, 0x99, 0xd7,
    0xac, 0x7a, 0xfe, 0xfb, 0x2f, 0xf0);
interface IDShowMediaSplitFilt : public IUnknown
{
 STDMETHOD (SetIntervalList) (const vector <TimeBlock> &lst) = 0;
};
#endif
// DirectShow Media Split Filter source file by Kovalev Maxim
#include "DShowMediaSplitFilt.h"
// Setup data - allows the self-registration to work
const AMOVIESETUP_MEDIATYPE sudPinTypes =
 { &MEDIATYPE_NULL     // clsMajorType
 , &MEDIASUBTYPE_NULL  // clsMinorType
 };
const AMOVIESETUP_PIN psudPins [] = {
 { L"Input"            // strName
   , FALSE             // bRendered
   , FALSE             // bOutput
   , FALSE             // bZero
   , FALSE             // bMany
   , &CLSID_NULL       // clsConnectsToFilter
   , L""               // strConnectsToPin
   , 1                 // nTypes
   , &sudPinTypes      // lpTypes
 }
 ,
 { L"Output"           // strName
 , FALSE               // bRendered
 , TRUE                // bOutput
 , FALSE               // bZero
 , FALSE               // bMany
 , &CLSID_NULL         // clsConnectsToFilter
 , L""                 // strConnectsToPin
 , 1                   // nTypes
 , &sudPinTypes        // lpTypes
 }
 };
const AMOVIESETUP_FILTER sudTransformSample =
 { &CLSID_DShowMediaSplit           // clsID
 , L"DirectShow Media Split Filter" // strName
 , MERIT_DO_NOT_USE                 // dwMerit
 , 2                                // nPins
 , psudPins                         // lpPin
 };
struct TimeBlockEx : public TimeBlock
{
 TimeBlockEx (LONGLONG startTime, LONGLONG endTime,
  LONGLONG timeAtSkipped, LONGLONG timeAtNonSkipped)
  : TimeBlock (startTime, endTime)
 {
  this->timeAtSkipped = timeAtSkipped;
  this->timeAtNonSkipped = timeAtNonSkipped;
  skippedFound = false;
  nonSkippedFound = false;
  needToSkip = false;
 }
 
 LONGLONG timeAtSkipped;
 LONGLONG timeAtNonSkipped;
 bool skippedFound;
 bool nonSkippedFound;
 bool needToSkip;
};
class CDShowMediaSplitFilt : public CTransInPlaceFilter, IDShowMediaSplitFilt
{
public:
 // CreateInstance. Provide the way for COM to create a "CDShowMediaSplitFilt" object
 static CUnknown *WINAPI CreateInstance (LPUNKNOWN pUnk, HRESULT *pHr);
 DECLARE_IUNKNOWN;
 
 // Method, which provides specified interface querying
 STDMETHODIMP NonDelegatingQueryInterface (REFIID riid, void **ppv);
 // Method for storing time blocks list into class members
 STDMETHODIMP SetIntervalList (const vector <TimeBlock> &lst);
private:
 CDShowMediaSplitFilt (TCHAR *tszName, LPUNKNOWN pUnk, HRESULT *pHr)
  : CTransInPlaceFilter (tszName, pUnk, CLSID_DShowMediaSplit, pHr) {}
 // Filter's transform method - where core work done
 HRESULT Transform (IMediaSample *pSample);
 // We accept any input type. We'd return S_FALSE for any we didn't like
 HRESULT CheckInputType (const CMediaType *pMediaTypeIn);
 // Time block's array, which stores split intervals
 vector <TimeBlockEx> timeBlockList_;
};
// Needed for the CreateInstance mechanism
CFactoryTemplate g_Templates [] = {
 {
  L"DirectShow Media Split Filter",
  &CLSID_DShowMediaSplit,
  CDShowMediaSplitFilt::CreateInstance,
  NULL,
  &sudTransformSample
 }
 };
int g_cTemplates = sizeof (g_Templates) / sizeof (g_Templates [0]);
CUnknown *WINAPI CDShowMediaSplitFilt::CreateInstance (LPUNKNOWN pUnk, HRESULT *pHr)
{
 CDShowMediaSplitFilt *pNewObject = new CDShowMediaSplitFilt (
  NAME ("DirectShow Media Split Filter"), pUnk, pHr);
 if (pNewObject == NULL)
  *pHr = E_OUTOFMEMORY;
 return pNewObject;
}
STDMETHODIMP CDShowMediaSplitFilt::NonDelegatingQueryInterface (REFIID riid, void **ppv)
{
 if (riid == IID_IDShowMediaSplitFilt)
  return GetInterface (static_cast <IDShowMediaSplitFilt *> (this),
  ppv);
 return CTransInPlaceFilter::NonDelegatingQueryInterface (riid, ppv);
}
STDMETHODIMP CDShowMediaSplitFilt::SetIntervalList (const vector <TimeBlock> &lst)
{
 for (size_t i = 0; i < lst.size (); i++)
 {
  TimeBlockEx timeBlockEx (lst.at (i).startTime, lst.at (i).endTime, 0, 0);
  timeBlockList_.push_back (timeBlockEx);
 }
 return S_OK;
}
HRESULT CDShowMediaSplitFilt::Transform (IMediaSample *pSample)
{
 LONGLONG sampleStartTime = 0;
 LONGLONG sampleEndTime = 0;
 pSample->GetTime (&sampleStartTime, &sampleEndTime);
 // Summary time, for which the samples have to be moved
 LONGLONG totalDelta = 0;
 
 for (size_t i = 0; i < timeBlockList_.size (); i++)
 {
  // Check this sample time - is it needed to skip this
  if (sampleEndTime > timeBlockList_.at (i).startTime &&
   sampleEndTime < timeBlockList_.at (i).endTime)
   timeBlockList_.at (i).needToSkip = true;
  else
   timeBlockList_.at (i).needToSkip = false;
  
  // Search the first sample time, which is needed to be
  // skipped and store it
  if (sampleEndTime >= timeBlockList_.at (i).startTime &&
   !timeBlockList_.at (i).skippedFound)
  {
   timeBlockList_.at (i).timeAtSkipped = sampleEndTime;
   timeBlockList_.at (i).skippedFound = true;
  }
  // Search the first sample time, which need not to be
  // skipped and store it
  if (sampleEndTime >= timeBlockList_.at (i).endTime &&
   !timeBlockList_.at (i).nonSkippedFound)
  {
   timeBlockList_.at (i).timeAtNonSkipped = sampleEndTime;
   timeBlockList_.at (i).nonSkippedFound = true;
  }
  // All necessary times found, so calculate "delta" time
  // as a difference of founded previously times and add
  // calculated value to the summary time for using in the
  // next of cut time blocks
  if (timeBlockList_.at (i).skippedFound &&
   timeBlockList_.at (i).nonSkippedFound)
  {
   LONGLONG delta = timeBlockList_.at (i).timeAtSkipped -
    timeBlockList_.at (i).timeAtNonSkipped;
   totalDelta += delta;
   // New sample times, which makes effects, that media is not broken
   LONGLONG newSampleStartTime = sampleStartTime + totalDelta;
   LONGLONG newSampleEndTime = sampleEndTime + totalDelta;
   // Setting new times
   pSample->SetTime (&newSampleStartTime, &newSampleEndTime);
  }
  // If the current sample time is inside "i"-th interval,
  // we need to skip it
  if (timeBlockList_.at (i).needToSkip)
   return S_FALSE;
 }
 
 return NOERROR;
}
HRESULT CDShowMediaSplitFilt::CheckInputType (const CMediaType *pMediaTypeIn)
{
 return S_OK;
}
// Exported entry points for registration and unregistration
STDAPI DllRegisterServer ()
{
 return AMovieDllRegisterServer2 (TRUE);
}
STDAPI DllUnregisterServer ()
{
 return AMovieDllRegisterServer2 (FALSE);
}

We use the IDShowMediaSplitFilt interface, which is made in COM-style to allow calling application setup time blocks, which have to be excluded from the input media file. All core functionality stays inside the filter Transform method. The filter code is strongly simplified. Out filter accepts any media type and doesn't control which type it receives – encoded or decoded, however, we work only with decoded content. But now let’s look at the demo application source code, which is shown below:

// DirectShow Media Split Filter demo application source file
// by Kovalev Maxim
#include <iostream>
using std::cout;
using std::endl;
#include "../DShowMediaSplitFilt/DShowMediaSplitFilt.h"
// Read manually created graph function with structured exception
// handling to make it more like C++ 
HRESULT LoadGraphFile (IGraphBuilder *pGraph, const WCHAR *wszName)
{
 IStorage *pStorage = NULL;
 IPersistStream *pPersistStream = NULL;
 IStream *pStream = NULL;
 HRESULT hr = S_OK;
 
 try
 {
  hr = StgIsStorageFile (wszName);
  if (FAILED (hr))
   throw "Graph file not found";
  
  hr = StgOpenStorage (wszName, 0,
   STGM_TRANSACTED | STGM_READ | STGM_SHARE_DENY_WRITE,
   0, 0, &pStorage);
  
  if (FAILED (hr))
   throw "Storage opening failed";
  
  hr = pGraph->QueryInterface (IID_IPersistStream,
   reinterpret_cast <void **> (&pPersistStream));
  
  if (FAILED (hr))
   throw "Couldn't query interface";
  
  hr = pStorage->OpenStream (L"ActiveMovieGraph", 0,
   STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
  
  if (FAILED (hr))
   throw "Couldn't open ActiveMovieGraph";
  
  hr = pPersistStream->Load (pStream);
  if (FAILED (hr))
   throw "Couldn't load stream data";
 }
 catch (char *str)
 {
  cout << "Error occurred: " << str << endl;
 }
 
 if (pStream) pStream->Release ();
 if (pPersistStream) pPersistStream->Release ();
 if (pStorage) pStorage->Release ();
 
 return hr;
}
// App entry point. Here we demonstrate how to use our "DirectShow Transform Filter"
int main ()
{
 const WCHAR GRAPH_FILE_NAME [] = L"Graph.GRF";
 const LONGLONG SCALE_FACTOR = 10000000;
 
 IGraphBuilder *pGraph = NULL;
 IMediaControl *pControl = NULL;
 IMediaEvent *pEvent = NULL;
 HRESULT hr = S_OK;
 IBaseFilter *pVideoSplitFilt = NULL;
 IDShowMediaSplitFilt *pVideoSplitConfig = NULL;
 IBaseFilter *pAudioSplitFilt = NULL;
 IDShowMediaSplitFilt *pAudioSplitConfig = NULL;
 IReferenceClock *pClock = NULL;
 IEnumFilters *pFiltEnum = NULL;
 
 try
 {
  cout << "Process started" << endl;
  hr = CoInitialize (NULL);
  if (FAILED (hr))
   throw "Could not initialize COM library";
  
  hr = CoCreateInstance (CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
   IID_IGraphBuilder, reinterpret_cast <void **> (&pGraph));
  if (FAILED (hr))
   throw "Could not create the Filter Graph Manager";
  
  hr = LoadGraphFile (pGraph, GRAPH_FILE_NAME);
  if (FAILED (hr))
   throw "Couldn't load graph file";
  
  hr = pGraph->FindFilterByName (L"DirectShow Media Split Filter",
   &pVideoSplitFilt);
  if (FAILED (hr))
   throw """DirectShow Media Split Filter"" not founded in graph";
  
  hr = pVideoSplitFilt->QueryInterface (IID_IDShowMediaSplitFilt,
   reinterpret_cast <void **> (&pVideoSplitConfig));
  if (FAILED (hr))
   throw "IDShowMediaSplitFilt config 4 video splitter couldn't be retrieved";
  
  hr = pGraph->FindFilterByName (L"DirectShow Media Split Filter 0001",
   &pAudioSplitFilt);
  if (FAILED (hr))
   throw """DirectShow Media Split Filter 0001"" not founded in graph";
  
  hr = pAudioSplitFilt->QueryInterface (IID_IDShowMediaSplitFilt,
   reinterpret_cast <void **> (&pAudioSplitConfig));
  if (FAILED (hr))
   throw "IDShowMediaSplitFilt config 4 audio splitter couldn't be retrieved";
  
  vector <TimeBlock> timeBlockList;
  timeBlockList.push_back (TimeBlock (1 * SCALE_FACTOR, 3 * SCALE_FACTOR));
  timeBlockList.push_back (TimeBlock (5 * SCALE_FACTOR, 9 * SCALE_FACTOR));
  
  // Setting equal cutting intervals 4 both filter instances - video/audio
  pVideoSplitConfig->SetIntervalList (timeBlockList);
  pAudioSplitConfig->SetIntervalList (timeBlockList);
  
  hr = CoCreateInstance (CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER,
   IID_IReferenceClock, reinterpret_cast <void **> (&pClock));
  if (FAILED (hr))
   throw "Failed to create reference clock";
  
  hr = pGraph->EnumFilters (&pFiltEnum);
  if (FAILED (hr))
   throw "Couldn't enumerate graph filters";
  
  IBaseFilter *pCurrFilt = NULL;
  while (pFiltEnum->Next (1, &pCurrFilt, 0) == S_OK)
  {
   pCurrFilt->SetSyncSource (pClock);
   pCurrFilt->Release ();
  }
  
  hr = pGraph->QueryInterface (IID_IMediaControl, reinterpret_cast <
   void **> (&pControl));
  if (FAILED (hr))
   throw "Media control couldn't be retrieved";
  
  hr = pGraph->QueryInterface (IID_IMediaEvent, reinterpret_cast <
   void **> (&pEvent));
  if (FAILED (hr))
   throw "Media event couldn't be retrieved";
  
  hr = pControl->Run ();
  if (FAILED (hr))
   throw "Graph couldn't be started";
  
  long evCode = 0;
  pEvent->WaitForCompletion (INFINITE, &evCode);
 }
 catch (char *str)
 {
  cout << "Error occurred: " << str << endl;
 }
 
 if (pFiltEnum) pFiltEnum->Release ();
 if (pClock) pClock->Release ();
 if (pAudioSplitConfig) pAudioSplitConfig->Release ();
 if (pAudioSplitFilt) pAudioSplitFilt->Release ();
 if (pVideoSplitConfig) pVideoSplitConfig->Release ();
 if (pVideoSplitFilt) pVideoSplitFilt->Release ();
 if (pEvent) pEvent->Release ();
 if (pControl) pControl->Release ();
 if (pGraph) pGraph->Release ();
 
 CoUninitialize ();
 cout << "Done." << endl;
 
 return EXIT_SUCCESS;
}

How can we see that it is DirectShow-specific code, which shows how the filter properties can be set through the COM-interface. In our application it’s time blocks that we need to exclude. The time block is set in the second unit and multiplied by a factor, which allows using these times as DirectShow-style reference times.

Points of Interest

Of course there are many different ways to do a similar task. For example, we can use the DirectShow Editing Services. But in my own opinion, non-standard ways are more interesting for implementation.

History

  • 19th March, 2008: Initial post

    Some time ago I was very interested in the implementation of the task described above, but couldn't find any useful material or code for it and decided to write my own. It was targeted to video trim process using DirectShow implementation programmatically. We can see that its foundation was built successfully.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Kovalev Maxim
Software Developer (Senior)
Russian Federation Russian Federation
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionWindows 7 - Can't Register AX filememberphil day2 Feb '13 - 4:17 
Hi, I'm trying to regsvr32 DShowMediaSplitFilt.ax to register the custom filter however windows is complaining that the specified module is not found. Is there a known fix to get working with win 7?
AnswerRe: Windows 7 - Can't Register AX filememberKovalev Maxim24 Mar '13 - 5:00 
This code do not tested in Win 7. However, you may try to build new empty COM component in VS IDE under Win 7 and paste the source logic from this to your project.
GeneralLink errorsmember_yvk16 Nov '08 - 21:58 
Hi,
I've got a lot of linkage errors building project. for instance
1>strmbasd.lib(transip.obj) : warning LNK4217: locally defined symbol __wassert imported in function "public: struct IUnknown * __thiscall CUnknown::GetOwner(void)const " (?GetOwner@CUnknown@@QBEPAUIUnknown@@XZ)
1>strmbasd.lib(amfilter.obj) : warning LNK4049: locally defined symbol __wassert imported
1>strmbasd.lib(transfrm.obj) : warning LNK4049: locally defined symbol __wassert imported
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) referenced in function "public: class std::_Iterator_base & __thiscall std::_Iterator_base::operator=(class std::_Iterator_base const &)" (??4_Iterator_base@std@@QAEAAV01@ABV01@@Z)
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) referenced in function "public: class std::_Iterator_base & __thiscall std::_Iterator_base::operator=(class std::_Iterator_base const &)" (??4_Iterator_base@std@@QAEAAV01@ABV01@@Z)
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol "void __cdecl std::_Debug_message(unsigned short const *,unsigned short const *,unsigned int)" (?_Debug_message@std@@YAXPBG0I@Z) referenced in function "public: void __thiscall std::_Iterator_base::_Orphan_me(void)" (?_Orphan_me@_Iterator_base@std@@QAEXXZ)
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: class std::basic_string<char,struct>,class std::allocator > & __thiscall std::basic_string<char,struct>,class std::allocator >::assign(class std::basic_string<char,struct>,class std::allocator > const &,unsigned int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z)
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: struct TimeBlock const & __thiscall std::_Vector_const_iterator >::operator*(void)const " (??D?$_Vector_const_iterator@UTimeBlock@@V?$allocator@UTimeBlock@@@std@@@std@@QBEABUTimeBlock@@XZ)
1>DShowMediaSplitFilt.obj : error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) referenced in function "protected: bool __thiscall std::basic_string<char,struct>,class std::allocator >::_Grow(unsigned int,bool)" (?_Grow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
1>strmbasd.lib(dllentry.obj) : error LNK2019: unresolved external symbol __imp__wcsrchr referenced in function "unsigned short * __cdecl wcsrchr(unsigned short *,unsigned short)" (?wcsrchr@@YAPAGPAGG@Z)
1>strmbasd.lib(wxdebug.obj) : error LNK2001: unresolved external symbol __imp__wcsrchr
1>strmbasd.lib(dllentry.obj) : error LNK2019: unresolved external symbol __imp___vsnwprintf referenced in function "long __stdcall StringVPrintfWorkerW(unsigned short *,unsigned int,unsigned int *,unsigned short const *,char *)" (?StringVPrintfWorkerW@@YGJPAGIPAIPBGPAD@Z)
1>strmbasd.lib(dllsetup.obj) : error LNK2001: unresolved external symbol __imp___vsnwprintf
1>strmbasd.lib(wxdebug.obj) : error LNK2001: unresolved external symbol __imp___vsnwprintf
1>strmbasd.lib(wxutil.obj) : error LNK2001: unresolved external symbol __imp___vsnwprintf
1>strmbasd.lib(wxdebug.obj) : error LNK2019: unresolved external symbol __imp___vsnprintf referenced in function "long __stdcall StringVPrintfWorkerA(char *,unsigned int,unsigned int *,char const *,char *)" (?StringVPrintfWorkerA@@YGJPADIPAIPBD0@Z)
1>strmbasd.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function ___tmainCRTStartup
1
 

I feel that my strmbase.lib and strmbasd.lib are wrong because i have lot of problems during build process for base classes. Could you please send your strmbase/strmbasd libs?
I'm using VS2005 latest WinSDK and latest Directshow SDK and working under winXP
 
Thanx!

GeneralRe: Link errorsmemberKovalev Maxim27 Aug '09 - 5:11 
Try to use last version of Windows SDK (it's fully compatible with VS2005) and compile the filter code with it. Also you need to use only "Debug" or only "Release" configurations for base classes and filter project.
GeneralRe: Link errorsmemberbobohallie15 Apr '10 - 15:24 
you can add:LIBCMTD.lib under the setting->linker->input->Ignore specific library->LIBCMTD.lib
please try.
Generalsal.hmemberpolitehnist3 Oct '08 - 4:21 
Hello. I build the project and the following error occures :
 
e:\Program Files\Microsoft SDKs\Windows\v6.1\Include\specstrings.h(9): fatal error C1083: Cannot open include file: 'sal.h': No such file or directory
 
what about this header? I can't find it and as I have read, there is a problem with this. I use vc2005.
Thanks
GeneralRe: sal.hmemberpolitehnist3 Oct '08 - 4:47 
found .... :
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=305592
GeneralIs there a problem with the filter DShowMediaSplit.axmemberxraziel25 Aug '08 - 4:27 
I cannot reg the filter, windows throw the messag: error in loadlibrary(DShowMediaSplit.ax). Couldn't find the specified module.
Also I tried to reg it with the graphedit.
GeneralRe: Is there a problem with the filter DShowMediaSplit.axmemberKovalev Maxim30 Sep '08 - 21:38 
Try to compile project. It will register filter through the VS 2003 IDE.
GeneralRe: Is there a problem with the filter DShowMediaSplit.axmemberGordon Dobie13 Jan '12 - 6:31 
I always get:
 
The module "DShowMediaSplitFilt.dll" was loaded but the entry point DLLRegisterServer was not found.
 
I am using Win7 32bit
GeneralTrimming with C#memberxraziel6 May '08 - 8:15 
Hello, I´m using the DirectShowNet Lib, I have achieved to understand the powerful use of the filters with DirectShow, I have programmed a nice player but I want to give it splitting capacity. I have read your article, but with C# an this library I don´t know exactly what filter I have to use, because I think I don´t need to use two filters, one for audio and one for video. I have two marks on my video, one is the start mark and other is the end mark, and I only want to save this interval of the video, without cutting the original. Is it mandatory to separate audio from video? or can I use a filter to save this interval with audio and video together?
GeneralRe: Trimming with C#memberKovalev Maxim18 May '08 - 22:50 
You can use one instance of my filter to cut only video or only audio part of your media file. To implement this you need to put described previously filter between decoder and encoder video or audio pin. You can also write output video and audio separetely. For this you need to connect output pins of trimmers to mpeg video and audio muxer filters.
QuestionIn VS2005 , Have some problemsmemberallenallen26 Mar '08 - 2:32 
In VS2005, have some problems.
 
I debugged it, the program will crash in the call lst.at (i).startTime.
 
I copy the source code below in DShowMediaSplitFilt.cpp.
 
It maybe about the Vector's method. But I cannot find the solution.
 
STDMETHODIMP CDShowMediaSplitFilt::SetIntervalList (const vector <TimeBlock> &lst)
{
......
 
for (size_t i = 0; i < lst.size (); i++)
{
 
lst.at(i).startTime;
........
}
return S_OK;
}
GeneralRe: In VS2005 , Have some problems [modified]memberKovalev Maxim29 Mar '08 - 20:33 
This code do not tested in VS 2005, but I can tell, that you need to step into STL code of "at ()" method to fix the problem. Sometimes the class fails to work in VC++ 2005, because the malloc () function in STL internals return "NULL". If it's so in your situation, try to install SP1 for VS 2005. If it doesn't helps, try to use standard pointers (without STL) for passing time blocks information to DirectShow filter.
 
modified on Monday, March 31, 2008 6:09 AM

GeneralRe: In VS2005 , Have some problemsmemberallenallen30 Mar '08 - 21:35 
I installed the VS2005 SP1. But the bug still be exist.
I donnot know why Microsoft process their developing tool like that.
I manybe have to use standard pointers. It is very strange that I have test your project. I can use the Table in demo.exe, but it is defeat in the Activex. Sleepy | :zzz:
GeneralDESmembermjmim19 Mar '08 - 23:33 
Nice article but I've used Directshow Editing Services in the past and had great results for these types of tasks...
GeneralRe: DESmemberKovalev Maxim20 Mar '08 - 22:32 
Yeah, DES is very useful for this task, and I think, that it first, that come in mind, when this tasks need to be implemented. However, using my way you can control splitting process using only DShow graph.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 19 Mar 2008
Article Copyright 2008 by Kovalev Maxim
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid