iPhone HTTP Streaming .m3u8 和 .ts 文件 - 如何使用 ffmpeg 创建

发布于 2024-09-09 05:11:14 字数 2322 浏览 0 评论 0原文

我正在尝试使用 ffmpeg 获取经过苹果验证的 http 媒体流,但出现错误。以下是一些错误示例:

警告:播放列表内容类型为“application/x-mpegurl”,但应该 是“application/vnd.apple.mpegurl”、“audio/x-mpegurl”之一或 '音频/mpegurl'。

警告:258 个样本 (88.966 %) 在轨道 256 中没有时间戳 (avc1)。 4:us2-1.ts ~~~~~~~~~

警告:媒体片段持续时间超出预期持续时间 47.733 %(5.23 与 10.00 秒,限制为 20%)。 40:us2-19.ts ~~~~~~~~~

Average segment duration: 10.16 seconds
Average segment bitrate: 320.12 kbit/s
Average segment structural overhead: 175.89 kbit/s (54.94 %)

Video codec: avc1
Video resolution: 320x320 pixels
Video frame rate: 29.72, 29.78, 29.82, 30.00, 29.64 fps
Average video bitrate: 100.66 kbit/s
H.264 profile: Baseline
H.264 level: 3.0

Audio codec: aac 
Audio sample rate: 48000 Hz
Average audio bitrate: 43.57 kbit/s

这是我提交的最终文件: http://files.chesscomfiles.com/images_users/using/us2.m3u8

这是我用来创建此文件的文件:http://files.chesscomfiles.com/images_users/using/using-computers-1.mp4

我已经尝试过这些命令,其中包括:

ffmpeg -i using-computers-1.mp4 -f mpegts -acodec libfaac -ar 48000 -ab 64k -s 320x320 -vcodec libx264 -vbsf h264_mp4toannexb -b 96k -flags +loop -cmp +chroma -分区 +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -编码器 0 -me_range 16 -keyint_min 2 - sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 us2.ts< /p>

ffmpeg -i using-computers-1.mp4 -f mpegts -acodec libfaac -ar 48000 -ab 64k -s 320x320 -vcodec libx264 -vbsf h264_mp4toannexb -b 96k -flags +loop -cmp +chroma -分区 +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -编码器 0 -me_range 16 -keyint_min 25 - sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 us1.ts< /p>

ffmpeg -i using-computers-1.mp4 -vbsf h264_mp4toannexb -acodec copy -vcodec copy -f mpegts output.ts

如果有人可以帮助我弄清楚我应该运行哪些 ffmpeg 命令,我将非常感激!

I'm trying to get apple-validated http media streams using ffmpeg and am getting errors. Here are some error examples:

WARNING: Playlist Content-Type is 'application/x-mpegurl', but should
be one of 'application/vnd.apple.mpegurl', 'audio/x-mpegurl' or
'audio/mpegurl'.

WARNING: 258 samples (88.966 %) do not have timestamps in track 256
(avc1). 4: us2-1.ts
~~~~~~~~

WARNING: Media segment duration outside of expected duration by 47.733
% (5.23 vs. 10.00 seconds, limit is 20 %). 40: us2-19.ts
~~~~~~~~~

Average segment duration: 10.16 seconds
Average segment bitrate: 320.12 kbit/s
Average segment structural overhead: 175.89 kbit/s (54.94 %)

Video codec: avc1
Video resolution: 320x320 pixels
Video frame rate: 29.72, 29.78, 29.82, 30.00, 29.64 fps
Average video bitrate: 100.66 kbit/s
H.264 profile: Baseline
H.264 level: 3.0

Audio codec: aac 
Audio sample rate: 48000 Hz
Average audio bitrate: 43.57 kbit/s

Here is the end file I've been submitting: http://files.chesscomfiles.com/images_users/using/us2.m3u8

Here is the file I used to create this: http://files.chesscomfiles.com/images_users/using/using-computers-1.mp4

I've tried these commands, among others:

ffmpeg -i using-computers-1.mp4 -f mpegts -acodec libfaac -ar 48000
-ab 64k -s 320x320 -vcodec libx264 -vbsf h264_mp4toannexb -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 2 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 us2.ts

ffmpeg -i using-computers-1.mp4 -f mpegts -acodec libfaac -ar 48000
-ab 64k -s 320x320 -vcodec libx264 -vbsf h264_mp4toannexb -b 96k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 96k -bufsize 96k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 -async 2 us1.ts

