使用 FFMPEG 将 RTMP 流转换为 RTSP 和 HTTP

使用 FFMPEG 将 RTMP 流转换为 RTSP 和 HTTP

我在 ubuntu 12.04 LTS 上安装了 red5 服务器,用于直播和点播视频流。我只想将我的 RTMP 协议流转换为 RTSP 和 HTTP 协议流。我研究并搜索了 FFMPEG,但我不明白如何正确地做到这一点。如果有人能提供指导,我将不胜感激。

示例网址:

rtmp://xxxxx.com/live

到:

rtsp://xxxxx.com/live and http://xxxxx.com/live

我的 ffmpeg 命令:

avconv -v verbose -i rtmp://xxxxx.com:1935/live/live1 -c:v libx264 -c:a aac -ac 1 -strict -2 -crf 18 -profile:v baseline -maxrate 400k -bufsize 1835k -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_list_size 6 -hls_wrap 10 -start_number 1 http://xxxx.com/live.m3u8

运行此命令后返回以下错误:

ffmpeg version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:08:00 with gcc 4.6.3
  configuration: --extra-version='4:0.8.9-0ubuntu0.12.04.1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avutil      configuration: --extra-version='4:0.8.9ubuntu0.12.04.1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avcodec     configuration: --extra-version='4:0.8.9ubuntu0.12.04.1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil    51. 22. 1 / 51. 22. 1
  libavcodec   53. 35. 0 / 53. 35. 0
  libavformat  53. 21. 1 / 53. 21. 1
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 15. 0 /  2. 15. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  52.  0. 0 / 52.  0. 0
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[INFO] [NioProcessor-4] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Action connect
[INFO] [NioProcessor-4] org.red5.server.net.rtmp.RTMPHandler - Connecting to: [WebScope@d174031 Depth = 1, Path = '/default', Name = 'jiljillive']
[INFO] [NioProcessor-4] org.red5.server.adapter.ApplicationAdapter - W3C x-category:session x-event:connect c-ip:54.254.189.206 c-client-id:32
[INFO] [NioProcessor-4] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Action createStream
[INFO] [NioProcessor-4] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Action play
[INFO] [pool-4-thread-4] org.red5.server.adapter.ApplicationAdapter - W3C x-category:stream x-event:play c-ip:54.254.189.206 x-sname:e28334d6-eb42-4de1-b774-81065043f86d
[INFO] [NioProcessor-4] org.red5.server.stream.ClientBroadcastStream - Consumer connect
[INFO] [pool-4-thread-1] org.red5.server.adapter.ApplicationAdapter - W3C x-category:stream x-event:play c-ip:54.254.189.206 x-sname:e28334d6-eb42-4de1-b774-81065043f86d x-name:live1
[flv @ 0x15669c0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://xxxxx.com:1935/live/live1':
  Metadata:
    videokeyframe_frequency: 5
    avclevel        : 31
    videodevice     : Broadcast SC Video Filter
    keywords        : 
    audiochannels   : 2
    presetname      : Custom
    copyright       : 
    audioinputvolume: 100
    creationdate    : Mon Feb 10 22:44:16 2014

    author          : 
    audiodevice     : Microphone (SplitCam Virtual Au
    avcprofile      : 66
    title           : 
    description     : 
    rating          : 
  Duration: N/A, start: 0.000000, bitrate: 438 kb/s
    Stream #0.0: Video: h264 (Baseline), yuv420p, 320x240 [PAR 1:1 DAR 4:3], 307 kb/s, 25 tbr, 1k tbn, 50 tbc
    Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 131 kb/s

Unrecognized option 'hls_time'
Failed to set value '10' for option 'hls_time'

答案1

您曾经读过输出结果吗?

Unrecognized option 'hls_time'
Failed to set value '10' for option 'hls_time'

你应该删除它并重试。我只是为了以防其他人需要帮助才回答的。

相关内容