-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmux.sh
43 lines (36 loc) · 1.1 KB
/
mux.sh
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
#!/bin/sh
# usage: mux.sh <inputfile.mp4>
# assumes h264/aac encoding on input file. for other codecs
# the -bsf:v h264_mp4toannexb
# and -mpegts_service_type advanced_codec_digital_hdtv
# may need to be removed or replaced accordingly.
# for live streams: remove the -re flag as the live stream
# should drive the clocking.
network_name="MyNetwork"
channel_name="MyChannel"
usb_device=0
dvb_channel=60
network_id=0x0700
stream_id=0x0001
service_id=800
MODULATION="-d $usb_device -c $dvb_channel --gain -25 --guard-interval 1/4 --code-rate 1/2"
MUXRATE="$(sendts-it9507 --muxrate $MODULATION)"
ffmpeg \
-re -i "$1" \
-f mpegts \
-c:v copy -bsf:v h264_mp4toannexb \
-c:a copy \
-mpegts_original_network_id "$network_id" \
-mpegts_transport_stream_id "$stream_id" \
-mpegts_service_type advanced_codec_digital_hdtv \
-mpegts_service_id "$service_id" \
-mpegts_pmt_start_pid 0x30 \
-mpegts_copyts 1 \
-muxrate $((MUXRATE-1000)) \
-streamid 0:0x31 \
-streamid 1:0x32 \
-metadata service_provider="$network_name" \
-metadata service_name="$channel_name" \
-fflags +sortdts \
- | \
sendts-it9507 $MODULATION