Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
flash视频的长度_Flash_Video - Fatal编程技术网

flash视频的长度

flash视频的长度,flash,video,Flash,Video,我需要找到在任何流行的视频共享网站上托管的flash视频的长度。这可能吗 Blinkx如何确定它索引的视频长度 先谢谢你 问候 MansoorFLV或RTMP流包含详细说明持续时间的onMetaData脚本,前提是发起者知道该脚本(例如,您不能从“实时”流中获取) 您可以阅读和规格并进行自己的解剖,也可以在Flash中播放视频并等待回调。如果在C#中,我不久前也做过类似的smth class FLVFileLength { private static Double By

我需要找到在任何流行的视频共享网站上托管的flash视频的长度。这可能吗

Blinkx如何确定它索引的视频长度

先谢谢你

问候
Mansoor

FLV或RTMP流包含详细说明持续时间的onMetaData脚本,前提是发起者知道该脚本(例如,您不能从“实时”流中获取)

您可以阅读和规格并进行自己的解剖,也可以在Flash中播放视频并等待回调。

如果在C#中,我不久前也做过类似的smth

class FLVFileLength
    {
        private static Double ByteArrayToDouble(byte[] bytes, bool readInReverse)
        {
            if (bytes.Length != 8)
                throw new Exception("bytes must be exactly 8 in Length");
            if (readInReverse)
                Array.Reverse(bytes);
            return BitConverter.ToDouble(bytes, 0);
        }


        private static Double GetNextDouble(Stream fileStream, int offset, int length)
        {
            byte[] bytes = new byte[length];
            // read bytes
            int result = fileStream.Read(bytes, 0, length);
            if (result != length)
                return -1;

            // convert to double (all flass values are written in reverse order)
            return ByteArrayToDouble(bytes, true);
        }

        private static string ByteArrayToString(byte[] bytes)
        {
            string byteString = string.Empty;
            foreach (byte b in bytes)
            {
                byteString += Convert.ToChar(b).ToString();
            }
            return byteString;
        }

        public double GetFLVlength(string URL)
        {
            try
            {
                HttpWebRequest http = HttpWebRequest.Create(URL) as HttpWebRequest;
                http.Proxy = WebProxyManager.GetNextProxy();
                http.UserAgent = UserAgentManager.GetNextUserAgent();
                HttpWebResponse response = http.GetResponse() as HttpWebResponse;
                Stream streamReader = response.GetResponseStream();

                double duration = -1;
                Stream fileStream = response.GetResponseStream();
                byte[] bytes = new byte[1024];
                string tag = "duration";
                int length = fileStream.Read(bytes, 0, 1024);
                string z = ByteArrayToString(bytes);
                if (z.Contains(tag))
                {
                    int pos = z.IndexOf(tag) + tag.Length + 1;
                    MemoryStream ms = new MemoryStream(bytes, pos, 8);
                    BinaryReader br = new BinaryReader(ms);
                    duration = ByteArrayToDouble(br.ReadBytes(8), true);
                }
                fileStream.Close();
                return duration;
            }
            catch (Exception)
            {
                return -1;
            }
        }
    }

可以从电影中提取持续时间。

如何使用PHP获取元数据?与“嵌入式”标记的通常含义不同,建议您重新标记wmv、avi等的持续时间。。。?