php flvナオペン

WBOY
リリース: 2016-07-21 15:36:28
オリジナル
1127 人が閲覧しました

澶嶅埗浠g爜浠g爜濡备笅:

銆€銆€function BigEndian2Int($byte_word, $signed = false) {
銆€銆€$int_ value = 0;
銆€銆€$byte_wordlen = strlen($byte_word);
銆€銆€for ($i = 0; $i < $byte_wordlen; $i++)
銆€銆€{
銆€銆€ $ int_value += ord($byte_word{$i}) * pow(256, ($byte_wordlen - 1 - $i))
銆€銆€}
銆€銆€if ($signed)
銆€銆€ {
銆€銆€$sign_mask_bit = 0x80 << (8 * ($byte_wordlen - 1))
銆€銆€if ($int_value & $sign_mask_bit)
銆€銆€$ int_value = 0 - ($int_value & ($sign_mask_bit - 1)); ( $name){
銆€銆€if(!file_exists($name)){
銆€銆€return
銆€銆€$flv_data_length=filesize($name);
銆€fp = @fopen($name, 'rb');
銆€銆€$flv_header = fread($fp, 5);
$frame_size_data_length =BigEndian2Int(fread($fp, 4));
銆€銆€$flv_header_frame_length = 9;
銆€銆€if ($frame_size_data_length > $flv_header_frame_length) {
銆€銆€fseek($fp) , $frame_size_data_length - $flv_header_frame_length, SEEK_CUR);
銆€銆€$duration = 0;
銆€銆while ((ftell($fp) + 1) 銆€銆€$this_tag_header = fread($fp, 16);
銆€銆€$data_length = BigEndian2Int(substr($this_tag_header, 5, 3));
銆€銆€$timestamp = BigEndian2Int(substr($this_tag_header, 8) , 3));
銆€銆€$next_offset = ftell($fp) - 1 + $data_length if ($timestamp > $duration) {
銆€銆€$duration = $タイムスタンプ;
銆€銆€}
銆€銆€fseek($fp, $next_offset, SEEK_SET)
銆€銆€fclose($fp); €銆€}
銆€銆€function fn($time){
銆€銆€$num = $time;
銆€銆€$sec = intval($num / 1000); = intval($sec / 3600);
銆€銆€$m = intval(($sec % 3600) / 60)
銆€銆€$s = intval(($sec % 60 )); $tm = $h . $s ;
銆€銆€echo getTime("27729.flv") ;





http://www.bkjia.com/PHPjc/322136.html

www.bkjia.com

tru​​e

http://www.bkjia.com/PHPjc/322136.html

技術記事

涶嶅嗗浠g爜濡备笅: ?php function BigEndian2Int($byte_word, $signed = false) { $int_value = 0; $byte_wordlen = strlen($byte_word) for ($i = 0; $i $byte_wordlen; $i++) { $in...



関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!