getFramesCapturer() public method

public getFramesCapturer ( ) : IFramesCapturer
return IFramesCapturer
Beispiel #1
0
 public FramesSeriesCapturer(string videoFile,long start, long stop, uint interval, string outputDir)
 {
     MultimediaFactory mf= new MultimediaFactory();
     this.capturer=mf.getFramesCapturer();
     this.capturer.Open(videoFile);
     this.start= start;
     this.stop = stop;
     this.interval = interval;
     this.outputDir = outputDir;
     this.seriesName = System.IO.Path.GetFileName(outputDir);
     this.totalFrames = (int)Math.Floor((double)((stop - start ) / interval))+1;
 }
Beispiel #2
0
        public static new PreviewMediaFile GetMediaFile(string filePath)
        {
            int duration=0;
            bool hasVideo;
            bool hasAudio;
            string AudioEncoderType = "";
            string VideoEncoderType = "";
            int fps=0;
            int height=0;
            int width=0;
            Pixbuf preview=null;
            MultimediaFactory factory;
            IMetadataReader reader;
            IFramesCapturer thumbnailer;

            try{
                factory =  new MultimediaFactory();
                reader = factory.getMetadataReader();
                reader.Open(filePath);
                hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
                hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
                if (hasAudio){
                    AudioEncoderType = (string) reader.GetMetadata(MetadataType.AudioEncoderType);
                }
                if (hasVideo){
                    VideoEncoderType = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
                    fps = (int) reader.GetMetadata(MetadataType.Fps);
                    thumbnailer = factory.getFramesCapturer();
                    thumbnailer.Open(filePath);
                    thumbnailer.SeekTime(1000,false);
                    preview = thumbnailer.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
                    duration =(int) ((thumbnailer as GstPlayer).StreamLength/1000);				/* On Windows some formats report a 0 duration, try a last time with the reader */
                    if (duration == 0)
                        duration = (int)reader.GetMetadata(MetadataType.Duration);
                    thumbnailer.Dispose();
                }
                height = (int) reader.GetMetadata(MetadataType.DimensionX);
                width = (int) reader.GetMetadata (MetadataType.DimensionY);
                reader.Close();
                reader.Dispose();

                return new PreviewMediaFile(filePath,duration*1000,
                                            (ushort)fps,hasAudio,
                                            hasVideo,VideoEncoderType,
                                            AudioEncoderType,(uint)height,
                                            (uint)width,preview);
            }
            catch (GLib.GException ex){
                throw new Exception (Catalog.GetString("Invalid video file:")+"\n"+ex.Message);
            }
        }