ffmpeg -i using-computers-1.mp4 -vbsf h264_mp4toannexb -acodec copy -vcodec copy -f mpegts output.ts

If someone can help me figure out what ffmpeg commands I should be running I'd really appreciate it!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光瘦了 2024-09-16 05:11:14

关于第一个警告:

警告:播放列表内容类型为
'application/x-mpegurl',但应该是
之一
'应用程序/vnd.apple.mpegurl',
“音频/x-mpegurl”或“音频/mpegurl”。

它可能来自服务器设置。按照此 离子炮帖子

准备HTTP服务器上传一组
代表流的文件和
流定义文件(ts 和
m3u8)。这些文件可以上传到
此时有一个网络服务器
是采取这一行动的另一个重要步骤
确保它们会被下载
正确地设置 mime
类型。有两种哑剧类型
对于流媒体来说很重要
内容:

.m3u8 应用程序/x-mpegURL

.ts 视频/MP2T

如果您使用 Apache,您
想要添加以下内容
你的 httpd.conf 文件:

AddType应用程序/x-mpegURL .m3u8

AddType 视频/MP2T .ts

如果你是
使用 lighttpd 你会想要把
这在你的配置文件中(如果
你还定义了其他 mime 类型
确保你只是添加这些并且不设置
他们):

mimetype.assign = ( ".m3u8" =>;
“应用程序/x-mpegURL”,“.ts”=>
“视频/MP2T”)

Regarding the first warning:

WARNING: Playlist Content-Type is
'application/x-mpegurl', but should be
one of
'application/vnd.apple.mpegurl',
'audio/x-mpegurl' or 'audio/mpegurl'.

It could be from the server setup. Follow the instructions from Step 4 of this Ion Cannon post:

Prepare the HTTP server Upload a set
of files that represent the stream and
a stream definition file (ts and
m3u8). Those files can be uploaded to
a web server at this point but there
is another important step to take that
ensures they will be download
correctly and that is setting up mime
types. There are two mime types that
are important for the streaming
content:

.m3u8 application/x-mpegURL

.ts video/MP2T

If you are using Apache you
would want to add the following to
your httpd.conf file:

AddType application/x-mpegURL .m3u8

AddType video/MP2T .ts

If you are
using lighttpd you would want to put
this in your configuration file (if
you have other mime types defined make
sure you just add these and don't set
them):

mimetype.assign = ( ".m3u8" =>
"application/x-mpegURL", ".ts" =>
"video/MP2T" )

浅浅淡淡 2024-09-16 05:11:14

关于第三个警告:

警告:媒体片段持续时间
超出预期持续时间 47.733
%(5.23 与 10.00 秒,限制为 20
%)。 40:us2-19.ts~~~~~~~~~

如果某个片段的持续时间与播放列表 (m3u8) 中该片段列出的持续时间不同,通常会发生这种情况。例如,下面的播放列表有一个片段,并且由播放列表列出为10秒。如果该段的实际持续时间相差太大(超过 20%),验证者就会抱怨。

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10, 
med0.ts 
#EXT-X-ENDLIST

通常播放列表中的最后一个片段与目标略有不同,可以忽略此警告。

并且,作为一般规则,这些“警告”消息可以忽略,但需要认真对待“错误”消息。

然而,第二个警告看起来更严重,并可能导致苹果的拒绝。它可能是您的分段器命令(您正在使用 mediastreamsegmenter 吗?)。

另外,我没有使用“-vbsf h264_mp4toannexb”。而且,我正在使用“-async 50”。

顺便说一句,您的播放列表的链接无效。

Regarding the third warning:

WARNING: Media segment duration
outside of expected duration by 47.733
% (5.23 vs. 10.00 seconds, limit is 20
%). 40: us2-19.ts ~~~~~~~~~

This usually happens if a segment is a different duration than how the duration listed for that segment in the playlist (m3u8). For example, the below playlist has one segment and is listed by the playlist to be 10 seconds. If the actual duration of this segment is different by too much (more than 20%), than the validator will complain.

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10, 
med0.ts 
#EXT-X-ENDLIST

Usually the last segment in a playlist will differ a bit from the target, and this warning can be ignored.

And, as a general rule these "WARNING" messages can be ignored, but "ERROR" messages need to be taken seriously.

However, the second warning looks more serious, and could possibly lead to a rejection from Apple. It could be your segmenter commands (are you using mediastreamsegmenter?).

Also, I'm not using "-vbsf h264_mp4toannexb". And, I'm using "-async 50".

Btw, the link to your playlist is invalid.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文