How to Combine Video and Audio from Separate Sources

LEADTOOLS Multimedia SDK has made a name for itself by offering high level controls that take the complexity out of developing DirectShow and Media Foundation applications. Most core operations such as conversion, capture and playback can be done with only a few lines of code. In addition to the high level features, LEADTOOLS is flexible enough for any advanced application with more difficult scenarios and still offers as much or as little control as desired over the graphs and topologies under the hood.

The ConvertCtrl is a perfect example of this. By setting a source file, destination file and format you can make an audio/video conversion application in minutes. Developers who wish to dive deeper can supply their own media samples and process the conversion frame by frame.

That is precisely the scenario described in the following example. Usually, conversion is a one to one process where you have a single file being converted to another single file. But what happens if you have your audio and video in separate files? This can be accomplished by employing three ConvertCtrl objects: one for decoding the audio file, one for decoding the video file, and the final control for splicing them together. In between the decoding and encoding you will get the media samples, merge them into a MultiStreamSource and use that source in the 3rd ConvertCtrl:


vidConvert = new ConvertCtrl();
audConvert = new ConvertCtrl();

//Init the SampleTargets. The Video and Audio data from our files will write to these.
SampleTarget vidTarget = new SampleTarget();
SampleTarget audTarget = new SampleTarget();


//Set the Media Type of the VideoTarget to Video
MediaType mt = new MediaType();
mt.Type = Constants.MEDIATYPE_Video;
vidTarget.SetAcceptedMediaType(mt);
vidConvert.TargetObject = vidTarget;

//Clear
mt = null;

//Set the Media type for our AudioTarget to Audio.
mt = new MediaType();
mt.Type = Constants.MEDIATYPE_Audio;
audTarget.SetAcceptedMediaType(mt);
audConvert.TargetObject = audTarget;

//Clear
mt = null;

//Set the ConvertCtrls to point to the Files as their sources.
vidConvert.SourceFile = videoFile;
audConvert.SourceFile = audioFile;

//Start running the two conversion controls. These are writing to the Sample Targets.
vidConvert.StartConvert();
audConvert.StartConvert();

//Enter the Combine Method
CombineVideoAndAudio(vidTarget, audTarget);

This is just the beginning of the process. To see what goes on inside the CombineVideoAndAudio function and try it out for yourself, you can download the full example from the original forum post.

Posted in Multimedia Imaging | Tagged , , , , , , , , , , | Leave a comment

New White Paper: Implementing a Standardized PDF/A Document Storage System with LEADTOOLS

This month’s white paper is an extremely practical one. In fact, we even had a few conversations with customers at last week’s HIMSS conference about this very subject. Document archival has been around for quite a while now, but as archives grow and systems become more spread out and the client device ecosystem is much more diverse, standardizing your document archival system is becoming critical.

If you have need for end-to-end PDF and PDF/A functionality including OCR, Virtual Printing, HTML5 viewing and more, you will benefit greatly from our March white paper!

Implementing a Standardized PDF/A Document Storage System with LEADTOOLS
Electronic document archival has evolved far beyond the simple days of scanning a paper document and saving it as an image or PDF. Nowadays, many documents don’t even start in physical form and could be one of many open or proprietary formats. Adding to the disparity caused by varying file formats is how and where files are stored. Many enterprises have their documents spread around numerous “data islands” including local computers, networked file shares and cloud services. This white paper will explore how to take full advantage of PDF/A as your universal document storage format by using the state of the art technology within LEADTOOLS Document Imaging SDKs.

We have also published this white paper on The CodeProject if you would like to read it in an online format.

Posted in PDF | Tagged , , , , , , , , , , , , , | Leave a comment

LEAD Showcasing Sustainable Healthcare and Big Data at HIMSS 2014

HIMSS 2014 logo

HIMSS 2014 is right around the corner and we hope to see many of you next week! In addition to Device Independent Viewing and Cloud Technology, another major focus during the exhibit will be on how LEADTOOLS can be used to build an economically sustainable healthcare solution and improve business intelligence by mining big data.

Create an Economically Sustainable Healthcare System using LEADTOOLS

  • The LEADTOOLS Print-to-PACS functionality can incorporate legacy systems into a digital workflow
  • The Cloud Storage interface of the LEADTOOLS PACS Server Framework reduces implementation time and resources, and can reduce ongoing operational costs
  • The load balanceable LEADTOOLS PACS Storage Server and HTML5 Medical Viewer can easily scale upwards in a cost effective manner to meet the growth and the demands of any enterprise
  • Automate business processes with recognition technologies such as barcode, OCR, ICR, OMR and forms processing

Manage Big Data with LEADTOOLS

  • Use LEADTOOLS PDF/A capabilities to normalize all of your documents and images into one format type
  • Use the LEADTOOLS Recognition engines to extract metadata

Visit Us at HIMSS Booth #3839

In addition to these features, we will have much more on display at HIMSS including our full line of LEADTOOLS Version 18 SDKs including Medical imaging, Document imaging and Multimedia product offerings. While you are in Orlando enjoying the break from cold weather, we hope you take the time to visit our booth to meet our imaging experts and check out the latest medical and document imaging technology in LEADTOOLS.

HIMSS Details

  • February 23 – 27, 2014
  • Orlando, FL
  • Booth # 3839

Contact us (HIMSS-2014@leadtools.com) to set up an appointment to meet with our representatives at the exhibit.

Posted in News | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

How to Load a DICOM File From a Byte Array

More often than not, DICOM files are loaded from a location on disk due to the size and complexity of the files. However, no environment and scenario is the same and we periodically get requests regarding how to load DICOM files from memory, more specifically a byte[] rather than a Stream. Due to the way that .NET garbage collection works we must use a .NET GCHandle object when passing an IntPtr to the overloaded DicomDataSet.Load function.


private byte[] loadedFile; // byte array for DICOM file from database, server, etc.
private DicomDataSet dicomDS;
private DicomElement element;

// Pin object so it is not garbage collected before work is done.
GCHandle gch = GCHandle.Alloc(loadedFile);

// Load DicomDS from byte[] using IntPtr of array.
dicomDS.Load(Marshal.UnsafeAddrOfPinnedArrayElement(loadedFile, 0),
   loadedFile.Length, DicomDataSetFlags.None);

// Unpin object.
gch.Free();

// Get image from DicomDS.
element = dicomDS.FindFirstElement(null, DicomTag.PixelData, true);
rasterImageViewer1.Image = dicomDS.GetImage(element, 0, 0,
   Leadtools.RasterByteOrder.Gray, DicomGetImageFlags.None);

To download the entire C# example project for versions 17.5 and 18, check out this forum post.

Posted in Medical Imaging | Tagged , , , , , | Leave a comment

Free MICR Demo Available for Android on Google Play

A few weeks ago we announced a new MICR demo for iOS and OS X. Today we’re happy to announce that the same app has been ported to Android and is now available on Google Play! MICR is useful in decoding the special fonts used on checks, making it an invaluable resource for any developer writing software for the financial sector.

As a reminder, LEADTOOLS has many additional demos available for iOS, Android, WinRT and Windows Phone including features such as OCR, Barcode, DICOM and more. If you are a mobile application developer, you can see first-hand how LEADTOOLS works on your devices. As an additional benefit, they serve as a living example of how using LEADTOOLS will have positive effects during the approval process for your app’s respective stores.

Posted in News | Tagged , , , , , , , , , , | Leave a comment