Forums
Merging Multiple Videos with DirectShow - Printable Version

+- Forums (http://mitov.com/forum)
+-- Forum: .NET 2.0 - 4.0 Components (/forum-8.html)
+--- Forum: VideoLab (/forum-21.html)
+--- Thread: Merging Multiple Videos with DirectShow (/thread-1223.html)



Merging Multiple Videos with DirectShow - firesharkstudios - 12-01-2012 07:09 AM

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?


RE: Merging Multiple Videos with DirectShow - Dave - 12-01-2012 08:24 AM

Sort of, compressing the video can be done by the logger already so you don't need the compressor component.

Regards,
Dave


RE: Merging Multiple Videos with DirectShow - firesharkstudios - 12-01-2012 06:24 PM

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?


RE: Merging Multiple Videos with DirectShow - Dave - 12-01-2012 08:59 PM

There are multiple ways to accomplish this, try whichever suits your needs best. Using just the mixer might be enough though.

Regards,
Dave


RE: Merging Multiple Videos with DirectShow - firesharkstudios - 12-02-2012 06:29 AM

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?


RE: Merging Multiple Videos with DirectShow - Dave - 12-02-2012 08:56 AM

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


RE: Merging Multiple Videos with DirectShow - firesharkstudios - 12-02-2012 10:17 AM

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?


RE: Merging Multiple Videos with DirectShow - Dave - 12-02-2012 10:43 AM

Yeah, good idea..


Free wav to mp3 converter officer - deedapildmic - 12-02-2016 07:05 AM

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