Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merging Multiple Videos with DirectShow
12-01-2012, 07:09 AM
Post: #1
Merging Multiple Videos with DirectShow
Ideally, I'd like to be able to...

1) Concatenate multiple videos into a single video

2) Overlap the videos by a small amount (perhaps 0.5s) with a fade transition between the videos

3) Compress the resulting single video to MP4 format

Can I do this with your VideoLab library? I'm thinking I have to create a DSVideoPlayer instance for each source video, wire them each to a single VideoMixer component, add a DSVideoCompressor component, and then use a DSVideoLogger component to write out the resulting file.

Is this about right?
Find all posts by this user
Quote this message in a reply
12-01-2012, 08:24 AM
Post: #2
RE: Merging Multiple Videos with DirectShow
Sort of, compressing the video can be done by the logger already so you don't need the compressor component.

Regards,
Dave
Quote this message in a reply
12-01-2012, 06:24 PM
Post: #3
RE: Merging Multiple Videos with DirectShow
Thanks, I'm really not clear how to implement the transition effects (0.5s fade between clips). Do I need to wire the ApplyAlpha component inline with each clip and programmatically change the alpha value at the right times for each clip?
Find all posts by this user
Quote this message in a reply
12-01-2012, 08:59 PM
Post: #4
RE: Merging Multiple Videos with DirectShow
There are multiple ways to accomplish this, try whichever suits your needs best. Using just the mixer might be enough though.

Regards,
Dave
Quote this message in a reply
12-02-2012, 06:29 AM
Post: #5
RE: Merging Multiple Videos with DirectShow
So, I've got a collection of clips that I want concatenated one after the other in a single video file.

I've started writing the following code...

Code:
this.videoMixer.Channels.Clear();
            foreach (Clip clip in this.reel.Clips) {
                DSVideoPlayer dsVideoPlayer = new DSVideoPlayer();
                dsVideoPlayer.FileName = clip.FullFileName;

                VideoMixerChannelItem channelItem = new VideoMixerChannelItem();
                // Not sure how to connect the dsVideoPlayer to the VideoMixerChannelItem
                dsVideoPlayer.OutputPin = channelItem;  
                this.videoMixer.Channels.Add(channelItem);
            }

I'm assuming I need a DSVideoPlayer instance for each clip and it should be wired to a VideoMixerChannelItem but I'm not seeing how to connect the two. Guidance?
Find all posts by this user
Quote this message in a reply
12-02-2012, 08:56 AM
Post: #6
RE: Merging Multiple Videos with DirectShow
Can't test this at the moment but can you try something like: dsVideoPlayer.OutputPin.Connect(channelItem);

I assume there must be help-files included in the VC install as well, perhaps you can find some more info there too.

Regards,
Dave
Quote this message in a reply
12-02-2012, 10:17 AM
Post: #7
RE: Merging Multiple Videos with DirectShow
I've not found any useful documentation. Not sure how to access any of the documention under c:\program files(x86)\LabPacks\DotNet\Help.

This is what I currently have...

Code:
private List<DSVideoPlayer> dsVideoPlayers = new List<DSVideoPlayer>();
        private int dsVideoPlayersIndex = 0;
        private void startButton_Click(object sender, EventArgs e) {
            this.videoMixer.Channels.Clear();
            this.dsVideoLogger.FileName = this.fileNameValueLabel.Text;
            
            this.videoMixer.Channels.Add(this.reel.Clips.Count);
            for (int i = 0; i < this.reel.Clips.Count; i++) {
                DSVideoPlayer dsVideoPlayer = new DSVideoPlayer();
                dsVideoPlayer.FileName = this.reel.Clips[i].FullFileName;
                dsVideoPlayer.Stopped += new EventHandler(dsVideoPlayer_Stopped);
                dsVideoPlayer.OutputPin.Connect(this.videoMixer.InputPins[i]);
                
                dsVideoPlayers.Add(dsVideoPlayer);
            }

            dsVideoPlayers[dsVideoPlayersIndex].Start();
        }

        void dsVideoPlayer_Stopped(object sender, EventArgs e) {
            this.dsVideoPlayers[this.dsVideoPlayersIndex].Stopped -= dsVideoPlayer_Stopped;
            this.dsVideoPlayersIndex++;
            if (this.dsVideoPlayersIndex < this.dsVideoPlayers.Count) {
                this.dsVideoPlayers[this.dsVideoPlayersIndex].Start();
            }
            else {
            }
        }

Is it correct that I should be starting each individual DSVideoPlayer at the right time to concatenate them properly?
Find all posts by this user
Quote this message in a reply
12-02-2012, 10:43 AM
Post: #8
RE: Merging Multiple Videos with DirectShow
Yeah, good idea..
Quote this message in a reply
12-02-2016, 07:05 AM
Post: #9
Free wav to mp3 converter officer
mp3 Lame updated to 3.98.4 (3.98.3 had issues creating corrupted mp3 files at certain bitrates) Freeware wav to mp3 converter download directory: batch wav mp3 converter catch replace free download wav to mp3 record

The Best wav to mp3 download: wav to mp3 converter free online about his http://www.audio-transcoder.com/how-to-c...les-to-mp3
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)