RTMP:有这样的linux命令行工具吗?

发布于 2024-07-25 22:17:42 字数 283 浏览 5 评论 0原文

我到处寻找一个可以让我下载 rtmp 流的 Linux 实用程序。 不是 flv 视频而是 MP3 流。 我想要下载的流的位置就是这种格式。

rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3

有人知道这样的命令行工具吗? 或者甚至任何接近我要求的东西?

我不需要完整的软件应用程序,如果它可以通过 Shell 或其他方式在 Linux 上运行,那就太好了。

谢谢大家

I have looked everywhere to find a linux utility that will allow me to download rtmp streams. Not flv video but MP3 streams. The location of the streams I want to download are in this format.

rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3

Anyone know of such a command line tool? Or even anything close to what I am asking for?

I do not want full software applications and it would be great if it worked on Linux via Shell or something.

Thanks all

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

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

发布评论

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

评论(3

听你说爱我 2024-08-01 22:17:42

如果您有使用 RTMP 访问权限编译的 mplayervlc,则应执行以下操作之一。

mplayer -dumpstream rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3

这将生成一个 ./stream.dump

vlc -I dummy rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3 \
    --sout file/ts:output.mpg vlc://quit

这将生成一个 ./output.mpg。 您必须对其进行解复用才能仅提取音频流。

One of the following should do, if you have mplayer or vlc compiled with RTMP access.

mplayer -dumpstream rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3

This will generate a ./stream.dump.

vlc -I dummy rtmp://live.site.com/loc/45/std_fc74a6b7f79c70a5f60.mp3 \
    --sout file/ts:output.mpg vlc://quit

This will generate a ./output.mpg. You'll have to demux it to extract just the audio stream out.

み青杉依旧 2024-08-01 22:17:42

这个问题很旧,但这可以帮助有此疑问的其他用户。
要直接下载而不进行任何转换,有两种选择(两个程序的作者相同,行为相同):

  • RTMPDump. 示例:rtmpdump -r "rtmp://host.com/dir/file.flv" -o filename.flv
  • flvstreamer。 示例: flvstreamer -r "rtmp://od.flash.plus.es/ondemand/14314/plus/plustv/PO770632.flv" -o salida.flv

如果您想下载并转换同时播放视频,最好的方法是使用ffmpeg:

ffmpeg -i rtmp://server/live/streamName -acodec copy -vcodec copy dump.mp4

This question is old but this can help to another users with this doubt.
To download directly, without any conversion, there is two options (the author of both programs is the same and the behavior is the same):

  • RTMPDump. Example: rtmpdump -r "rtmp://host.com/dir/file.flv" -o filename.flv
  • flvstreamer. Example: flvstreamer -r "rtmp://od.flash.plus.es/ondemand/14314/plus/plustv/PO770632.flv" -o salida.flv

And if you want download and convert the video at same time, the best way is use ffmpeg:

ffmpeg -i rtmp://server/live/streamName -acodec copy -vcodec copy dump.mp4
忘东忘西忘不掉你 2024-08-01 22:17:42

我认为自之前的一些答案以来,情况已经发生了一些变化。 至少根据 rtmp 维基百科页面。 看来 rtmp 协议规范已开放供公众使用。 为此,您可以使用 2 个工具来完成原始发布者的要求:rtmpdumpffmpeg。 以下是我下载发送音频播客的 rtmp 流的方法。

步骤#1 - 下载流

我使用工具rtmpdump来完成此操作。 就像这样:

% rtmpdump -r rtmp://url/to/some/file.mp3 -o /path/to/file.flv
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
28358.553 kB / 3561.61 sec
Download complete

步骤 #2 - 将 flv 文件转换为 mp3

好的,现在您已经获得了流的本地副本,file.flv。 您可以使用 ffmpeg 进一步询问文件并仅提取音频部分。

% ffmpeg -i file.flv
....
[flv @ 0x25f6670]max_analyze_duration reached
[flv @ 0x25f6670]Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'file.flv':
  Duration: 00:59:21.61, start: 0.000000, bitrate: 64 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 1 channels, s16, 64 kb/s

从上面的输出中,我们可以看到 file.flv 包含单个流,只是音频,它是 mp3 格式,并且是单个通道。 要将其提取到正确的 mp3 文件,您可以再次使用 ffmpeg

% ffmpeg -i file.flv -vn -acodec copy file.mp3
....
[flv @ 0x22a6670]max_analyze_duration reached
[flv @ 0x22a6670]Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'file.flv':
 Duration: 00:59:21.61, start: 0.000000, bitrate: 64 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 1 channels, s16, 64 kb/s
Output #0, mp3, to 'file.mp3':
  Metadata:
    TSSE            : Lavf52.64.2
    Stream #0.0: Audio: libmp3lame, 44100 Hz, 1 channels, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=   27826kB time=3561.66 bitrate=  64.0kbits/s    
video:0kB audio:27826kB global headers:0kB muxing overhead 0.000116%

上述命令会将音频流复制到文件 file.mp3 。 您也可以将其提取到 wav 文件,如下所示:

ffmpeg -i file.flv -vn -acodec pcm_s16le -ar 44100 -ac 2 file.wav

页面对于确定如何将 flv 文件转换为其他文件很有用格式。

I think the landscape has changed a bit since the time of some of the previous answers. At least according to the rtmp wikipedia page. It would appear that the rtmp protocol specification is open for public use. To that end you can use 2 tools to accomplish what the original poster was asking, rtmpdump and ffmpeg. Here's what I did to download a rtmp stream that was sending an audio podcast.

step #1 - download the stream

I used the tool rtmpdump to accomplish this. Like so:

% rtmpdump -r rtmp://url/to/some/file.mp3 -o /path/to/file.flv
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting download at: 0.000 kB
28358.553 kB / 3561.61 sec
Download complete

step #2 - convert the flv file to mp3

OK, so now you've got a local copy of the stream, file.flv. You can use ffmpeg to interrogate the file further and also to extract just the audio portion.

% ffmpeg -i file.flv
....
[flv @ 0x25f6670]max_analyze_duration reached
[flv @ 0x25f6670]Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'file.flv':
  Duration: 00:59:21.61, start: 0.000000, bitrate: 64 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 1 channels, s16, 64 kb/s

From the above output we can see that the file.flv contains a single stream, just audio, and it's in mp3 format, and it's a single channel. To extract it to a proper mp3 file you can use ffmpeg again:

% ffmpeg -i file.flv -vn -acodec copy file.mp3
....
[flv @ 0x22a6670]max_analyze_duration reached
[flv @ 0x22a6670]Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'file.flv':
 Duration: 00:59:21.61, start: 0.000000, bitrate: 64 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 1 channels, s16, 64 kb/s
Output #0, mp3, to 'file.mp3':
  Metadata:
    TSSE            : Lavf52.64.2
    Stream #0.0: Audio: libmp3lame, 44100 Hz, 1 channels, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
size=   27826kB time=3561.66 bitrate=  64.0kbits/s    
video:0kB audio:27826kB global headers:0kB muxing overhead 0.000116%

The above command will copy the audio stream into a file, file.mp3. You could also have extracted it to a wav file like so:

ffmpeg -i file.flv -vn -acodec pcm_s16le -ar 44100 -ac 2 file.wav

This page was useful in determining how to convert the flv file to other formats.

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