mirror of
git://f0xx.org/ac/ac-ms-media-transcode
synced 2026-07-29 04:17:51 +03:00
Add lab restream pipeline with pirate_drift logo and lib/env.sh.
Encode-once/fanout scripts, HLS output, and single overloadable env source. Commits assets/pirate_drift.png as default watermark for cluster runs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
51
bin/probe-source.sh
Executable file
51
bin/probe-source.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# ffprobe → normalized source profile (draft SPEC-1 preview).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${ROOT}/lib/common.sh"
|
||||
# shellcheck disable=SC1091
|
||||
source "${ROOT}/lib/source.sh"
|
||||
|
||||
resolve_source "${1:-}"
|
||||
require_cmd "${FFPROBE_BIN}"
|
||||
|
||||
probe_target="${SOURCE_URL}"
|
||||
if [[ "${USE_YTDLP}" == "1" ]]; then
|
||||
warn "page URL — ffprobe may fail; use a direct m3u8/mp4 URL or run encode-once"
|
||||
fi
|
||||
|
||||
log "probing ${probe_target}"
|
||||
"${FFPROBE_BIN}" -hide_banner -loglevel error \
|
||||
-show_format -show_streams -print_format json \
|
||||
"${probe_target}" | python3 -c '
|
||||
import json, sys
|
||||
data = json.load(sys.stdin)
|
||||
fmt = data.get("format", {})
|
||||
streams = data.get("streams", [])
|
||||
v = next((s for s in streams if s.get("codec_type") == "video"), None)
|
||||
a = next((s for s in streams if s.get("codec_type") == "audio"), None)
|
||||
out = {
|
||||
"duration": fmt.get("duration"),
|
||||
"bitrate": fmt.get("bit_rate"),
|
||||
"format": fmt.get("format_name"),
|
||||
"video": None,
|
||||
"audio": None,
|
||||
}
|
||||
if v:
|
||||
out["video"] = {
|
||||
"codec": v.get("codec_name"),
|
||||
"width": v.get("width"),
|
||||
"height": v.get("height"),
|
||||
"fps": v.get("avg_frame_rate"),
|
||||
"profile": v.get("profile"),
|
||||
}
|
||||
if a:
|
||||
out["audio"] = {
|
||||
"codec": a.get("codec_name"),
|
||||
"channels": a.get("channels"),
|
||||
"sample_rate": a.get("sample_rate"),
|
||||
}
|
||||
print(json.dumps(out, indent=2))
|
||||
'
|
||||
Reference in New Issue
Block a user