Live video on the AT Protocol

app: opusparse on ingest, seems to fix a/v duration mismatch (#286)

* app: opusparse on ingest, seems to fix a/v duration mismatch

* hack: add segment-durations.sh

authored by

Eli Mallon and committed by
GitHub
55baf868 bb750b93

+17 -1
+16
hack/segment-durations.sh
··· 1 + #!/bin/bash 2 + 3 + # Splits a video stream apart into video and audio files and checks the discrepancy between them 4 + 5 + set -euo pipefail 6 + 7 + dir="$(mktemp -d)" 8 + ffmpeg -i "$1" -vn -c:a copy "$dir/audio.mkv" 2>/dev/null >/dev/null 9 + ffmpeg -i "$1" -an -c:v copy "$dir/video.mkv" 2>/dev/null >/dev/null 10 + videoDuration=$(gst-discoverer-1.0 "$dir/video.mkv" | grep "Duration" | sed 's/ Duration: 0:00:0//') 11 + audioDuration=$(gst-discoverer-1.0 "$dir/audio.mkv" | grep "Duration" | sed 's/ Duration: 0:00:0//') 12 + 13 + echo "Video duration: $videoDuration" 14 + echo "Audio duration: $audioDuration" 15 + echo "Difference (negative means audio is longer): $(node -p "$videoDuration - $audioDuration")" 16 + rm -rf "$dir"
+1 -1
pkg/media/webrtc_ingest.go
··· 34 34 pipelineSlice := []string{ 35 35 "multiqueue name=queue", 36 36 "appsrc format=time is-live=true do-timestamp=true name=videosrc ! capsfilter caps=application/x-rtp ! rtph264depay ! capsfilter caps=video/x-h264,stream-format=byte-stream,alignment=nal ! h264parse disable-passthrough=true config-interval=-1 ! h264timestamper ! identity ! queue.sink_0", 37 - "appsrc format=time do-timestamp=true name=audiosrc ! capsfilter caps=application/x-rtp,media=audio,encoding-name=OPUS,payload=111 ! rtpopusdepay ! queue.sink_1", 37 + "appsrc format=time do-timestamp=true name=audiosrc ! capsfilter caps=application/x-rtp,media=audio,encoding-name=OPUS,payload=111 ! rtpopusdepay ! opusparse ! queue.sink_1", 38 38 } 39 39 40 40 pipeline, err := gst.NewPipelineFromString(strings.Join(pipelineSlice, "\n"))