从 bash cgi 脚本流式传输音频

从 bash cgi 脚本流式传输音频

我有一个 bash 脚本,我想将其称为 cgi 来传输音频。

该脚本如下所示:

#!/bin/bash

echo "Content-type: audio/wav"
echo ""

rtl_fm -f 89.9M -M fm -s 170k -A std  -l 0 -E deemp -r 44.1k

exit 0

当我在控制台上启动它时,它会无休止地转储到标准输出(我认为是音频流)

当我在vlc或网络浏览器中通过http打开它时,它立即结束。

关于这里出了什么问题的任何提示吗?

日志在这里:

[yves@localhost ~]$ cvlc -vv http://server/cgi-bin/rtl                                                                                                                                  
VLC media player 3.0.0-git Vetinari (revision 2.2.0-git-10582-g9eb9eb0bd2)
[00005614d59db1a8] core libvlc debug: VLC media player - 3.0.0-git Vetinari
[00005614d59db1a8] core libvlc debug: Copyright © 1996-2017 the VideoLAN team
[00005614d59db1a8] core libvlc debug: revision 2.2.0-git-10582-g9eb9eb0bd2
[00005614d59db1a8] core libvlc debug: configured with ./configure  '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--disable-optimizations' '--disable-silent-rules' '--with-pic' '--disable-rpath' '--with-binary-version=3.0.0' '--with-kde-solid=/usr/share/kde4/apps/solid/actions' '--enable-lua' '--enable-live555' '--enable-opencv' '--enable-sftp' '--enable-omxil' '--enable-omxil-vout' '--enable-faad' '--enable-twolame' '--enable-realrtsp' '--enable-flac' '--enable-tremor' '--enable-speex' '--enable-theora' '--enable-libass' '--enable-shout' '--enable-xcb' '--enable-xvideo' '--enable-svg' '--enable-aa' '--enable-caca' '--enable-jack' '--enable-pulse' '--enable-ncurses' '--enable-lirc' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' 'CXXFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
[00005614d59db1a8] core libvlc debug: searching plug-in modules
[00005614d59db1a8] core libvlc debug: loading plugins cache file /usr/lib64/vlc/plugins/plugins.dat
[00005614d59db1a8] core libvlc debug: recursively browsing `/usr/lib64/vlc/plugins'
[00005614d59db1a8] core libvlc debug: plug-ins loaded: 494 modules
[00005614d59db1a8] core libvlc debug: opening config file (/home/yves/.config/vlc/vlcrc)
[00005614d59db518] core logger debug: looking for logger module matching "any": 4 candidates
[00005614d59db518] core logger debug: using logger module "console"
[00005614d59db1a8] core libvlc debug: translation test: code is "C"
[00005614d59dd378] core keystore debug: looking for keystore module matching "memory": 4 candidates
[00005614d59dd378] core keystore debug: using keystore module "memory"
[00005614d59db1a8] core libvlc debug: No media player running. Continuing normally.
[00005614d59db1a8] core libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX FPU 
[00005614d5a732c8] core input debug: Creating an input for 'Media Library'
[00005614d5a732c8] core input debug: Input is a meta file: disabling unneeded options
[00005614d5a732c8] core input debug: using timeshift granularity of 50 MiB
[00005614d5a732c8] core input debug: using default timeshift path
[00005614d5a732c8] core input debug: `file/xspf-open:///home/yves/.local/share/vlc/ml.xspf' gives access `file' demux `xspf-open' path `/home/yves/.local/share/vlc/ml.xspf'
[00005614d5a78aa8] core input source debug: creating demux: access='file' demux='xspf-open' location='/home/yves/.local/share/vlc/ml.xspf' file='/home/yves/.local/share/vlc/ml.xspf'
[00005614d5a78c28] core demux debug: looking for access_demux module matching "file": 21 candidates
[00005614d5a78c28] core demux debug: no access_demux modules matched
[00005614d5a7e2d8] core stream debug: creating access: file:///home/yves/.local/share/vlc/ml.xspf
[00005614d5a7e2d8] core stream debug:  (path: /home/yves/.local/share/vlc/ml.xspf)
[00005614d5a7e2d8] core stream debug: looking for access module matching "file": 30 candidates
[00005614d5a7e2d8] core stream debug: using access module "filesystem"
[00005614d5a7f288] core stream debug: looking for stream_filter module matching "prefetch,cache_read": 13 candidates
[00005614d5a7f288] cache_read stream debug: Using stream method for AStream*
[00005614d5a7f288] cache_read stream debug: starting pre-buffering
[00005614d5a7f288] cache_read stream debug: received first data after 0 ms
[00005614d5a7f288] cache_read stream debug: pre-buffering done 296 bytes in 0s - 6882 KiB/s
[00005614d5a7f288] core stream debug: using stream_filter module "cache_read"
[00005614d5a803b8] core stream debug: looking for stream_filter module matching "any": 13 candidates
[00005614d5a803b8] core stream debug: no stream_filter modules matched
[00005614d5a81578] core stream_extractor debug: looking for stream_extractor module matching "any": 0 candidates
[00005614d5a81578] core stream_extractor debug: no stream_extractor modules
[00005614d5a78aa8] core input source debug: attach of directory extractor failed
[00005614d5a803b8] core stream debug: looking for stream_filter module matching "record": 13 candidates
[00005614d5a803b8] core stream debug: using stream_filter module "record"
[00005614d5a78aa8] core input source debug: creating demux: access='file' demux='xspf-open' location='/home/yves/.local/share/vlc/ml.xspf' file='/home/yves/.local/share/vlc/ml.xspf'
[00005614d5a86b48] core demux debug: looking for demux module matching "xspf-open": 69 candidates
[00005614d5a86b48] xspf demux debug: using XSPF playlist reader
[00005614d5a86b48] core demux debug: using demux module "playlist"
[00005614d5a86e08] core demux meta debug: looking for meta reader module matching "any": 2 candidates
[00005614d5a86e08] lua demux meta debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/meta/reader
[00005614d5a86e08] lua demux meta debug: Trying Lua scripts in /usr/lib64/vlc/lua/meta/reader
[00005614d5a86e08] lua demux meta debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/reader/filename.luac
[00005614d5a86e08] lua demux meta debug: Trying Lua scripts in /usr/share/vlc/lua/meta/reader
[00005614d5a86e08] core demux meta debug: no meta reader modules matched
[00005614d5a732c8] core input debug: `file/xspf-open:///home/yves/.local/share/vlc/ml.xspf' successfully opened
[00005614d5aa2558] core xml reader debug: looking for xml reader module matching "any": 1 candidates
[00005614d5aa2558] core xml reader debug: using xml reader module "xml"
[00005614d5a86b48] xspf demux debug: parsed 0 tracks successfully
[00005614d5a732c8] core input debug: EOF reached
[00005614d5a86b48] core demux debug: removing module "playlist"
[00005614d5a803b8] core stream debug: removing module "record"
[00005614d5a7f288] core stream debug: removing module "cache_read"
[00005614d5a7e2d8] core stream debug: removing module "filesystem"
[00005614d5a70048] core playlist debug: creating audio output
[00005614d5a8d718] core audio output debug: looking for audio output module matching "any": 6 candidates
[00005614d5a8d718] pulse audio output debug: using library version 10.0.0
[00005614d5a8d718] pulse audio output debug:  (compiled with version 10.0.0, protocol 32)
[00005614d5a8d718] pulse audio output debug: connected locally to /run/user/1000/pulse/native as client #44
[00005614d5a8d718] pulse audio output debug: using protocol 32, server protocol 32
[00005614d5a8d718] pulse audio output debug: adding sink 0: alsa_output.pci-0000_00_1b.0.analog-stereo (Built-in Audio Analog Stereo)
[00005614d5a8d718] core audio output debug: using audio output module "pulse"
[00005614d5a70048] core playlist debug: keeping audio output
[00005614d5aaaf08] core interface debug: looking for interface module matching "hotkeys,none": 18 candidates
[00005614d5aaaf08] core interface debug: using interface module "hotkeys"
[00005614d5aabb28] core interface debug: looking for interface module matching "globalhotkeys,none": 18 candidates
[00005614d5aabb28] core interface debug: using interface module "xcb_hotkeys"
[00005614d5aacc88] core interface debug: looking for interface module matching "dbus,none": 18 candidates
[00005614d5aacc88] dbus interface debug: listening on dbus as: org.mpris.MediaPlayer2.vlc
[00005614d5aacc88] core interface debug: using interface module "dbus"
[00005614d5ab00e8] core interface debug: looking for interface module matching "dummy": 18 candidates
[00005614d5ab00e8] dummy interface: using the dummy interface module...
[00005614d5ab00e8] core interface debug: using interface module "dummy"
[00005614d5a70048] core playlist debug: processing request item: null, node: Playlist, skip: 0
[00005614d5a70048] core playlist debug: rebuilding array of current - root Playlist
[00005614d5a70048] core playlist debug: rebuild done - 1 items, index -1
[00005614d5a70048] core playlist debug: starting playback of new item
[00005614d5a70048] core playlist debug: resyncing on rtl
[00005614d5a70048] core playlist debug: rtl is at 0
[00005614d5a70048] core playlist debug: creating new input thread
[00007f83e00009d8] core input debug: Creating an input for 'rtl'
[00005614d5a70048] core playlist debug: requesting art for new input thread
[00007f83e00009d8] core input debug: using timeshift granularity of 50 MiB
[00007f83e00009d8] core input debug: using default timeshift path
[00007f83e00009d8] core input debug: `http://server/cgi-bin/rtl' gives access `http' demux `any' path `server/cgi-bin/rtl'
[00007f83d8000978] core art finder debug: looking for meta fetcher module matching "any": 1 candidates
[00007f83e4000d48] core input source debug: creating demux: access='http' demux='any' location='server/cgi-bin/rtl' file='(null)'
[00007f83e4000ed8] core demux debug: looking for access_demux module matching "http": 21 candidates
[00007f83e4000ed8] core demux debug: no access_demux modules matched
[00007f83e4001208] core stream debug: creating access: http://server/cgi-bin/rtl
[00007f83e4001208] core stream debug: looking for access module matching "http": 30 candidates
[00005614d5aacc88] dbus interface debug: Getting All properties
[00005614d5aacc88] dbus interface debug: Getting All properties
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/meta/fetcher
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/lib64/vlc/lua/meta/fetcher
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/fetcher/tvrage.luac
[00007f83e4001208] transport stream debug: resolving server ...
[00007f83d8000978] lua art finder debug: skipping script (unmatched scope) /usr/lib64/vlc/lua/meta/fetcher/tvrage.luac
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/share/vlc/lua/meta/fetcher
[00007f83d8000978] core art finder debug: no meta fetcher modules matched
[00005614d59db1a8] core libvlc debug: searching art for rtl
[00007f83d8000978] core art finder debug: looking for art finder module matching "any": 2 candidates
[00007f83e4001208] transport stream debug: connecting to server port 80 ...
[00007f83e4001208] h1conn stream debug: outgoing request:
GET /cgi-bin/rtl HTTP/1.1
Host: server
Accept: */*
Accept-Language: en_US
User-Agent: VLC/3.0.0-git LibVLC/3.0.0-git
Range: bytes=0-


[00007f83d8000978] lua art finder debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/meta/art
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/lib64/vlc/lua/meta/art
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/00_musicbrainz.luac
[00007f83d8000978] lua art finder debug: skipping script (unmatched scope) /usr/lib64/vlc/lua/meta/art/00_musicbrainz.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/01_googleimage.luac
[00007f83d8000978] lua art finder debug: skipping script (unmatched scope) /usr/lib64/vlc/lua/meta/art/01_googleimage.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/02_frenchtv.luac
[00007f83d8000978] lua art finder debug: skipping script (unmatched scope) /usr/lib64/vlc/lua/meta/art/02_frenchtv.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/03_lastfm.luac
[00007f83d8000978] lua art finder debug: skipping script (unmatched scope) /usr/lib64/vlc/lua/meta/art/03_lastfm.luac
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/share/vlc/lua/meta/art
[00007f83d8000978] core art finder debug: no art finder modules matched
[00007f83d8000978] core art finder debug: looking for meta fetcher module matching "any": 1 candidates
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/meta/fetcher
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/lib64/vlc/lua/meta/fetcher
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/fetcher/tvrage.luac
[00007f83d8000978] core art finder debug: using meta fetcher module "lua"
[00007f83d8000978] core art finder debug: removing module "lua"
[00005614d59db1a8] core libvlc debug: searching art for rtl
[00007f83d8000978] core art finder debug: looking for art finder module matching "any": 2 candidates
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/meta/art
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/lib64/vlc/lua/meta/art
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/00_musicbrainz.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/01_googleimage.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/02_frenchtv.luac
[00007f83d8000978] lua art finder debug: Trying Lua playlist script /usr/lib64/vlc/lua/meta/art/03_lastfm.luac
[00007f83d8000978] lua art finder debug: Trying Lua scripts in /usr/share/vlc/lua/meta/art
[00007f83d8000978] core art finder debug: no art finder modules matched
[00005614d59db1a8] core libvlc debug: art not found for rtl
[00007f83e4001208] h1conn stream debug: incoming response:
HTTP/1.1 200 OK
Date: Mon, 20 Feb 2017 08:27:36 GMT
Server: Apache/2.4.25 (Fedora) SVN/1.9.5
Content-Length: 0
Content-Type: audio/wav


[00007f83e4001208] core stream debug: using access module "access"
[00007f83e4002148] core stream debug: looking for stream_filter module matching "prefetch,cache_block": 13 candidates
[00007f83e4002148] prefetch stream debug: using 16777216 bytes buffer, 16384 bytes read
[00007f83e4002148] core stream debug: using stream_filter module "prefetch"
[00007f83e40022d8] core stream debug: looking for stream_filter module matching "any": 13 candidates
[00007f83e4002148] prefetch stream debug: end of stream
[00007f83e40022d8] core stream debug: no stream_filter modules matched
[00007f83e4001e68] core stream_extractor debug: looking for stream_extractor module matching "any": 0 candidates
[00007f83e4001e68] core stream_extractor debug: no stream_extractor modules
[00007f83e4000d48] core input source debug: attach of directory extractor failed
[00007f83e40022d8] core stream debug: looking for stream_filter module matching "record": 13 candidates
[00007f83e40022d8] core stream debug: using stream_filter module "record"
[00007f83e4000d48] core input source debug: creating demux: access='http' demux='any' location='server/cgi-bin/rtl' file='(null)'
[00007f83e4001e68] core demux debug: looking for demux module matching "any": 69 candidates
[00007f83e4001e68] es demux error: cannot peek
[00007f83e4001e68] es demux error: cannot peek
[00007f83e4001e68] es demux error: cannot peek
[00007f83e4001e68] es demux error: cannot peek
[00007f83e4001e68] es demux error: cannot peek
[00007f83e4001e68] pls demux debug: not enough data
[00007f83e4001e68] mod demux debug: MOD validation failed (ext=)
[00007f83e4001e68] ps demux error: cannot peek
[00007f83e4001e68] mpgv demux error: cannot peek
[00007f83e4001e68] mjpeg demux warning: no more data
[00007f83e4001e68] mjpeg demux error: cannot peek
[00007f83e4001e68] lua demux debug: Trying Lua scripts in /home/yves/.local/share/vlc/lua/playlist
[00007f83e4001e68] lua demux debug: Trying Lua scripts in /usr/lib64/vlc/lua/playlist
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/anevia_streams.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/anevia_xml.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/appletrailers.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/bbc_co_uk.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/cue.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/dailymotion.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/jamendo.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/koreus.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/liveleak.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/newgrounds.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/rockbox_fm_presets.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/soundcloud.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/vimeo.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/vocaroo.luac
[00007f83e4001e68] lua demux debug: Trying Lua playlist script /usr/lib64/vlc/lua/playlist/youtube.luac
[00007f83e4001e68] lua demux debug: Trying Lua scripts in /usr/share/vlc/lua/playlist
[00007f83e4001e68] avformat demux warning: cannot peek
[00007f83e4001e68] vobsub demux debug: could not read vobsub IDX file
[00007f83e4001e68] ps demux error: cannot peek
[00007f83e4001e68] core demux debug: no demux modules matched
[00007f83e40022d8] core stream debug: removing module "record"
[00007f83e4002148] core stream debug: removing module "prefetch"
[00007f83e4001208] core stream debug: removing module "access"
[00007f83e00009d8] core input error: Your input can't be opened
[00007f83e00009d8] core input error: VLC is unable to open the MRL 'http://server/cgi-bin/rtl'. Check the log for details.
[00005614d5a70048] core playlist debug: dead input
[00005614d5a70048] core playlist debug: changing item without a request (current 0/1)
[00005614d5a70048] core playlist debug: nothing to play
[00005614d5aacc88] dbus interface debug: Getting property Position

相关内容