【问题标题】:View MPEG-TS stream in browser在浏览器中查看 MPEG-TS 流
【发布时间】:2020-06-29 13:06:30
【问题描述】:

我想创建一个带有可以播放 H264 mpeg-ts 实时流的视频播放器的网页。我找不到任何可以做到这一点的网络播放器。

我了解到 JWPlayer 能够做到这一点,但仅限于付费版本。

流可以在 VLC 和任何其他播放器中播放。

我能做什么?我尝试使用 ffmpeg 将流转换为更有用的东西,但没有成功。

ffmpeg -i "http://localhost:9002/tv.ts" -vcodec libx264 -r 20 -s 320x240 -threads 2 -vprofile baseline -vpre zoom -strict experimental -acodec aac -ab 96000 -ar 48000 -ac 1 -f rtsp rtsp://192.168.0.28:1935/live/_definst_/c3

这是我得到的:

    Last message repeated 1 times
[h264 @ 0xbb9500] decode_slice_header error
[h264 @ 0xbb9500] no frame!
[mpegts @ 0xbaa6e0] decoding for stream 1 failed
[mpegts @ 0xbaa6e0] Could not find codec parameters for stream 1 (Video: h264 ([27][0][0][0] / 0x001B), none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'http://192.168.0.28:9002/tv.ts':
  Duration: N/A, start: 30764.854700, bitrate: N/A
  Program 1 
    Stream #0:0[0x44](???): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 128 kb/s
    Stream #0:1[0x45]: Video: h264 ([27][0][0][0] / 0x001B), none, 25 fps, 25 tbr, 90k tbn, 180k tbc
File for preset 'zoom' not found

【问题讨论】:

    标签: ffmpeg


    【解决方案1】:

    您可以尝试在您的网站中包含 hls.js 播放器。该播放器将您的 TS 流转换为 MP4 片段,以便在任何浏览器中播放。它是免费的且易于集成。

    演示页面https://video-dev.github.io/hls.js/demo/

    Github 页面https://github.com/video-dev/hls.js/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      • 1970-01-01
      • 2021-02-18
      • 2012-01-27
      • 2018-06-29
      • 2021-03-07
      • 2011-05-04
      相关资源
      最近更新 更多