欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 1230|回复: 3
收起左侧

[游戏问题] 如何检查电台链接是否有效

[复制链接]
知行 发表于 2023-2-9 22:46 | 显示全部楼层 |阅读模式
50金币
比如
https://lhttp.qtfm.cn/live/4915/64k.mp3

这个电台链接,如何检查是否能够正常播放?

最佳答案

查看完整内容

或许可以试试 [md]``` mplayer -endpos 0 http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one MPlayer 1.4 (Debian), built with gcc-11 (C) 2000-2019 MPlayer Team do_connect: could not connect to socket connect: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one. Resolving stream.liv ...
ETS2CN 发表于 2023-2-9 22:46 | 显示全部楼层
或许可以试试
mplayer -endpos 0 http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one
MPlayer 1.4 (Debian), built with gcc-11 (C) 2000-2019 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one.
Resolving stream.live.vc.bbcmedia.co.uk for AF_INET6...

Couldn't resolve name for AF_INET6: stream.live.vc.bbcmedia.co.uk
Resolving stream.live.vc.bbcmedia.co.uk for AF_INET...
Connecting to server stream.live.vc.bbcmedia.co.uk[132.185.210.72]: 80...

Name   : BBC Radio
Public : yes
Bitrate: 128kbit/s
Cache size set to 320 KBytes
Cache fill:  0.00% (0 bytes)   
ICY Info: StreamTitle='BBC Radio 1';
Cache fill: 10.00% (32768 bytes)   

Audio only file format detected.
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   0.0 (00.0) of -0.0 (unknown) ??,?% 17% 

Exiting... (End of file)
回复 打印

使用道具 举报

ETS2CN 发表于 2023-2-18 16:46 | 显示全部楼层
或许是更好的方法
ffprobe -print_format json -show_streams http://stream.live.vc.bbcmedia.co.uk/bbc_radio_one 2>/dev/null |jq . 
{
  "streams": [
    {
      "index": 0,
      "codec_name": "mp3",
      "codec_long_name": "MP3 (MPEG audio layer 3)",
      "codec_type": "audio",
      "codec_tag_string": "[0][0][0][0]",
      "codec_tag": "0x0000",
      "sample_fmt": "fltp",
      "sample_rate": "48000",
      "channels": 2,
      "channel_layout": "stereo",
      "bits_per_sample": 0,
      "r_frame_rate": "0/0",
      "avg_frame_rate": "0/0",
      "time_base": "1/14112000",
      "start_pts": 0,
      "start_time": "0.000000",
      "bit_rate": "128000",
      "disposition": {
        "default": 0,
        "dub": 0,
        "original": 0,
        "comment": 0,
        "lyrics": 0,
        "karaoke": 0,
        "forced": 0,
        "hearing_impaired": 0,
        "visual_impaired": 0,
        "clean_effects": 0,
        "attached_pic": 0,
        "timed_thumbnails": 0
      }
    }
  ]
}
回复 打印

使用道具 举报

 楼主| 知行 发表于 2023-2-28 11:10 | 显示全部楼层

-show_format,可以取到 比特率 信息,tags 里有电台流的 metadata

    $sCMD = "ffprobe -v quiet -print_format json -show_format -i " . $sUrl;
    exec($sCMD, $sOutput, $iResult);
    $sOutput = implode("",$sOutput);
    $aOutput = json_decode($sOutput, true);



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复 打印

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-3-29 06:59 , Processed in 0.037124 second(s), 8 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表