Skip to content

Instantly share code, notes, and snippets.

@k-okada
Created April 27, 2022 09:09
Show Gist options
  • Save k-okada/0cc41eff5415e853453be19b36e17060 to your computer and use it in GitHub Desktop.
Save k-okada/0cc41eff5415e853453be19b36e17060 to your computer and use it in GitHub Desktop.
<launch>
<!-- Set this to your camera's name -->
<arg name="cam_name" value="gstream_cam" />
<!-- Need to run 'gst-launch-1.0 -v udpsrc address=192.168.123.15 port=9001 ! udpsink auto-multicast=true host=192.168.123.162 port=5000' in 192.168.123.15 -->
<!-- Start the GSCAM node -->
<env name="GSCAM_CONFIG" value="udpsrc address=192.168.123.162 port=5000 ! application/x-rtp,media=video,encoding-name=H264 ! rtph264depay ! h264parse ! vaapih264dec ! videoconvert " />
<node pkg="gscam" type="gscam" name="$(arg cam_name)">
<param name="camera_name" value="$(arg cam_name)" />
<remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
</node>
<!-- View the raw and rectified output -->
<node pkg="image_view" type="image_view" name="creative_view" >
<remap from="image" to="/$(arg cam_name)/image_raw" />
</node>
</launch>
#coding:utf-8
import time , sys
import cv2
import PIL . Image
I1IiI = [ 9001 , 9002 , 9003 , 9004 , 9005 ]
o0OOO = [ ]
if 13 - 13: ooOo + Oo
o0OOO . append ( cv2 . VideoCapture ( ) )
o0OOO . append ( cv2 . VideoCapture ( ) )
o0OOO . append ( cv2 . VideoCapture ( ) )
o0OOO . append ( cv2 . VideoCapture ( ) )
if 67 - 67: O00ooOO . I1iII1iiII
iI1Ii11111iIi = cv2 . VideoWriter ( )
Ooo0OO0oOO = "appsrc ! videoconvert ! omxh264enc ! h264parse ! video/x-h264, stream-format=byte-stream ! wssink port=9100" ;
#oooO0oo0oOOOO = "udpsrc address=192.168.123.162 port="
oooO0oo0oOOOO = "udpsrc address=192.168.123.15 port="
#O0oO = " ! application/x-rtp,media=video,encoding-name=H264 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! appsink"
# https://community.theta360.guide/t/live-streaming-over-usb-on-ubuntu-and-linux-nvidia-jetson/4359/27
O0oO = " ! application/x-rtp,media=video,encoding-name=H264 ! rtph264depay ! h264parse ! vaapih264dec ! videoconvert ! appsink"
#O0oO = " ! application/x-rtp,media=video,encoding-name=H264 ! rtph264depay ! h264parse ! msdkh264dec ! videoconvert ! appsink"
camIndex_value=1
print(camIndex_value)
ooOooo000oOO = oooO0oo0oOOOO + str ( I1IiI [ camIndex_value - 1 ] ) + O0oO
#ooOooo000oOO = oooO0oo0oOOOO + '9100' + O0oO
print(ooOooo000oOO)
o0OOO [ camIndex_value - 1 ] . open ( ooOooo000oOO )
time . sleep ( 0.1 )
print ( "AI is working ...." , camIndex_value )
while True:
time . sleep ( 0.5 )
Oo0oOOo , Oo0OoO00oOO0o = o0OOO [ camIndex_value - 1 ] . read ( )
OOO00O = time . time ( )
print(Oo0oOOo, Oo0OoO00oOO0o)
if Oo0oOOo:
cv2.imshow("cam", Oo0OoO00oOO0o)
cv2.waitKey(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment