gst-raiplay-download.sh: rename tsdemux from "ts" to "demux"
[experiments/gstreamer.git] / shell / gst-raiplay-download.sh
1 #!/bin/sh
2
3 # example pipeline to download HSL streams from raiplay.it
4
5 set -e
6
7 { [ "x$1" = "x" ] || [ "x$2" = x ]; } && { echo "usage: $(basename "$0") <source_m3u8_url> <output_file>" 1>&2; exit 1; }
8
9 SOURCE_URL="$1"
10 OUTPUT_FILE="$2"
11
12 # use the avimux element because my TV set does not like the output of mp4mux
13 # use a high value for connection-speed to download the best quality video
14 gst-launch-1.0 \
15   \
16   mp4mux name=mp4 fragment-duration=10 ! \
17   filesink location="$OUTPUT_FILE" \
18   \
19   "$SOURCE_URL" ! \
20   hlsdemux connection-speed=4294967 ! \
21   tsdemux name=demux \
22   \
23   demux.video_0_0100 ! queue ! h264parse ! queue ! \
24   mp4.video_00 \
25   \
26   demux.audio_0_0101 ! queue ! decodebin ! audioconvert ! lamemp3enc ! queue ! \
27   mp4.audio_00
28
29 # NOTE: the audio re-encoding is necessary because aacparse lacks some
30 # functionality, see:
31 # https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/106