Last active
January 12, 2022 03:41
-
-
Save bot11/64026a09128b2e3de794 to your computer and use it in GitHub Desktop.
Gstreamer notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lets say: | |
IP Address of Raspberry: 192.168.0.106 | |
IP Address of ubuntu Desktop: 192.168.0.103 | |
IP Address of remote linux server to copy image files: 192.168.0.200 | |
1) On Raspberry pi , run the camera and stream using gstreamer as below: | |
raspivid -t 0 -w 800 -h 600 -fps 25 -g 5 -b 4000000 -vf -n -o - | gst-launch -v fdsrc ! h264parse ! gdppay ! tcpserversink host=192.168.0.106 port=5000 | |
2) On Ubuntu desktop, run the local rtsp server as below: | |
-open a new terminal ( Alt + F2 , type "gnome-terminal" ) | |
-type the following commands | |
cd /home/deepak/gst-rtsp-0.10.8/examples/ | |
./test-launch "( tcpclientsrc host=192.168.0.106 port=5000 ! gdpdepay ! rtph264pay name=pay0 pt=96 )" | |
3) Open a new terminal on ubuntu desktop and view the stream as below: | |
-open a new terminal ( Alt + F2 , type "gnome-terminal" ) | |
-type the following command | |
gst-launch-0.10 rtspsrc location=rtsp://192.168.0.103:8554/test ! rtph264depay ! ffdec_h264 ! textoverlay text="TEAMID:12345 CAMERAID:0908879" halign=center valign=top ! timeoverlay halign=right valign=bottom ! clockoverlay halign=left valign=bottom time-format="%Y/%m/%d %H:%M:%S" ! xvimagesink sync=false | |
4) Open a new terminal on ubuntu desktop and record the video as below: | |
-open a new terminal ( Alt + F2 , type "gnome-terminal" ) | |
-type the following command | |
gst-launch-0.10 rtspsrc location=rtsp://192.168.0.103:8554/test ! rtph264depay ! ffdec_h264 ! textoverlay text="TEAMID:12345 CAMERAID:0908879" halign=center valign=top ! timeoverlay halign=right valign=bottom ! clockoverlay halign=left valign=bottom time-format="%Y/%m/%d %H:%M:%S" ! avimux ! filesink location=chandu.avi | |
-Press Ctrl+c to stop the recording. | |
5) To take a screenshot while streaming, | |
-open a new terminal , or connect from another windows via putty | |
-change the directory to store images | |
cd /tmp/files/ | |
-type the following command | |
shutter -w "gst-launch-0.10" -e -o './%y-%m-%d_$w_$h.jpeg' | |
-Overlay team Indus logo | |
convert 14-01-02_1301_744.jpeg index.jpeg -gravity north-east -composite -format jpg -quality 100 output.jpg | |
-Overlay another logo | |
convert 14-01-02_1301_744.jpeg india.png -gravity north-east -composite -format jpg -quality 100 output.jpg | |
-Copy file, to remote desktop: | |
scp output.jpg [email protected]:/tmp | |
** Will give you a script to automate this process. | |
6) Overlay the video: | |
ffmpeg -i test.avi -vf "movie=india.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv | |
** The quality of the overlayed video is not good. | |
Errors when compiling and installing: ^^^^^^^ | |
------------------------------------- | |
Installing glibc devel ubuntu. | |
root@deepak:/home/deepak# apt-get install libglib2.0-dev | |
Reading package lists... Done | |
Building dependency tree | |
Reading state information... Done | |
Some packages could not be installed. This may mean that you have | |
requested an impossible situation or if you are using the unstable | |
distribution that some required packages have not yet been created | |
or been moved out of Incoming. | |
The following information may help to resolve the situation: | |
The following packages have unmet dependencies: | |
libglib2.0-dev : Depends: libglib2.0-0 (= 2.40.0-2) but 2.40.2-0ubuntu1 is to be installed | |
Depends: libglib2.0-bin (= 2.40.0-2) | |
E: Unable to correct problems, you have held broken packages. | |
root@deepak:/home/deepak# apt-get install build-essentials | |
Solution : | |
Right now newer glibc is installed on the system, downgrade as specified. | |
root@deepak:/home/deepak# apt-get install libglib2.0=2.40.0-2 | |
And then install devel package: | |
root@deepak:/home/deepak# apt-get install libglib2.0-dev | |
# installing gstreamer0.10-ffmpeg plugin | |
sudo add-apt-repository ppa:mc3man/trusty-media | |
sudo apt-get update | |
sudo apt-get install gstreamer0.10-ffmpeg | |
#---------------------------------- | |
Another method of running the video: | |
on rapi: | |
/opt/vc/bin/raspivid -t 0 -hf -fps 20 -w 800 -h 600 -o - | gst-launch-1.0 fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=192.168.0.101 port=5000 | |
on client: | |
gst-launch-1.0 -v tcpclientsrc host=192.168.0.101 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false | |
If got error: | |
WARNING: erroneous pipeline: no element "gdpdepay" | |
Solution: | |
sudo apt-get install gstreamer1.0-plugins-bad | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks a lot bro