[已找到] 谁有央视4K超高清频道的4K播放源?网上能找到的实际分辨率最高只有1080P
『回复列表(58|显示机器人聊天)』
https://guihet.com/yspcctv4k.html
都能用,不过ysp1.php
更好。因为ysp2.php
是根据时间进行切片文件名预测,虽然大部分情况下都能预测准确,但是偶尔也会预测失败导致卡顿。
更新1:我突然发现ysp2.php
的最大问题不是卡顿,而是播放时间不正确,奥运频道落后了好几个小时。看来要重新计算一下起始时间,代码里的常数1830
已经不对了。
更新2:已修复ysp2.php
的起始时间问题,并且添加了时移功能。
https://hu60.cn/download/cctv/ysp1.php
https://hu60.cn/download/cctv/ysp2.php
时移(只能时移到你自己看过的时间段,原理是CDN缓存未过期。空格要用+号代替):
https://hu60.cn/download/cctv/ysp2.php?time=2022-02-09+20:00:00
https://hu60.cn/download/cctv/ysp1.php?chan=CCTV16-4K
https://hu60.cn/download/cctv/ysp2.php?chan=CCTV16-4K
时移(只能时移到你自己看过的时间段,原理是CDN缓存未过期。空格要用+号代替):
https://hu60.cn/download/cctv/ysp2.php?chan=CCTV16-4K&time=2022-02-09+20:00:00
ysp1.php
(来自 https://guihet.com/yspcctv4k.html)
需要在php所在目录创建cache
文件夹。
原理:模拟央视投屏助手app,从服务器获取播放地址。
<?php
# 频道
# CCTV-4K 4K H.264/AVC: 4K10M
# CCTV-4K 4K H.265/HEVC:4K0219
# CCTV-16 4K H.265/HEVC:CCTV16-4K
$chan = isset($_GET['chan']) ? $_GET['chan'] : '4K0219';
$cache = new Cache(3600,"cache/");
$playUrl = $cache->get($chan);
if(!$playUrl)
{
$bstrURL = "https://ytpvdn.cctv.cn/cctvmobileinf/rest/cctv/videoliveUrl/getstream";
$postData = 'appcommon={"ap":"cctv_app_tv","an":"央视投屏助手","adid":"1234123122","av":"1.1.7"}&url=http://live-tp4k.cctv.cn/live/'.$chan.'.stream/playlist.m3u8';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $bstrURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER,array("User-Agent: cctv_app_tv","Referer: api.cctv.cn","UID: 1234123122"));
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$data = curl_exec($ch);
curl_close($ch);
$obj = json_decode($data);
$playUrl = $obj->url;
$playUrl = str_replace("playlist.m3u8","1.m3u8",$playUrl);
$cache->put($chan,$playUrl);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $playUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER,array("User-Agent: cctv_app_tv","Referer: api.cctv.cn","UID: 1234123122"));
$data = curl_exec($ch);
curl_close($ch);
$data = preg_replace('/(.*?.ts)/i',"http://livews-tp4k.cctv.cn/live/$chan.stream/$1",$data);
header("Content-Type: application/x-mpegURL");
header("Content-Disposition:attachment;filename=playlist.m3u8");
echo $data;
exit;
// 以下缓存类来自互联网,请确保cache目录存在以及读写权限 //
class Cache {
private $cache_path;
private $cache_expire;
public function __construct($exp_time=3600,$path="cache/"){
$this->cache_expire=$exp_time;
$this->cache_path=$path;
}
private function fileName($key){
return $this->cache_path.md5($key);
}
public function put($key, $data){
$values = serialize($data);
$filename = $this->fileName($key);
$file = fopen($filename, 'w');
if ($file){
fwrite($file, $values);
fclose($file);
}
else return false;
}
public function get($key){
$filename = $this->fileName($key);
if (!file_exists($filename) || !is_readable($filename)){ return false; }
if ( time() < (filemtime($filename) + $this->cache_expire) ) {
$file = fopen($filename, "r");
if ($file){
$data = fread($file, filesize($filename));
fclose($file);
return unserialize($data);
}
else return false;
}
else return false;
}
}
ysp2.php
(来自 https://guihet.com/yspcctv4k.html)
发现了视频切片.ts的文件名时间规律,直接根据当前时间生成播放列表。
虽然大部分情况下都能预测准确,但是偶尔也会预测失败导致卡顿。
如果以后切片方法发生改变,可能就不能用了。
<?php
# 指定chan参数切换频道
# CCTV-4K 4K H.264/AVC: 4K10M
# CCTV-4K 4K H.265/HEVC: 4K0219
# CCTV-16 4K H.265/HEVC: CCTV16-4K
$chan = isset($_GET['chan']) ? $_GET['chan'] : '4K0219';
# 指定time参数使用时移功能
# 格式:
# time=2022-02-09+20:00:00
# 注意空格要用+号代替。
if (isset($_GET['time'])) {
$timeOffset = time() - strtotime($_GET['time']);
header("Content-Type: application/x-mpegURL");
header("Content-Disposition: attachment; filename=playlist-offset-$timeOffset.m3u8");
# 生成时移播放列表
# 通过子列表把时间差传递给当前程序,以便生成不断变化的ts文件序号
echo "#EXTM3U\n#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=31457280\n$_SERVER[PHP_SELF]?chan=$chan&timeOffset=$timeOffset\n";
exit;
}
$time = time();
# 计算时移
if (isset($_GET['timeOffset'])) {
$time -= intval($_GET['timeOffset']);
}
# 起始序号
# 计算公式:intval(time() / 4) - 当前序号
$base = array(
'4K10M' => 404,
'4K0219' => 404,
'CCTV16-4K' => 2,
);
if (isset($base[$chan])) {
$base = $base[$chan];
} else {
# 起始序号未知,播放时间可能不正确
$base = 0;
}
# c4k 切片版
$seq = intval($time / 4) - $base;
$content = "#EXTM3U\n#EXT-X-VERSION:3\n#EXT-X-TARGETDURATION:5\n#EXT-X-MEDIA-SEQUENCE:$seq\n";
for($i=0;$i<3;$i++)
{
$content .= "#EXTINF:4.000,\n";
$content .= "http://livews-tp4k.cctv.cn/live/$chan.stream/1-".$seq.".ts\n";
$seq = $seq + 1;
}
header("Content-Type: application/x-mpegURL");
header("Content-Disposition: attachment; filename=playlist.m3u8");
echo $content;
@Sunset,是。你可以用这个1080P地址。不对,这也是4K的,只不过是H.264/AVC:
https://hu60.cn/download/cctv/ysp1.php?chan=4K10M
https://hu60.cn/download/cctv/ysp2.php?chan=4K10M
时移(只能时移到你自己看过的时间段,原理是CDN缓存未过期。空格要用+号代替):
https://hu60.cn/download/cctv/ysp2.php?chan=4K10M&time=2022-02-09+20:00:00
这个地址好像更不好,看一会儿之后画面就会撕裂……
还是用播放器播放HEVC视频流吧,比如用VLC(也有手机版)。
ysp4k.m3u
#EXTINF:-1,CCTV 4K超高清频道 HEVC 4K HDR
https://hu60.cn/download/cctv/ysp1.php
#EXTINF:-1,CCTV 4K超高清频道 HEVC 4K HDR 切片预测
https://hu60.cn/download/cctv/ysp2.php
#EXTINF:-1,CCTV 4K超高清频道 AVC 4K HDR
https://hu60.cn/download/cctv/ysp1.php?chan=4K10M
#EXTINF:-1,CCTV 4K超高清频道 AVC 4K HDR 切片预测
https://hu60.cn/download/cctv/ysp2.php?chan=4K10M
#EXTINF:-1,CCTV 16 奥林匹克 HEVC 4K HDR
https://hu60.cn/download/cctv/ysp1.php?chan=CCTV16-4K
#EXTINF:-1,CCTV 16 奥林匹克 HEVC 4K HDR 切片预测
https://hu60.cn/download/cctv/ysp2.php?chan=CCTV16-4K