Advertisement

05.09.2008 at 09:10AM PDT, ID: 23389920 | Points: 250
[x]
Attachment Details

How can I join two videos (or pieces of one video) into a new video file using DirectShow?

Tags: DirectShow, C++
General note:  This question is also cross-posted on microsoft.public.win32.programmer.directx.video and at the MSDN forums at http://forums.microsoft.com/MSDN/ShowPost.aspx?siteid=1&PostID=3318206 -- if you're trying to solve this same issue in the future, check responses to the question in those places as well!


Hi guys,

I need some mechanism to append parts of a video into another file.  Specifically, I'd like to do something like this:

   1. "Recorder" program records some video to a temporary file.  This application runs constantly, so the temporary file is always open for writing.
   2. "Appending" program reads an arbitrary segment of this buffer file (say, from 5:00 to 10:00) and adds it to the end of the output file
   3. Repeat until recorder program stops recording.

Specific details:

   1. Both applications are run on Windows Server 2003.  This rules out using Windows Media Foundation.

   2. Because the recorder program runs constantly, our video container format must, MUST, MUST support seeking to an arbitrary place in the buffer file at the same time that the recorder program is writing to the buffer file.

      After numerous searches on MSDN forums, newsgroups, and the web, I have not found any way to do this with the ASF format, since the video index is kept at the end of the file.  Some developers have alluded to making their own source and sink filters, but that goes beyond the scope of our project budget.

      In our initial tests, the only container format that allows us to do this is Matroska, which we can read and write using widely available DirectShow filters.  We are using DivX as our compression codec.  We are fairly committed to using Matroska since we have not found any other container format (ASF, AVI, or MPEG-TS) where DirectShow lets us play the file while another program is writing to it.  However, we have some degree of flexibility on our choice of compression codec.

   3. It is vital that we maintain video quality.  We cannot afford to re-compress video from the buffer file to add it to the output file.

   4. Ideally I would like some way to append to the output file "in-place".  For example, the output file might be a gigabyte or more in size.  If possible, I would like to avoid having to perform the disk I/O to copy this gigabyte-sized file to another file just to add on another 50 megabytes of video to the end.

I've spent the past few days researching API's to accomplish this.  I ran across DirectShow Editing Services, which seems to support several editing options.  However,  I'm confused by the wording in this introduction topic:



<snip>

The core of DirectShow is a powerful architecture for handling streaming media. An application can use it to play multimedia content authored in a wide variety of formats, without the developer needing to worry about file compression and other tedious details. Prior to DES, however, DirectShow lacked the flexibility needed for nonlinear editing.


For example, suppose you wanted to create a video sequence consisting of 4 seconds from source A, followed by 10 seconds from source B, and ending with 5 seconds from source C. You could accomplish that much fairly easily using only the core DirectShow API.

</snip>


What core DirectShow API interfaces provide this functionality?  I've searched for a variety of terms ("concatenate", "join" "append", "combine") and haven't found anything yet that doesn't require the ASF format.

Is DirectShow Editing Services my only option?  Are there any other DirectShow-related APIs that I should use?

Thanks
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: TomPro
Question Asked On: 05.09.2008
Participating Experts: 1
Points: 250
Views: 0
Translate:
Loading Advertisement...
05.09.2008 at 02:51PM PDT, ID: 21536599

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 03:03PM PDT, ID: 21536646

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 03:56PM PDT, ID: 21536901

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.09.2008 at 02:51PM PDT, ID: 21536599

Rank: Wizard

short answer Not Possible  in my humble opinion okay.
This kills it>>
Because the recorder program runs constantly,
 our video container format must, MUST, MUST support seeking to an arbitrary place in the buffer file
>>>at the same time that the recorder program is writing to the buffer file.
 
05.09.2008 at 03:03PM PDT, ID: 21536646
Merete,

Let's assume for a moment that the recorder didn't run constantly.  What APIs could I use?

Thanks
 
05.09.2008 at 03:56PM PDT, ID: 21536901

Rank: Wizard

Can't really say this is outisde of my experience ranges, but since you became interested in the core of DirectShow
I did a litle googling on that topic.
Introduction to DirectShow Editing Services
http://doc.51windows.net/Directx9_SDK/?url=/Directx9_SDK/htm/introductiontodirectshoweditingservices.htm

Using Windows Media in DirectShow Editing Services
http://msdn.microsoft.com/en-us/library/ms867700.aspx
Getting Started with DirectShow Editing Services
http://msdn.microsoft.com/en-us/library/ms783744(VS.85).aspx
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628