MPMoviePlayerController 中不带扩展名的 HTTP 流

发布于 2024-08-29 16:26:50 字数 329 浏览 13 评论 0原文

我目前让 VLC 流式传输 WMV 文件,同时将文件实时转换为带有 MP3 音频的 H264。这意味着您将获得一个仅包含 IP 和端口的 URL (http://127.0.0.1:1234/)。当我尝试让 MPMoviePlayerController 传输此内容时,它说无法打开该扩展...

我该怎么办?我听说你必须创建一个 M3U8 文件,但我不知道该怎么做。

这个问题有解决方案吗,或者有 MPMoviePlayerController 的替代方案吗?

提前致谢

I'm currently letting VLC stream a WMV file while it converts the file live to H264 with MP3 audio. This means you get an URL with just an IP and a port (http://127.0.0.1:1234/). When I try to let MPMoviePlayerController stream this, it says it can't open that extension...

What should I do? I heard that you have to create a M3U8 file, but I have no idea how to do that.

Are there any solutions for this problem, or is there an alternative to MPMoviePlayerController?

Thanks in advance

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

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

发布评论

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

评论(1

同尘 2024-09-05 16:26:50

我刚刚尝试过这个,它对我有用......我不知道这是否正是你正在寻找的......

在带有 VLC 的计算机上,我运行了 [1]:

/Applications/VLC.app/Contents/MacOS/VLC --intf=rc SOME_VIDEO \\
'--sout=#transcode{fps=25,vcodec=h264,venc=x264{aud,profile=baseline,level=30,\\
keyint=30,bframes=0,ref=1,nocabac},acodec=mp3,ab=56,audio-sync,deinterlace}:\\
standard{mux=ts,access=http,dst=192.168.80.26:8080/test.mp4}'

现在,如果您这样做,您应该能够直接连接任何媒体播放器,例如 VLC 本身,但是,正如您已经说过的,它不适用于 MPMoviePlayerController .. 所以我做了什么...我创建了这样的 m3u8 文件,并将其命名为“test.m3u8”

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10, 
http://192.168.80.26:8080/test.mp4

该文件只是指向流,然后我将其放入在诸如 apache 之类的网络服务器中...
它起作用了..我能够使用 MPMoviePlayerController 观看流媒体...
现在我只需要弄清楚如何离开那里,因为我刚刚学习如何使用 MPMoviePlayerController 并且我不知道如何设置“完成”按钮:-)

顺便说一句...在源代码中...字符串我分配给 MPMoviePlayerController 是这样的:
NSString *path = @"http://192.168.80.26/~user/test.m3u8";

我不知道这是否是最有效的或正确的做法..但至少它有效;)

cya

I just tried this and it worked to me...I don't know if it is exactly what you are looking for..

In a computer with VLC, I ran [1]:

/Applications/VLC.app/Contents/MacOS/VLC --intf=rc SOME_VIDEO \\
'--sout=#transcode{fps=25,vcodec=h264,venc=x264{aud,profile=baseline,level=30,\\
keyint=30,bframes=0,ref=1,nocabac},acodec=mp3,ab=56,audio-sync,deinterlace}:\\
standard{mux=ts,access=http,dst=192.168.80.26:8080/test.mp4}'

Now, if you do that you should be able to connect directly with any mediaplayer like VLC itself, but that, as you already said, didnt work with MPMoviePlayerController .. so what I did...I create the m3u8 file like this and I named "test.m3u8"

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10, 
http://192.168.80.26:8080/test.mp4

This file just is pointing to the stream, then I put this in a webserver such as apache...
and it worked..i was able to watch the stream using MPMoviePlayerController...
now i just have to figure out how to get out of there, as I just learning how to use MPMoviePlayerController and I dont know how to setup the "done" button :-)

btw...in the source code...the string I assigned to MPMoviePlayerController is something like this:
NSString *path = @"http://192.168.80.26/~user/test.m3u8";

I dont know if this is most efficient or the right thing to do..but at least it works ;)

cya

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