MPEG-TS段HTTP Live Streaming [英] MPEG-TS Segments HTTP Live Streaming

查看:134
本文介绍了MPEG-TS段HTTP Live Streaming的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图交错MPEG-TS片段但失败。实际上使用笔记本电脑中的内置相机捕获一组细分,然后使用以下命令使用FFMPEG进行编码:

  ffmpeg -er 4 -y -f video4linux2 -s 640x480 -r 30 -i%s -isync -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags + genpts -b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k-maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -apect 640:480 

另一个是使用以下命令编码的avi文件:

  fmpeg -er 4 -y -f avi -s 640x480 -r 30 -i ./DSCF2021.AVI -vbsf dump_extra -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags + genpts  - b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k-maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -apect 640:480 

然后输出被分割成ts segme nts使用开源分割器。



如果两者都来自相同的源(都来自相机),它们可以正常工作。但是在这种情况下,第二组段冻结。时间过去,但视频不移动..
所以我认为这是一个编码问题。所以我的问题是,我应该如何更改ffmpeg命令以使其工作?



通过交错我的意思是,播放列表与第一组段和另一个播放列表与另一组段,并且客户端调用另一组(HTTP Live Streaming)



第一组段之一的ffprobe输出: p>

 输入#0,mpegts,来自'live1.ts':
持续时间:00:00:09.76,开始:1.400000 ,bitrate:281 kb / s
程序1 Service01
元数据:
名称:Service01
提供者名称:FFmpeg
流#0.0 [0x100]:视频:h264,yuv420p ,640x480 [PAR 1:1 DAR 4:3],29.92 fps,29.92 tbr,90k tbn,59.83 tbc
流#0.1 [0x101]:音频:aac,48000 Hz,立体声,s16,111 kb / s

第二组段之一的ffprobe输出:

 输入#0,mpegts,来自'ad1.ts':
持续时间:00:00:09.64,开始:1。 400000,bitrate:578 kb / s
程序1 Service01
元数据:
名称:Service01
provider_name:FFmpeg
流#0.0 [0x100]:视频:h264, yuv420p,640x480 [PAR 1:1 DAR 4:3],25 fps,25 tbr,90k tbn,50 tbc
流#0.1 [0x101]:音频:aac,48000 Hz,立体声,s16,22 kb / s

谢谢,

解决方案

我在这个主题中看到了很多问题 - 见:


  1. HTTP直播MPEG TS片段

  2. 更新HTTP Live流式的.m3u8播放列表文件

我不确定确切的问题 - 但我认为大多数人抱怨说,当您将来自两个来源的内容混合在一起时,会有冻结。



如果PTS和/或PCR不连续,玩家无法识别或冲洗,可能会出现这种情况。可能您可以确定时间戳的顺序,看看是否解决问题。



另请参阅3.3.11。的 http://tools.ietf.org/html/draft -pantos-http-live-streaming-07 :EXT-X-DISCONTINUITY


EXT-X-DISCONTINUITY标签表示编码不连续性

之间的媒体片段和之前的

之前的媒体片段。可能改变的一组特征是:



o文件格式

o数量和轨道类型

o encoding parameters

o编码序列

o timestamp序列


所以一个不连续标志在播放列表文件可能只是帮助,如果问题是上述任何一个。请尝试一些,并提出更多的细节。我猜,这样会帮助很多其他人。


I'm trying to interleave MPEG-TS segments but failing. One set of segments was actually captured using the built in camera in the laptop, then encoded using FFMPEG with the following command:

ffmpeg -er 4 -y -f video4linux2 -s 640x480 -r 30 -i %s -isync -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags +genpts -b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k -maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 640:480

And the other one is an avi file that was encoded using the following command:

fmpeg -er 4 -y -f avi -s 640x480 -r 30 -i ./DSCF2021.AVI -vbsf dump_extra -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -fflags +genpts -b 386k -coder 0 -me_range 16 -keyint_min 25 -i_qfactor 0.71 -bt 386k -maxrate 386k -bufsize 386k -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -aspect 640:480

Then the output is segmented into ts segments using an open source segmenter.

If both come from the same source (both from the camera) they work fine. However in this case, the second set of segments freeze. Time passes, but the video does not move.. So i think it's an encoding problem. So my question is, how should i change the ffmpeg command for this to work?

By interleave I mean, having a playlist with the first set of segments, and another playlist with the other set of segments, and having the client call one then the other (HTTP Live Streaming)

The ffprobe output of one of the first set of segments:

Input #0, mpegts, from 'live1.ts':
  Duration: 00:00:09.76, start: 1.400000, bitrate: 281 kb/s
  Program 1 Service01
    Metadata:
      name            : Service01
      provider_name   : FFmpeg
    Stream #0.0[0x100]: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 29.92 fps, 29.92 tbr, 90k tbn, 59.83 tbc
    Stream #0.1[0x101]: Audio: aac, 48000 Hz, stereo, s16, 111 kb/s

The ffprobe output of one of the second set of segments:

Input #0, mpegts, from 'ad1.ts':
  Duration: 00:00:09.64, start: 1.400000, bitrate: 578 kb/s
  Program 1 Service01
    Metadata:
      name            : Service01
      provider_name   : FFmpeg
    Stream #0.0[0x100]: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x101]: Audio: aac, 48000 Hz, stereo, s16, 22 kb/s

Thank you,

解决方案

I have seen quite a few questions in the subject - See:

  1. HTTP Live Streaming MPEG TS segment and
  2. Update .m3u8 playlist file for HTTP Live streaming?

I am not sure exact problem - but i think most people complain that when you mix content from both sources are different then there is a freezing.

I think this situation may arise if PTS and/or PCR is discontinuous and the player is not recognizing this or flushing it. Probably, you can identify the sequence of Timestamps and see if that being fixed solves the problems.

Also, see 3.3.11. of http://tools.ietf.org/html/draft-pantos-http-live-streaming-07 : EXT-X-DISCONTINUITY

The EXT-X-DISCONTINUITY tag indicates an encoding discontinuity
between the media segment that follows it and the one that preceded
it. The set of characteristics that MAY change is:

o file format
o number and type of tracks
o encoding parameters
o encoding sequence
o timestamp sequence

So a discontinuity flag in the playlist file might just help if the problem is any of the above. Please try some of this, and put more details. I guess, this will help lot of other people as well.

这篇关于MPEG-TS段HTTP Live Streaming的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