Rtsp script
Uit Projectgroep .540
#!/bin/sh # 2014-9-9 Ubuntu Trusty echo "\n\n*** Digilite-ZL starting... ***\n" #./si_gen_101_102.py # Make named pipes in /tmp folder for sending data between programs mkfifo /tmp/video2.es mkfifo /tmp/audio2.es mkfifo /tmp/video2.pes mkfifo /tmp/audio2.pes mkfifo /tmp/video2.ts mkfifo /tmp/audio2.ts mkfifo /tmp/mux2.ts mkfifo /tmp/buffer2.ts mkfifo /tmp/buffer12.ts mkfifo /tmp/testbeeld2 mkfifo /tmp/testbeeld2.es mkfifo /tmp/testbeeld2.pes mkfifo /tmp/testbeeld2.ts mkfifo /tmp/stream2.ts # Encoding ffmpeg -i rtsp://192.168.2.99:554/live.sdp -r 25 -an -s 720x576 -aspect 4:3 -b 1300k -maxrate 1300k -minrate 1300k -bf 2 -bufsize 1300k -vcodec mpeg2video -f mpeg2video -y /tmp/testbeeld2.es & avconv -f alsa -i hw:0,0 -vn -acodec mp2 -ab 128k -ar 48000 -f mp2 -y /tmp/audio2.es & # Convert elementary streams into program streams esvideompeg2pes /tmp/testbeeld2.es > /tmp/testbeeld2.pes & esaudio2pes /tmp/audio2.es 1152 48000 384 -1 3600 > /tmp/audio2.pes & # Convert program streams into transport streams, Video PID= 256, Audio PID= 257 pesvideo2ts 101 25 112 1630000 0 /tmp/testbeeld2.pes > /tmp/testbeeld2.ts & pesaudio2ts 102 1152 48000 384 0 /tmp/audio2.pes > /tmp/audio2.ts & # Mux the Audio, Video and SI transport streams together to generate DVB TS mux tscbrmuxer b:188000 /tmp/audio2.ts b:1630000 /tmp/testbeeld2.ts b:3008 pat.ts b:1500 pmt.ts b:1500 sdt.ts b:1400 nit.ts o:1843137 null.ts > /tmp/mux2.ts & # Insert current Date/Time information (optional) tstdt /tmp/mux2.ts > /tmp/buffer2.ts & #Change the pcr values to fix jitter after multiplexing (optional) tspcrstamp /tmp/buffer2.ts 1843137 > /dev/ttyUSB0 & echo "\n" echo -n "\n*** Press enter to stop the process at any time ***\n\n" read var_n killall esvideompeg2pes killall pesvideo2ts killall ffmpeg killall tscbrmuxer killall tstdt killall tspcrstamp killall tsloop killall avconv killall esaudio2pes killall pesaudio2ts rm /tmp/video2.ts rm /tmp/audio2.ts rm /tmp/video2.pes rm /tmp/video2.es rm /tmp/audio2.es rm /tmp/audio2.pes rm /tmp/mux2.ts rm /tmp/buffer2.ts rm /tmp/buffer12.ts rm /tmp/testbeeld2 rm /tmp/testbeeld2.es rm /tmp/testbeeld2.pes rm /tmp/testbeeld2.ts rm /tmp/stream2.ts sleep 1 echo "\n\nStopped encoding.\n\n"