Example #1
0
        public override void Start()
        {
            int pos = 0;

            ffmpeg.StarByte();
            while (Input.IsOpen | (Input.Count > 0))
            {
                byte[] temp = Input.Take(frameSize);
                pos += temp.Length;
                ffmpeg.Write(temp);

                String s;
                while ((s = ffmpeg.ErrorString()) != "")
                {
                    //    Console.Write(s);
                }
                while ((s = ffmpeg.ReadString()) != "")
                {
                    //   Console.Write(s);
                }
            }

            /*
             * Console.WriteLine("MP4 TO MP4 TO MP4 TO MP4 TO");
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             * Console.WriteLine(pos.ToString());
             */
            ffmpeg.Hatiko();
        }
Example #2
0
        public override void Start()
        {
            ffmpeg.StarByte();
            String s;

            //debug
            // int i = 0;

            byte[] temp;
            while (true)
            {
                if (token.token)
                {
                    break;
                }

                while ((s = ffmpeg.ErrorString()) != "")
                {
                    //   Console.WriteLine(s);
                }

                if (ffmpeg.IsRunning)
                {
                    temp = ffmpeg.Read();
                    if (temp == null)
                    {
                        continue;
                    }
                }
                else
                {
                    temp = ffmpeg.Read();
                    if (temp == null)
                    {
                        break;
                    }
                }
                //debug
                //   i += temp.Length;

                Output.Add(temp);
            }
            //debug

            Output.Complete();
            ffmpeg.Terminate();
        }
Example #3
0
        public int GetWidthFromPath(String path)
        {
            DFffmpeg ffmpeg = new DFffmpeg(GenerateArgs(path));

            ffmpeg.StarByte();
            String s = "";
            String temp;

            while (true)
            {
                ffmpeg.Wait(100);
                temp = ffmpeg.ErrorString();
                if (temp != "")
                {
                    s += temp;
                    continue;
                }
                else if ((s.Length > 0) & (!ffmpeg.IsRunning))
                {
                    break;
                }
            }
            ffmpeg.Terminate();

            int l = s.IndexOf("Stream #");

            l = s.IndexOf("yuv", l);
            l = s.IndexOf("x", l) + 1;
            int r = s.IndexOf(",", l);

            s = s.Substring(l, r - l);
            r = s.IndexOf(" ");
            if (r > 0)
            {
                s = s.Substring(0, r);
            }
            return(int.Parse(s));
        }
Example #4
0
        public override void Start()
        {
            ffmpeg.StarByte();
            youtube.StarByte();
            Boolean youtubeStillRun;
            String  s;
            //debug
            int i = 0;

            byte[] temp;
            bool   youtubeClosed = false;

            while (true)
            {
                if (token.token)
                {
                    break;
                }

                while ((s = ffmpeg.ErrorString()) != "")
                {
                    Console.WriteLine(s);
                }
                while ((s = youtube.ErrorString()) != "")
                {
                    Console.WriteLine(s);
                }

                while (ffmpeg.ReadCount > 0)
                {
                    temp = ffmpeg.Read();
                    if (temp != null)
                    {
                        Output.Add(temp);
                    }
                }

                while ((youtube.ReadCount > 0) & (ffmpeg.WriteCount < 2))
                {
                    temp = youtube.Read();
                    if (temp != null)
                    {
                        ffmpeg.Write(temp);
                    }
                    //    i += temp.Length;
                    //    Console.WriteLine(i);
                }

                if ((!youtubeClosed)
                    & (!youtube.IsRunning)
                    & (youtube.ReadCount == 0)
                    & ffmpeg.WriteCount == 0
                    & ffmpeg.ReadCount == 0)
                {
                    ffmpeg.Hatiko();
                    youtubeClosed = true;
                }

                if (youtubeClosed & (!ffmpeg.IsRunning) & (ffmpeg.ReadCount == 0))
                {
                    break;
                }
            }
            //debug

            Output.Complete();

            youtube.Terminate();
        }