File: ffmpeg-copy-encode.liq

package info (click to toggle)
liquidsoap 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,844 kB
  • sloc: ml: 74,136; javascript: 27,320; ansic: 505; sh: 139; xml: 114; lisp: 96; makefile: 26
file content (32 lines) | stat: -rw-r--r-- 807 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
# Make sure tracks are saved in the same order.
def f() =
  s =
    once(
      single(
        "../media/@ffmpeg[format='mp4',@audio[codec='aac',channels=2],@audio_2[codec='aac',channels=1],@video[codec='libx264'],@video_2[codec='libx264']].mp4"
      )
    )

  def on_stop() =
    j =
      process.read(
        "ffprobe -v quiet -print_format json -show_streams \
         ffmpeg-copy-encode.mkv"
      )

    let json.parse ({streams = [s1, s2]} : {streams: [{channels?: int}]}) = j
    if s1?.channels != 2 or s2?.channels != 1 then test.fail() end
    test.pass()
  end

  o =
    output.file(
      fallible=true,
      %ffmpeg(%audio.copy, %audio_2(channels = 1, codec = "aac"), %video.copy),
      "ffmpeg-copy-encode.mkv",
      s
    )
  o.on_stop(synchronous=true, on_stop)
end

test.check(f)