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.35k stars 122 forks source link

Blank frames between requests in CUE playlist #3971

Open vitoyucepi opened 2 weeks ago

vitoyucepi commented 2 weeks ago

Describe the bug If playlist uses a CUE file, it will produce blank frames when switching between requests. Screenshot from Audacity with the waveform separated by the empty frames

To Reproduce

  1. ffmpeg -f lavfi -i "sine=frequency=100:duration=2" -c:a libmp3lame -b:a 16k -y 1.mp3
  2. 1.cue
    FILE "/tmp/test/1.mp3" WAVE
     TRACK 01 AUDIO
       INDEX 01 00:00:00
     TRACK 02 AUDIO
       INDEX 01 00:01:00
  3. main.liq

    s = playlist("1.cue", loop=false, mode="normal")
    
    s = clock(sync="none", s)
    # clock.assign_new(sync="none", [s])
    
    enc = %ffmpeg(format="mp3", %audio(codec="libmp3lame", b="128k"))
    output.file(enc, "out.mp3", s, fallible=true)

Expected behavior No blank frames between requests, because they produce an audible click.

Version details

Install method savonet/liquidsoap:v2.2.5

Common issues

3937

toots commented 1 week ago

Thanks for reporting. I am not sure if this is really a bug. The gap is caused by the new request taking too much time to be prepared I think. If I use prefetch=2, I get a constant sine (with a pop due to the expected discontinuity between the tracks):

Screenshot 2024-06-20 at 10 20 39 AM
vitoyucepi commented 1 week ago

If I use prefetch=2

This is weird. There are only two tracks in the playlist and I still see the gap even with prefetch=2.

toots commented 1 week ago

What decoder are you using?

vitoyucepi commented 1 week ago

I found this issue a good opportunity to test github actions, and I didn't enjoy the process. https://github.com/vitoyucepi/liquidsoap-issue-3971 https://github.com/vitoyucepi/liquidsoap-issue-3971/blob/52ecedb16e84924d5340611b1fe7ebd4c5775fdd/.github/workflows/github-actions-demo.yml https://github.com/vitoyucepi/liquidsoap-issue-3971/actions/runs/9602151400/job/26482345377

What decoder are you using?

ffmpeg