File: ffmpeg_copy_concat.liq

package info (click to toggle)
liquidsoap 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,372 kB
  • sloc: ml: 71,806; javascript: 27,320; ansic: 398; xml: 114; sh: 99; lisp: 96; makefile: 26
file content (42 lines) | stat: -rw-r--r-- 913 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# For some reason, ffmpeg uses weird frame rates when creating the samples below.
settings.ffmpeg.content.copy.relaxed_compatibility_check := true

out = {"concat-#{random.int()}.mp4"}

s1 = single("first-concat.mp4")
s2 = single("second-concat.mp4")
s3 = single("third-concat.mp4")
s = sequence([s1, s2, s3, switch([])])

clock.assign_new(sync='none', [s])

done = ref(false)

#clock.assign_new(sync='none', [s])
def on_close(filename) =
  if
    not done()
  then
    done := true

    ojson =
      process.read(
        "ffprobe -v quiet -print_format json -show_streams #{
          process.quote(filename)
        }"
      )

    let json.parse {streams = [{duration}]} = ojson

    # Actual time is 59.93..
    if
      int(float_of_string(duration)) == 59
    then
      test.pass()
    else
      test.fail()
    end
  end
end

output.file(fallible=true, on_close=on_close, %ffmpeg(%video.copy), out, s)