我使用以下命令尝试从带有 ffmpeg 的文件进行流式传输:
ffmpeg -re -i GunGrave\ -\ 03\ -\ Rain.webm -c copy -f asf rtmp://127.0.0.1:8090/test.asf
Run Code Online (Sandbox Code Playgroud)
这产生了以下输出:
ffmpeg version N-50515-g28adecf Copyright (c) 2000-2013 the FFmpeg developers built on Mar 5 2013 22:35:30 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
libavutil 52. 17.103 / 52. 17.103
libavcodec 54. 92.100 / 54. 92.100
libavformat 54. 63.103 / 54. 63.103
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 42.103 / 3. 42.103
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, matroska,webm, from 'GunGrave - 03 - Rain.webm':
Metadata:
title : [AHQ] GunGrave - 19 - Superior
Duration: 00:24:20.44, start: 0.000000, bitrate: 259 kb/s
Stream #0:0: Video: vp8, yuv420p, 768x432, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
Run Code Online (Sandbox Code Playgroud)
这是我的 ffserver.config 文件:
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 200K
ACL allow 127.0.0.1
</Feed>
<Stream test.ts>
Feed feed1.ffm
Format mpegts
AudioCodec libmp3lame
AudioBitRate 128
AudioChannels 2
AudioSampleRate 44100
AVOptionAudio flags +global_header
VideoBitRate 800
VideoFrameRate 25
VideoSize 640x480
VideoCodec libx264
AVOptionVideo flags +global_header
</Stream>
<Stream test.asf>
Feed feed1.ffm
Format asf
AudioCodec mp3
AudioBitRate 128
AudioChannels 2
AudioSampleRate 44100
AVOptionAudio flags +global_header
VideoBitRate 800
VideoFrameRate 25
VideoSize 640x480
VideoCodec libx264
AVOptionVideo flags +global_header
</Stream>
<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Stream>
# Redirect index.html to the appropriate site
<Redirect index.html>
URL http://www.ffmpeg.org/
</Redirect>
Run Code Online (Sandbox Code Playgroud)
当我尝试在 Windows 媒体播放器中播放流时,由于文件类型不受支持而失败。当我尝试在 kmplayer 中播放流时,它只是挂起程序。它拒绝在 firefox 或 chrome 中的标签中播放。我主要需要它在 HTML5 中工作,所以这对我来说是主要问题。我使用 ts 而不是 asf 得到了类似的结果。我愿意使用任何适用于此的文件类型/编解码器。
您可能从某处复制了 FFserver 配置文件。您不能将任何类型的视频放入 ASF 流中,并且它可能不适用于 H.264 视频。另外,您还告诉 FFmpeg 复制视频和音频编解码器,并使用 FFserver 输出强制使用 ASF 格式,而不是仅仅让 FFserver 处理所有事情。
\n\n如果您想要 HTML5 流媒体,您可以切换到 WebM 视频。另外,您不能使用 RTMP:您需要通过 HTTP 进行流式传输。这篇博文应该可以帮助您入门:使用 FFmpeg 流式传输实时 WebM 视频。
\n\n这是来自博客\xe2\x80\x94的示例配置文件,我刚刚替换vorbis为libvorbis,因为这样可以产生更好的质量:
<Stream test.webm> # Output stream URL definition\n Feed feed1.ffm # Feed from which to receive video\n Format webm\n\n # Audio settings\n AudioCodec libvorbis\n AudioBitRate 64 # Audio bitrate\n\n # Video settings\n VideoCodec libvpx\n VideoSize 720x576 # Video resolution\n VideoFrameRate 25 # Video FPS\n AVOptionVideo flags +global_header # Parameters passed to encoder \n # (same as ffmpeg command-line parameters)\n AVOptionVideo cpu-used 0\n AVOptionVideo qmin 10\n AVOptionVideo qmax 42\n AVOptionVideo quality good\n AVOptionAudio flags +global_header\n PreRoll 15\n StartSendOnKey\n VideoBitRate 400 # Video bitrate\n</Stream>\nRun Code Online (Sandbox Code Playgroud)\n\n要流式传输视频,请使用:
\n\nffmpeg -i GunGrave.webm http://127.0.0.1:8090/test.webm\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4072 次 |
| 最近记录: |