如何使用ffmpeg通过http协议流 [英] How to stream with ffmpeg via http protocol

查看:2005
本文介绍了如何使用ffmpeg通过http协议流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个应该在Flowplayer中正确显示的流。
首先,我通过RTP将其发送到另一台电脑。在这里,我还检查了VLC,编解码器是否正确到达,他们这样做。

I'm currently doing a stream that is supposed to display correctly within Flowplayer. First I send it to another PC via RTP. Here, I also checked with VLC that the codec etc. arrive correctly, which they do.

现在我想将此流作为文件公开到Flowplayer,因此可以通过VLC中使用的东西显示:
http:// localhost:8080 / test.mp4

Now I want to expose this stream to Flowplayer as a file, so it can be displayed, via something I used in VLC: http://localhost:8080/test.mp4 for example.

我得到的全部是: ffmpeg -i输入-f mp4 http:// localhost:8080 / test.mp4

然而,无论我怎么样尝试这样做,我只得到一个输入/输出错误。这是唯一可能的东西像ffserver或另一个?

However, no matter how I try to do this, I only get an input/output error. Is this only possible with something like ffserver or another?

我认为这不行,因为ffmpeg不能作为服务器;在VLC上它可以工作。 (尽管VLC遗弃了我设置的编解码器,但由于某种原因而无法读取)

What I think is this doesn't work because ffmpeg can't act as a server; on VLC it works since it can. (Though VLC ruins the codecs I set and it can't be read afterwards for some reason)

可以使用的(一种)解决方法是将RTP流保存​​到一个文件,然后让flowplayer加载它。但是,只有在文件不被访问的情况下才有效;

A (sort of) workaround I can use is saving the RTP stream to a file, and then letting flowplayer load it. This, however, only works once the file is not accessed anymore; I get a codec error otherwise.

推荐答案

你需要这个命令行

ffmpeg -f v4l2 -s 320x240 -r 25 -i /dev/video0 -f alsa -ac 1 -i hw:0 http://localhost:8090/feed1.ffm

确保您的Feed名称以.ffm结尾,如果不是这样,请添加 -f ffm之前,手动指定输出格式(因为ffmpeg将无法自动计算出来),像这样-f ffm http:// localhost:8090 / blah.bleh

make sure that your feed name ends with ".ffm" and if it's not the case, then add "-f ffm" before your feed URL, to manually specify the output format (because ffmpeg won't be able to figure it out automatically any more), like this "-f ffm http://localhost:8090/blah.bleh".

这篇关于如何使用ffmpeg通过http协议流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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