本文介绍了FFMPEG推RTMP流不工作在Android和放大器; iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须做出一个半实时流。我用的Nginx-RTMP模块,然后通过使用ffmpeg的推送内容到它:

I have to make a semi-live-stream. I used Nginx-rtmp module and then pushed content to it via ffmpeg using:

ffmpeg -re -i content.mp4 -r 25 -f fvl "rtmp://rtmp.server.here"

://rtmp.server.here RTMP

The stream runs fine when I open it in VLC from "rtmp://rtmp.server.here"

流当我从VLC打开它运行良好

不过,我也有做iPhone和Android应用程序,玩这些流。 这就是问题所在,的流不会在Android和iPhone的工作。

But I also have to make iPhone and Android apps that play these streams. And that's the problem, the stream doesn't work on Android and iPhone.

如果我用我自己的nginx-RTMP服务器Wowza流云流Wowza云,而不是再为Android和放大器写入相同的应用程序; iPhone可以播放流就好了。

If I use Wowza streaming cloud and stream to Wowza cloud instead of my own nginx-rtmp server then the same app written for Android & iPhone can playback the stream just fine.

现在无论是nginx的,RTMP是不工作的权利,还是什么别的?我也试着crtmpserver,同样的事情发生了。

Now either nginx-rtmp is not working right, or what else? I've also tried crtmpserver and the same thing happens.

我想获得了这幅什么:我要开发一个系统,我们可以上游的电视频道(有权限的话)到服务器,然后做一个网站,Android应用程序及放大器; iPhone应用程序,让消费者可以观看直播频道。

What I want to acheive:I have to develop a system where we can upstream a TV-Channel (have rights for it) to a server and then make a website, android app & iPhone app so consumers can watch the live channel.

在上传的一部分,我有一个线索,可能是电视调谐卡,并打开播放软件将其传输到服务器。但现场播放新的给我。

The uploading part I have a clue of, probably a TV tuner card and Open Broadcast Software to stream it to server. But the Live playback is new to me.

更新:我也用ffprobe和这里的输出。 (见最后一行)

UPDATE: I also used ffprobe and here's the output. (See the last line)

munir@munir-HP-ProBook-450-G2:~$ ffprobe rtmp://rtmp.server.here
ffprobe version 2.6.2 Copyright (c) 2007-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[flv @ 0x267cc60] Stream discovered after head already parsed
    Last message repeated 1 times
Input #0, flv, from 'rtmp://stage.funworldpk.com/live':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 320
    displayHeight   : 240
    fps             : 20
    profile         : 
    level           : 
  Duration: 00:00:00.00, start: 288.763000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 20 fps, 20 tbr, 1k tbn, 40 tbc
    Stream #0:1: Data: none
    Stream #0:2: Audio: aac (LC), 22050 Hz, stereo, fltp
Unsupported codec with id 0 for input stream 1

更新2:我得到了我流通过Wowza流媒体服务器的许可副本工作。一切正常了。但很明显,这将不适合每一个人,这就是为什么我没有张贴作为一个答案的选项。

Update 2:I got my stream working by using Licensed copy of Wowza streaming server. Everything works now. But obviously this will not be an option for everyone that's why I am not posting it as an answer.

推荐答案

RTMP协议的使用是非常有限的,主要用于视频录制。我们没有理由用它来播放移动设备不支持RTMP本身,你不觉得这可能是一个好主意,劝告移动用户在设备上安装VLC或类似的应用程序?

RTMP protocol usage is very limited and primarily being used for video recording. There is no reason to use it for playback as mobile devices don't support RTMP natively, you don't think it can be a good idea to advice mobile users to install VLC or similar app on the device?

插件 已被纳入到Nginx的+ nginx的,RTMP模块,使一个COM prehensive记录介质服务器出的Nginx作为替代,以Wowza媒体服务器或实现HLS通过HTTP playaback。这个插件可以使用Nginx的开源版本。

Plugin nginx-rtmp-module has been incorporated to Nginx+ to make a comprehensive recording media server out of Nginx as a replacement to Wowza Media Server or implement HLS for playaback via HTTP. This plugin can be used with Nginx open source edition.

为使您的视频内容提供给移动设备,你只有两种选择,通过HTTP(S)他们每个人的工作,而不是RTMP:

To make your video content available to mobile devices you have only 2 options, each of them work via HTTP(s), not RTMP:

  1. HTTP实时流,看到的例子:

location / {
    hls;
    hls_fragment            5s;
    hls_buffers             10 10m;
    hls_mp4_buffer_size     1m;
    hls_mp4_max_buffer_size 5m;
    root /var/video/;
}

  • HTTP伪分流,看到的例子

  • HTTP pseudo streaming, see the example

    location /video/ {
        mp4;
        mp4_buffer_size       1m;
        mp4_max_buffer_size   5m;
        mp4_limit_rate        on;
        mp4_limit_rate_after  30s;
    }
    

    的另一面是安全性。如何保护的视频流网址是什么? pre-产生的时间过期的网址是很好的方法,你可以试试,看我的例子

    这篇关于FFMPEG推RTMP流不工作在Android和放大器; iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 09-22 05:51