0

我正在尝试使用 StereoTool 在 Liquidsoap 中处理音频,但以下代码似乎不起作用。与 Icecast 的连接永远无法正常工作。只有当我删除两条管道音频到 StereoTool 时才会这样做。

#!/usr/bin/liquidsoap

# Setup telnet
set("server.telnet",true)
set("server.telnet.port",1234)

# Log dir
set("log.file.path","/home/wruser/radio/logs/basic-radio.log")
set("log.stdout",true)

def my_request_function() = 
    # Get the first line of my external process
    result = list.hd(default="", get_process_lines("python3 /home/wruser/radio/python/get_track.py"))
    print(result)
    # Create and return a request using this result
    [request.create(result)]
end

# Create the source
s = request.dynamic.list(my_request_function)

processed = pipe(process='/home/wruser/radio/stereotool/stereo_tool_cmd_64 -s /home/wruser/radio/stereotool/radio.sts', s)

# Stream it out
output.icecast(%mp3(bitrate=192),
        fallible=true,
        host = "localhost",
        port = 8000,
        password = "************",
        mount = "radio",
        processed)

当我运行 Liquidsoap 时,日志输出如下:

2020/07/28 15:18:48 >>> LOG START
2020/07/28 15:18:47 [main:3] Liquidsoap 1.4.2
2020/07/28 15:18:47 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.3 sedlex=2.1 menhirLib=20200525 dtools=0.4.2 duppy=0.8.0 cry=0.6.1 mm=0.5.0 ogg=0.5.2 vorbis=0.7.1 opus=0.1.3 mad=0.4.5 flac=0.1.5 flac.ogg=0.1.5 dynlink=[distributed with Ocaml] lame=0.3.3 fdkaac=0.3.1 samplerate=0.1.4 taglib=0.3.3 ssl=0.5.9 camomile=1.0.2 faad=0.4.0
2020/07/28 15:18:48 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2020/07/28 15:18:48 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2020/07/28 15:18:48 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2020/07/28 15:18:48 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2020/07/28 15:18:48 [sandbox:3] Sandboxing disabled
2020/07/28 15:18:48 [video.converter:3] Couldn't find preferred video converter: gavl.
2020/07/28 15:18:48 [audio.converter:3] Using samplerate converter: libsamplerate.
2020/07/28 15:18:48 [clock.wallclock_main:3] Streaming loop starts, synchronized with wallclock.
2020/07/28 15:18:51 [decoder:3] Method "WAV" accepted "/home/wruser/Music/10 Holy, Holy, Holy Lord God Almighty.wav".
2020/07/28 15:18:51 [request.dynamic.list_7658:3] Prepared "/home/wruser/Music/10 Holy, Holy, Holy Lord God Almighty.wav" (RID 0).
2020/07/28 15:18:52 [decoder:3] Method "WAV" accepted "/home/wruser/Music/God So Loved Me That He Gave.wav".
4

1 回答 1

0

发现问题。我不得不改变这一行:

processed = pipe(process='/home/wruser/radio/stereotool/stereo_tool_cmd_64 -s /home/wruser/radio/stereotool/radio.sts', s)

到以下:

processed = pipe(process='/home/wruser/radio/stereotool/stereo_tool_cmd_64 - - -s /home/wruser/radio/stereotool/radio.sts', s)
于 2020-08-03T15:48:11.113 回答