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 128 forks source link

Error "couldn't open font" in `video.add_text` after a while #2229

Closed kessenza closed 2 years ago

kessenza commented 2 years ago

I have a simple code like this

def pad(i)
   if i<10 then
    "0#{i}"
   else
    "#{i}"
   end
end

def get_count()
   t= time.local()
  sec = 59  - t.sec
   min = 4 - (t.min mod 5)
   "#{pad(min)}:#{pad(sec)}"
end

s = playlist(reload_mode="watch",loop=true,mode="normal","/test.pls")
s = video.add_text.sdl(speed=30,
      get_count,font="/home/ubuntu/bankgothic.ttf",cycle=true,color=0x000000,size=40,y=682,x=1280, s)

and It runs for some minutes and then suddenly it ends with the error Source /test failed while streaming: Error.Invalidvalue(, "Failure(\"error.log /home/ubuntu/bankgothic.ttf\")(font: /home/ubuntu/bankgothic.ttf)")!

In attachment more detailed log if needed error.log

I am using Liquidsoap 2.1.0+git@adac3026 (but I happens also with LS 2.0.2) installed via Opam on Ubuntu 20 Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.5 menhirLib=20211128 curl=0.9.2 mem_usage=0.0.1 dtools=0.4.4 duppy=0.9.2 cry=0.6.6 mm=0.7.5 xmlplaylist=0.1.5 lastfm=0.3.3 ogg=0.7.0 ogg.decoder=0.7.0 vorbis=0.8.0 vorbis.decoder=0.8.0 mad=0.5.2 flac=0.3.0 flac.ogg=0.3.0 flac.decoder=0.3.0 dynlink=[distributed with Ocaml] lame=0.3.5 gstreamer=0.3.1 frei0r=0.1.2 fdkaac=0.3.2 ffmpeg=1.1.2 samplerate=0.1.6 taglib=0.3.8 camomile=1.0.2 faad=0.5.0 ladspa=0.2.2 tsdl=v0.9.8 tsdl-ttf=0.3.2 gd=1.0a5

smimram commented 2 years ago

For the record the relevant part of the stacktrace is

2022/02/09 12:15:57 [clock.main:4] Source /test failed while streaming: Error.Invalid_value(_, "Failure(\"Couldn't open /home/ubuntu/bankgothic.ttf\")(font: /home/ubuntu/bankgothic.ttf)")!
2022/02/09 12:15:57 [clock.main:4] Raised at file "operators/video_text_sdl.ml", line 35, characters 4-112
2022/02/09 12:15:57 [clock.main:4] Called from file "operators/video_text_sdl.ml", line 41, characters 13-31
2022/02/09 12:15:57 [clock.main:4] Called from file "operators/video_text.ml", line 46, characters 33-74
2022/02/09 12:15:57 [clock.main:4] Called from file "operators/video_text.ml", line 83, characters 14-30
2022/02/09 12:15:57 [clock.main:4] Called from file "source.ml", line 587, characters 6-20
2022/02/09 12:15:57 [clock.main:4] Called from file "source.ml", line 658, characters 10-37
2022/02/09 12:15:57 [clock.main:4] Called from file "operators/switch.ml", line 254, characters 14-36
2022/02/09 12:15:57 [clock.main:4] Called from file "source.ml", line 587, characters 6-20
2022/02/09 12:15:57 [clock.main:4] Called from file "source.ml", line 658, characters 10-37
2022/02/09 12:15:57 [clock.main:4] Called from file "outputs/output.ml", line 163, characters 10-20
2022/02/09 12:15:57 [clock.main:4] Called from file "clock.ml", line 299, characters 14-22
smimram commented 2 years ago

For the record, here is my test to reproduce:

r = ref(0)
t = { ref.incr(r); string_of(!r) }
s = blank()
s = video.add_text.sdl(t,s)
output.video(s)