Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
executable file
·688 lines (570 loc) · 25.5 KB
/
Copy pathjustfile
File metadata and controls
executable file
·688 lines (570 loc) · 25.5 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
#!/usr/bin/env -S just --justfile
host := "127.0.0.1"
port := "7777"
server := "http://" + host + ":" + port
stream := "test-stream"
rkmpp_cross_image := "ghcr.io/binbat/crossbuilder-aarch64-rkmpp:latest"
rpi_cross_image := "ghcr.io/binbat/crossbuilder-aarch64-rpi:latest"
isdp := "i.sdp"
osdp := "o.sdp"
rtsp_port := "8554"
rtsps := "rtsp://" + host + ":" + rtsp_port
irtp := "5002"
ortp := "5006"
asrc := "-f lavfi -i sine=frequency=1000"
vsrc := "-f lavfi -i testsrc=size=1280x720:rate=30"
h264 := "libx264 -pix_fmt yuv420p -g 60 -keyint_min 60 -crf 23 -preset ultrafast -tune zerolatency -profile:v main -level 4.1"
h265 := "libx265 -pix_fmt yuv420p -g 60 -keyint_min 60 -crf 25 -preset ultrafast -tune zerolatency -profile:v main -level 4.1"
vp8 := "libvpx -pix_fmt yuv420p -g 60 -keyint_min 60 -deadline realtime -speed 4 -b:v 2000k -maxrate 2500k -bufsize 5000k"
vp9 := "libvpx-vp9 -pix_fmt yuv420p -g 60 -keyint_min 60 -deadline realtime -speed 5 -row-mt 1 -tile-columns 2 -frame-parallel 1 -b:v 1800k -maxrate 2200k -bufsize 4400k"
av1 := "libaom-av1 -pix_fmt yuv420p -cpu-used 8 -tile-columns 0 -tile-rows 0 -row-mt 1 -lag-in-frames 0 -g 30 -keyint_min 30 -b:v 0 -crf 30 -threads 4 -strict experimental"
opus := "libopus -ar 48000 -ac 2 -b:a 48k -application voip -frame_duration 10 -vbr constrained"
gst_hd := "video/x-raw,format=I420,width=1280,height=720,framerate=30/1"
gst_x264 := "x264enc tune=zerolatency speed-preset=ultrafast key-int-max=60 byte-stream=true"
gst_x265 := "x265enc tune=zerolatency speed-preset=ultrafast key-int-max=60 qp=23"
gst_vp8 := "vp8enc deadline=1 cpu-used=6 lag-in-frames=0 end-usage=cbr keyframe-max-dist=60"
gst_vp9 := "vp9enc deadline=1 cpu-used=6 lag-in-frames=0 end-usage=cbr keyframe-max-dist=60 row-mt=1"
gst_av1 := "av1enc usage-profile=realtime"
default:
just --list
build:
pnpm install
pnpm run build
cargo build --release --all-targets --all-features
# Size-optimized build: fat LTO, 1 codegen unit, stripped, panic=abort
# (same feature set as the release workflow)
[group('build')]
build-size:
cargo build --profile release-size --bins \
--features source-all,webui,net4mqtt,recorder,cascade,whepwright,target-whip,target-rtp,target-rtsp
# Extreme size build: build-size + UPX LZMA (needs upx installed)
[group('build')]
pack-size: build-size
upx --best --lzma target/release-size/live777 target/release-size/liveman target/release-size/whepfrom target/release-size/whipinto target/release-size/net4mqtt
# Examples:
# just rpi-cross-build # Raspberry Pi (uses GHCR image sysroot)
# just cross-build-size armv7-unknown-linux-gnueabihf native-generic-v4l2,webui
# just cross-build-size aarch64-unknown-linux-musl webui # static musl, no native capture
# Cross-compile a size-optimized live777 for an embedded target
# (needs cross <https://github.com/cross-rs/cross> and docker)
[group('build')]
cross-build-size target features="webui":
cross build --target {{target}} --bin live777 --profile release-size \
--no-default-features --features {{features}}
# cross-build-size + UPX LZMA; UPX packs foreign-arch ELFs directly from the host
[group('build')]
cross-pack-size target features="webui": (cross-build-size target features)
upx --best --lzma target/{{target}}/release-size/live777 || echo "warning: UPX cannot pack {{target}}, leaving the binary unpacked"
# Raspberry Pi (native-rpi: libcamera + V4L2 capture, V4L2 M2M encoder)
[group('embedded')]
rpi-sync-sysroot host="raspberrypi" sysroot="target/rpi-sysroot":
#!/usr/bin/env bash
set -euo pipefail
remote="{{host}}"
sysroot="{{sysroot}}"
triplet="aarch64-linux-gnu"
if ! ssh "$remote" "pkg-config --exists libcamera"; then
echo "error: libcamera.pc was not found on $remote"
echo "install libcamera-dev on the Raspberry Pi, then run this recipe again"
exit 1
fi
rm -rf "$sysroot"
mkdir -p "$sysroot/usr/lib/$triplet" "$sysroot/usr/lib/$triplet/pkgconfig"
sysroot_abs=$(cd "$sysroot" && pwd)
pc_dir=$(ssh "$remote" "pkg-config --variable=pcfiledir libcamera")
mkdir -p "$sysroot$pc_dir"
pc_modules=$(ssh "$remote" "printf '%s\n' libcamera; pkg-config --print-requires --print-requires-private libcamera" | awk '{print $1}' | sort -u)
while read -r module; do
[[ -n "$module" ]] || continue
rsync -a "$remote:$pc_dir/$module.pc" "$sysroot$pc_dir/"
done <<< "$pc_modules"
ssh "$remote" "pkg-config --cflags-only-I libcamera" | tr ' ' '\n' | sed -n 's/^-I//p' | while read -r path; do
[[ -n "$path" ]] || continue
mkdir -p "$sysroot$(dirname "$path")"
rsync -a "$remote:$path/" "$sysroot$path/"
done
lib_dirs=$(ssh "$remote" "pkg-config --libs-only-L libcamera" | tr ' ' '\n' | sed -n 's/^-L//p')
if [[ -z "$lib_dirs" ]]; then
lib_dirs="/usr/lib/$triplet"
fi
ssh "$remote" "pkg-config --libs-only-l libcamera" | tr ' ' '\n' | sed -n 's/^-l//p' | while read -r lib; do
[[ -n "$lib" ]] || continue
copied=0
while read -r dir; do
[[ -n "$dir" ]] || continue
matches=$(ssh "$remote" "find '$dir' -maxdepth 1 -name 'lib$lib.so*' -print 2>/dev/null")
[[ -n "$matches" ]] || continue
mkdir -p "$sysroot$dir"
while read -r file; do
rsync -a --links "$remote:$file" "$sysroot$dir/"
copied=1
done <<< "$matches"
done <<< "$lib_dirs"
if [[ "$copied" -ne 1 ]]; then
echo "error: lib$lib.so was not found on $remote"
exit 1
fi
done
dep_files=$(ssh "$remote" "ldd /usr/lib/$triplet/libcamera.so /usr/lib/$triplet/libcamera-base.so 2>/dev/null" \
| awk '/=> \// { print $3 } /^\// { print $1 }' \
| sed 's/:$//' \
| sort -u)
while read -r file; do
[[ -n "$file" ]] || continue
mkdir -p "$sysroot$(dirname "$file")"
rsync -aL "$remote:$file" "$sysroot$(dirname "$file")/"
done <<< "$dep_files"
PKG_CONFIG_SYSROOT_DIR="$sysroot" \
PKG_CONFIG_PATH="$sysroot/usr/lib/$triplet/pkgconfig" \
PKG_CONFIG_ALLOW_CROSS=1 \
pkg-config --exists libcamera
find "$sysroot" -name 'libcamera.so*' -print -quit | grep -q .
echo "RPI_SYSROOT=$sysroot_abs"
[group('embedded')]
rpi-cross-build sysroot="target/rpi-sysroot":
#!/usr/bin/env bash
set -euo pipefail
if [[ -d "{{sysroot}}" ]]; then
sysroot=$(cd "{{sysroot}}" && pwd)
RPI_SYSROOT="$sysroot" \
CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_IMAGE={{rpi_cross_image}} \
cross build --target aarch64-unknown-linux-gnu \
--bin live777 --release \
--no-default-features --features native-rpi,webui
else
echo "warning: {{sysroot}} does not exist; using sysroot baked into {{rpi_cross_image}}"
CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_IMAGE={{rpi_cross_image}} \
cross build --target aarch64-unknown-linux-gnu \
--bin live777 --release \
--no-default-features --features native-rpi,webui
fi
[group('embedded')]
rpi-sync-and-cross-build host="raspberrypi" sysroot="target/rpi-sysroot":
just rpi-sync-sysroot {{host}} {{sysroot}}
just rpi-cross-build {{sysroot}}
[group('embedded')]
rpi-pack-size:
CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_IMAGE={{rpi_cross_image}} \
just cross-pack-size aarch64-unknown-linux-gnu native-rpi,webui,target-rtp,target-rtsp
# RDK X5 (native-rdk: V4L2 capture, RDK BPU encoder)
[group('embedded')]
rdk-pack-size:
test -n "${RDK_SYSROOT:?set RDK_SYSROOT to the RDK sysroot first (see AGENTS.md)}" && \
just cross-pack-size aarch64-unknown-linux-gnu native-rdk,webui,target-rtp,target-rtsp
# Generic V4L2 device (native-generic-v4l2; override the target for 64-bit boards)
[group('embedded')]
v4l2-pack-size target="armv7-unknown-linux-gnueabihf":
just cross-pack-size {{target}} native-generic-v4l2,webui,target-rtp,target-rtsp
# MacOS:
# brew install gstreamer
# Debian:
# apt install libgstreamer1.0-dev libgstrtspserver-1.0-dev
#
# Build some tools: test-rtsp-server
build-tools:
gcc -o test-rtsp-server tools/test-rtsp-server.c $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)
mtx_os := if os() == "macos" { "darwin" } else if os() == "linux" { "linux" } else if os() == "windows" { "windows" } else { "unsupported" }
mtx_arch := if arch() == "x86_64" { "amd64" } else if arch() == "aarch64" { "arm64" } else { "unsupported" }
# Download the mediamtx binary used by the interop matrix tests into target/
# The pinned version lives in mediamtx.version (shared with the CI action).
mediamtx:
#!/usr/bin/env bash
set -euo pipefail
version=$(tr -d '[:space:]' < mediamtx.version)
target={{mtx_os}}_{{mtx_arch}}
if [[ "$target" == *unsupported* ]]; then
echo "unsupported platform: {{os()}}-{{arch()}}"
exit 1
fi
ext=tar.gz
bin=mediamtx
if [[ "{{mtx_os}}" == windows ]]; then ext=zip; bin=mediamtx.exe; fi
fname="mediamtx_${version}_${target}.${ext}"
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
curl -fsSL -o "$tmp/$fname" "https://github.com/bluenviron/mediamtx/releases/download/${version}/${fname}"
curl -fsSL -o "$tmp/checksums.sha256" "https://github.com/bluenviron/mediamtx/releases/download/${version}/checksums.sha256"
grep "$fname" "$tmp/checksums.sha256" > "$tmp/check.txt"
(cd "$tmp" && if command -v sha256sum >/dev/null; then sha256sum --check check.txt; else shasum -a 256 --check check.txt; fi)
mkdir -p "$tmp/x" target
if [[ "$ext" == zip ]]; then
(cd "$tmp" && powershell -NoProfile -Command "Expand-Archive -Force '$fname' x")
else
tar -xzf "$tmp/$fname" -C "$tmp/x" "$bin"
fi
install -m 0755 "$tmp/x/$bin" "target/$bin"
"target/$bin" --version
docs:
pnpm run docs:dev
run:
cargo run --features=webui
run-cluster:
cargo run --bin=livenil --features=webui -- -c conf/livenil
# Edge cameras + cloud SFU cascade demo (see conf/livenil/edge-cloud/)
run-edge-cloud:
cargo run --bin=livenil --features=webui,cascade,source-whep -- -c conf/livenil/edge-cloud
only-mpeg-rtp-h264:
ffmpeg -re {{vsrc}} -vcodec {{h264}} -f rtp 'rtp://{{host}}:5002?pkt_size=1200' -sdp_file {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-h264:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=H264 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video {{irtp}} RTP/AVP 96
a=rtpmap:96 H264/90000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_x264}} ! h264parse ! rtph264pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-h265:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=H265 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video {{irtp}} RTP/AVP 96
a=rtpmap:96 H265/90000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_x265}} ! h265parse config-interval=1 ! rtph265pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-vp8:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=VP8 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video {{irtp}} RTP/AVP 96
a=rtpmap:96 VP8/90000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_vp8}} ! rtpvp8pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-vp9:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=VP9 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video {{irtp}} RTP/AVP 96
a=rtpmap:96 VP9/90000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_vp9}} ! vp9parse ! rtpvp9pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
# TODO: webui can't player
[group('gst-whip-rtp')]
gst-whip-rtp-av1:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=AV1 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video {{irtp}} RTP/AVP 96
a=rtpmap:96 AV1/90000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_av1}} ! av1parse ! rtpav1pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
# TODO: webui can't player
[group('gst-whip-rtp')]
gst-whip-rtp-opus:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=OPUS Test Stream
c=IN IP4 {{host}}
t=0 0
m=audio {{irtp}} RTP/AVP 96
a=rtpmap:96 OPUS/48000/2
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 audiotestsrc is-live=true ! opusenc ! opusparse ! rtpopuspay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-g722:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=G722 Test Stream
c=IN IP4 {{host}}
t=0 0
m=audio {{irtp}} RTP/AVP 96
a=rtpmap:96 G722/8000/1
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 audiotestsrc is-live=true ! avenc_g722 ! rtpg722pay ! udpsink host={{host}} port={{irtp}}"
rm {{isdp}}
[group('gst-whip-rtp')]
gst-whip-rtp-h264-g722:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=H264 + G722 Test Stream
c=IN IP4 {{host}}
t=0 0
m=video 5002 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1
m=audio 5004 RTP/AVP 97
a=rtpmap:97 G722/8000
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 videotestsrc is-live=true ! {{gst_hd}} ! {{gst_x264}} ! h264parse ! rtph264pay pt=96 ! udpsink host={{host}} port=5002 audiotestsrc is-live=true ! avenc_g722 ! rtpg722pay pt=97 ! udpsink host={{host}} port=5004"
rm {{isdp}}
# TODO: only audio in webui can't player
[group('gst-whip-rtp')]
gst-whip-rtp-vp8-opus:
#!/usr/bin/env bash
cat > {{isdp}} << EOF
v=0
o=- 0 0 IN IP4 {{host}}
s=VP8 + OPUS Test Stream
c=IN IP4 {{host}}
t=0 0
m=video 5002 RTP/AVP 96
a=rtpmap:96 VP8/90000
m=audio 5004 RTP/AVP 97
a=rtpmap:97 OPUS/48000/2
EOF
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"gst-launch-1.0 -v videotestsrc is-live=true ! {{gst_hd}} ! {{gst_vp8}} ! rtpvp8pay pt=96 ! udpsink host={{host}} port=5002 audiotestsrc is-live=true ! opusenc ! opusparse ! rtpopuspay pt=97 ! udpsink host={{host}} port=5004"
rm {{isdp}}
[group('gst-rtsp-server')]
gst-rtsp-server-h264:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_hd}} ! {{gst_x264}} ! h264parse ! rtph264pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-h265:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_hd}} ! {{gst_x265}} ! h265parse ! rtph265pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-vp8:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_hd}} ! {{gst_vp8}} ! rtpvp8pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-vp9:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_hd}} ! {{gst_vp9}} ! vp9parse ! rtpvp9pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-av1:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_hd}} ! {{gst_av1}} ! av1parse ! rtpav1pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-opus:
./test-rtsp-server "( audiotestsrc is-live=true ! opusenc ! opusparse ! rtpopuspay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-g722:
./test-rtsp-server "( audiotestsrc is-live=true ! avenc_g722 ! rtpg722pay name=pay0 pt=96 )"
[group('gst-rtsp-server')]
gst-rtsp-server-both-h264-opus:
./test-rtsp-server "( videotestsrc is-live=true ! {{gst_x264}} ! rtph264pay name=pay0 pt=96 audiotestsrc is-live=true ! opusenc ! rtpopuspay name=pay1 pt=97 )"
[group('gst-rtsp-server')]
whip-rtsp:
cargo run --bin=whipinto -- -i rtsp://{{host}}:8554/test -w {{server}}/whip/{{stream}}
[group('gst-rtsp-server')]
whip-rtp:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}}
[group('simple-rtp')]
ffmpeg-rtp-h264:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{vsrc}} -vcodec {{h264}} -f rtp 'rtp://{{host}}:5002' -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-h265:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{vsrc}} -vcodec {{h265}} -f rtp 'rtp://{{host}}:5002' -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-vp8:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{vsrc}} -vcodec {{vp8}} -f rtp rtp://{{host}}:5002 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-vp9:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{vsrc}} -strict experimental -vcodec {{vp9}} -f rtp rtp://{{host}}:5002 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-av1:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{vsrc}} -vcodec {{av1}} -f rtp rtp://{{host}}:5002 -sdp_file {{isdp}}"
# 4K (3840×2160)
[group('simple-rtp')]
ffmpeg-rtp-4k:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re -f lavfi -i testsrc=size=3840x2160:rate=30 -strict experimental -vcodec {{vp9}} -f rtp rtp://{{host}}:5002 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-opus:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{asrc}} -acodec {{opus}} -f rtp rtp://{{host}}:5002 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-g722:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{asrc}} -acodec g722 -f rtp rtp://{{host}}:5002?pkt_size=1200 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffmpeg-rtp-vp8-opus:
cargo run --bin=whipinto -- -i {{isdp}} -w {{server}}/whip/{{stream}} --command \
"ffmpeg -re {{asrc}} {{vsrc}} -acodec {{opus}} -vn -f rtp rtp://{{host}}:5002 -vcodec libvpx -an -f rtp rtp://{{host}}:5004 -sdp_file {{isdp}}"
[group('simple-rtp')]
ffplay-rtp:
cargo run --bin=whepfrom -- -o "rtp://localhost?video=9000&audio=9002" --sdp-file {{osdp}} -w {{server}}/whep/{{stream}} --command \
"ffplay -protocol_whitelist rtp,file,udp -i {{osdp}}"
# Push a stream into liveion's built-in RTSP server
[group('simple-rtsp')]
ffmpeg-rtsp:
ffmpeg -re {{asrc}} {{vsrc}} -acodec libopus -vcodec libvpx -f rtsp {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffmpeg-rtsp-tcp:
ffmpeg -re {{asrc}} {{vsrc}} -acodec libopus -vcodec libvpx -rtsp_transport tcp -f rtsp {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffmpeg-rtsp-vp9:
ffmpeg -re {{asrc}} {{vsrc}} -acodec libopus -strict experimental -vcodec {{vp9}} -f rtsp {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffmpeg-rtsp-h264:
ffmpeg -re {{vsrc}} -vcodec {{h264}} -f rtsp {{rtsps}}/{{stream}}
ffmpeg-rtsp-h264-raw:
ffmpeg -re {{vsrc}} -vcodec libx264 -f rtsp {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffmpeg-rtsp-h265:
ffmpeg -re {{vsrc}} -vcodec {{h265}} -f rtsp {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffplay-rtsp:
ffplay {{rtsps}}/{{stream}}
[group('simple-rtsp')]
ffplay-rtsp-tcp:
ffplay {{rtsps}}/{{stream}} -rtsp_transport tcp
[group('cycle-rtsp')]
cycle-rtsp-0a:
ffmpeg -re {{asrc}} {{vsrc}} -acodec libopus -vcodec libvpx -f rtsp {{rtsps}}/cycle-rtsp-a
[group('cycle-rtsp')]
cycle-rtsp-1a:
cargo run --bin=whipinto -- -i {{rtsps}}/cycle-rtsp-a -w {{server}}/whip/cycle-rtsp-b
[group('cycle-rtsp')]
cycle-rtsp-3c:
cargo run --bin=whipinto -- -i rtsp://{{host}}:8750 -w {{server}}/whip/cycle-rtsp-c
[group('cycle-rtsp')]
cycle-rtsp-4b:
cargo run --bin=whepfrom -- -o rtsp://{{host}}:8750 -w {{server}}/whep/cycle-rtsp-b
[group('cycle-rtsp')]
cycle-rtsp-5c:
ffplay {{rtsps}}/cycle-rtsp-c
# ============================================================
# ffmpeg push to liveion RTSP server (ANNOUNCE + RECORD)
# Usage: just ffmpeg-rtsp-push-h264
# ============================================================
# Push H264 test video into liveion's built-in RTSP server (ANNOUNCE + RECORD)
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-h264:
ffmpeg -re {{vsrc}} -vcodec {{h264}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-h265:
ffmpeg -re {{vsrc}} -vcodec {{h265}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-vp8:
ffmpeg -re {{vsrc}} -vcodec {{vp8}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-vp9:
ffmpeg -re {{vsrc}} -strict experimental -vcodec {{vp9}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-av1:
ffmpeg -re {{vsrc}} -vcodec {{av1}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-opus:
ffmpeg -re {{asrc}} -acodec {{opus}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-g722:
ffmpeg -re {{asrc}} -acodec g722 -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-h264-opus:
ffmpeg -re {{vsrc}} {{asrc}} -vcodec {{h264}} -acodec {{opus}} -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-vp8-opus:
ffmpeg -re {{vsrc}} {{asrc}} -vcodec {{vp8}} -acodec {{opus}} -f rtsp {{rtsps}}/{{stream}}
# TCP transport (force RTP over TCP interleaved)
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-h264-tcp:
ffmpeg -re {{vsrc}} -vcodec {{h264}} -rtsp_transport tcp -f rtsp {{rtsps}}/{{stream}}
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-h265-tcp:
ffmpeg -re {{vsrc}} -vcodec {{h265}} -rtsp_transport tcp -f rtsp {{rtsps}}/{{stream}}
# Push from a local file (re-wrap without re-encoding)
[group('ffmpeg-rtsp')]
ffmpeg-rtsp-push-file:
ffmpeg -re -stream_loop -1 -i input.mp4 -c copy -f rtsp {{rtsps}}/{{stream}}
# ============================================================
# ffplay pull from liveion RTSP server (DESCRIBE + PLAY)
# Usage: just ffplay-rtsp-pull
# ============================================================
# Pull and play an RTSP stream from liveion with ffplay (DESCRIBE + PLAY)
[group('ffplay-rtsp')]
ffplay-rtsp-pull:
ffplay {{rtsps}}/{{stream}}
[group('ffplay-rtsp')]
ffplay-rtsp-pull-tcp:
ffplay -rtsp_transport tcp {{rtsps}}/{{stream}}
[group('ffplay-rtsp')]
ffplay-rtsp-pull-lowlatency:
ffplay -rtsp_transport tcp -fflags nobuffer -flags low_delay -framedrop {{rtsps}}/{{stream}}
[group('ffplay-rtsp')]
ffplay-rtsp-pull-novideo:
ffplay -vn {{rtsps}}/{{stream}}
[group('ffplay-rtsp')]
ffplay-rtsp-pull-noaudio:
ffplay -an {{rtsps}}/{{stream}}
# ============================================================
# ffprobe inspect RTSP stream from liveion
# Usage: just ffprobe-rtsp
# ============================================================
# Inspect an RTSP stream from liveion with ffprobe (JSON stream info)
[group('ffprobe-rtsp')]
ffprobe-rtsp:
ffprobe -v error -hide_banner -i {{rtsps}}/{{stream}} -show_streams -of json
[group('ffprobe-rtsp')]
ffprobe-rtsp-tcp:
ffprobe -rtsp_transport tcp -v error -hide_banner -i {{rtsps}}/{{stream}} -show_streams -of json
# ============================================================
# loadtest: WHIP publish / WHEP subscribe / DataChannel benchmarks
# Usage: just livewrk-whip 100 60 # publishes to streams load-0 .. load-99
# just livewrk-whep 100 60 load-0 # subscribes to one already-published stream
# just loadtest-channel throughput
# ============================================================
# WHIP publish load test; publishes streams load-0 .. load-(N-1)
[group('loadtest')]
livewrk-whip sessions="100" duration="60":
cargo run --release --features=rsmpeg --bin livewrk -- whip \
--whip {{server}}/whip/load --sessions {{sessions}} --duration {{duration}}
# Decode verification (--verify-window) requires building with --features=rsmpeg.
[group('loadtest')]
livewrk-whep sessions="100" duration="60" target_stream=stream:
cargo run --release --features=rsmpeg --bin livewrk -- whep \
--whep {{server}}/whep/{{target_stream}} --sessions {{sessions}} --duration {{duration}}
[group('loadtest')]
loadtest-channel mode="all":
cargo run --release --features=source --bin datachannel_loadtest -- {{mode}}
# Prometheus + Grafana monitoring stack (scrapes the live777 /metrics endpoint)
# Usage: just monitoring-up # Grafana: http://localhost:3000 (admin/admin)
# just monitoring-down
# ============================================================
[group('monitoring')]
monitoring-up:
docker compose -f compose.monitoring.yml up -d
[group('monitoring')]
monitoring-down:
docker compose -f compose.monitoring.yml down
# Rockchip RKMPP (RK3588, RV1126B): V4L2 capture, Rockchip MPP encoder
# Uses the RKMPP cross image (sysroot baked at /opt/rkmpp-sysroot); set
# RKMPP_SYSROOT to override it with a sysroot pulled from a device.
[group('embedded')]
rkmpp-pack-size:
CROSS_TARGET_AARCH64_UNKNOWN_LINUX_GNU_IMAGE={{rkmpp_cross_image}} \
just cross-pack-size aarch64-unknown-linux-gnu native-rkmpp,webui,target-rtp,target-rtsp