savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 130 forks source link

Unsupported format: %ffmpeg(%audio(codec="libmp3lame") #1923

Closed voluburator closed 3 years ago

voluburator commented 3 years ago

Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-156-generic x86_64) opam 4.08.0 liquidsoap v 2.0.0 rc-1

Liquidsoap whith ffmpeg but i cannot start broadcasting - dependencies are required, although installed on the system

Encode it in mp3:

source = ffmpeg.encode.audio( %ffmpeg(%audio(codec="libmp3lame",samplerate=44100,channels=2)) source)

LOG:

Sep 14 15:57:52 live.radiospinner.com liquidsoap[9979]: Error 12: Unsupported format: %ffmpeg(%audio(codec="libmp3lame",samplerate=44100,channels=2)). Sep 14 15:57:52 live.radiospinner.com liquidsoap[9979]: You must be missing an optional dependency. Sep 14 15:57:52 live.radiospinner.com systemd[1]: pianorelaxyoutube.service: Control process exited, code=exited status=1 Sep 14 15:57:52 live.radiospinner.com systemd[1]: pianorelaxyoutube.service: Failed with result 'exit-code'.

toots commented 3 years ago

Hi,

This is a know issue, I'm gonna send an update on opam right away. Meanwhile, you can do the following:

git clone git@github.com:savonet/ocaml-ffmpeg.git
cd ocaml-ffmpeg
opam install -y .

git clone git@github.com:savonet/liquidsoap.git
cd liquidsoap
git checkout v2.0.0
opam install -y .

Sorry about that.

voluburator commented 3 years ago

It seems with codec = "libfdk_aac" similar problems. Please check. When will it be possible to get the update from opam?

toots commented 3 years ago

Have you tried to pin to the latest version as suggested above?

voluburator commented 3 years ago

Yes, but new problem. I'm trying to start a YouTube stream but nothing happens

Log: 2021/09/14 19:59:29 >>> LOG START 2021/09/14 19:59:29 [main:3] Liquidsoap 2.0.0 2021/09/14 19:59:29 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.4 menhirLib=20210419 dtools=0.4.4 duppy=0.9.2 cry=0.6.5 mm=0.7.1 mad=0.5.0 dynlink=[distributed with Ocaml] lame=0.3.4 fdkaac=0.3.2 ffmpeg-avutil=e50c556 ffmpeg-avcodec=e50c556 ffmpeg-avdevice=e50c556 ffmpeg-av=e50c556 ffmpeg-avfilter=e50c556 ffmpeg-swresample=e50c556 ffmpeg-swscale=e50c556 samplerate=0.1.6 taglib=0.3.6 camomile=1.0.2 2021/09/14 19:59:29 [clock:3] Using builtin (low-precision) implementation for latency control 2021/09/14 19:59:29 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use settings.path.to.key.set(value) 2021/09/14 19:59:29 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use settings.path.to.key.set(value) 2021/09/14 19:59:29 [lang:2] WARNING: "set" is deprecated and will be removed in future version. Please use settings.path.to.key.set(value) 2021/09/14 19:59:29 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main. 2021/09/14 19:59:29 [frame:3] Video frame size set to: 1280x720 2021/09/14 19:59:29 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples. 2021/09/14 19:59:29 [frame:3] Targeting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks. 2021/09/14 19:59:29 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks. 2021/09/14 19:59:29 [sandbox:3] Sandboxing disabled 2021/09/14 19:59:29 [video.converter:3] Using preferred video converter: ffmpeg. 2021/09/14 19:59:29 [audio.converter:3] Using samplerate converter: ffmpeg. 2021/09/14 19:59:30 [clock.main:3] Streaming loop starts in auto-sync mode 2021/09/14 19:59:30 [clock.main:3] Delegating synchronisation to CPU clock 2021/09/14 19:59:30 [decoder:3] Unable to decode "/var/relaxmixer/pianorelaxyoutube/media/air/6.mp3"! 2021/09/14 19:59:30 [decoder:3] Available decoders cannot decode "/var/relaxmixer/pianorelaxyoutube/media/air/6.mp3" as {audio=none,video=yuva420p,midi=none} 2021/09/14 19:59:30 [mksafe:3] Switch to safe_blank. 2021/09/14 19:59:30 [playlist_0:3] Prepared "/var/relaxmixer/pianorelaxyoutube/media/air/1.mp3" (RID 1). 2021/09/14 19:59:30 [mksafe:3] Switch to playlist_0 with transition. 2021/09/14 19:59:30 [stderr:3] [mp3float @ 0x7fdc4c05e3c0] Could not update timestamps for skipped samples. 2021/09/14 19:59:30 [mksafe:3] Switch to safe_blank.

journalctl: Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: Warning 4: Unused variable timeout Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: File /home/liquidsoap/.opam/4.08.0/lib/liquidsoap/share/liquidsoap/2.0.0/libs/http.liq, line 255, char 0: Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: Warning 4: Unused variable headers Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: File /home/liquidsoap/.opam/4.08.0/lib/liquidsoap/share/liquidsoap/2.0.0/libs/http.liq, line 255, char 0: Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: Warning 4: Unused variable http_version Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: File /home/liquidsoap/.opam/4.08.0/lib/liquidsoap/share/liquidsoap/2.0.0/libs/http.liq, line 255, char 0: Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: Warning 4: Unused variable redirect Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: File /home/liquidsoap/.opam/4.08.0/lib/liquidsoap/share/liquidsoap/2.0.0/libs/http.liq, line 255, char 0: Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: Warning 4: Unused variable timeout Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: [libx264 @ 0x55f5da74f280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX Sep 14 19:53:47 live.radiospinner.com liquidsoap[24510]: [libx264 @ 0x55f5da74f280] profile High, level 3.1, 4:2:0, 8-bit Sep 14 19:53:47 live.radiospinner.com systemd[1]: pianorelaxyoutube.service: Supervising process 24547 which is not our child. We'll most likely not notice when it exits. Sep 14 19:53:47 live.radiospinner.com systemd[1]: Started pianorelaxyoutube.liq Liquidsoap daemon. -- Subject: Unit pianorelaxyoutube.service has finished start-up -- Defined-By: systemd -- Support: http://www.ubuntu.com/support

-- Unit pianorelaxyoutube.service has finished starting up.

MY LIQ FILE:

set("init.daemon.pidfile.path", "/run/pianorelaxyoutube.pid")

set("log.file.path","/var/log/liquidsoap/pianorelaxyoutube.log") set("log.level", 3)

audio = playlist(mode="random", "/var/relaxmixer/pianorelaxyoutube/media/air")

audio = mksafe(audio)

audio = ffmpeg.encode.audio( %ffmpeg(%audio(codec="libmp3lame")), audio)

video = playlist(mode="random", "/var/relaxmixer/pianorelaxyoutube/media") video = mksafe(video)

video = ffmpeg.encode.video( %ffmpeg(%video(codec="libx264")), video)

stream = mux_video(video=video, audio)

enc = %ffmpeg( format="flv", %audio.copy, %video.copy)

key = "-------------" url = "rtmp://a.rtmp.youtube.com/live2/#{key}" output.url(url=url, enc, stream)