Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Панель видоискателя может быть подключена к фейклинку, если она не нужна, но я не думаю, что ее можно отключить. По крайней мере, это впечатление, что я читаю оригинальный пост в блоге KaKaRoTo.
чтобы использовать в ROS
1) установить пакет usb-cam
sudo apt-get install ros-kinetic-usb-cam2) Создать файл, например usb_cam.launch и положить его в папку вашего пакета
<launch>
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="320" />
<param name="image_height" value="240" />
<param name="pixel_format" value="yuyv" />
<param name="camera_frame_id" value="usb_cam" />
<param name="io_method" value="mmap"/>
</node>
</launch>где video_device нужно указать адрес вашего видеутроства, например /dev/video0
ffmpeg -i rtsp://admin:admin@192.168.1.142:554/CH001.sdp -f v4l2 -pix_fmt yuv420p /dev/video1
<launch>
<!-- Command Line Arguments -->
<arg name="cam_name" default="usb_cam" /> <!-- The name of the camera (corrsponding to the camera info) -->
<arg name="frame_id" default="/$(arg cam_name)_link" /> <!-- The TF frame ID. -->
<arg name="sync_sink" default="true" /> <!-- Synchronize the app sink. Setting this to false may resolve problems with sub-par framerates. -->
<arg name="width" default="640" /> <!-- Image Width -->
<arg name="height" default="360" /> <!-- Image Height -->
<arg name="fps" default="10" /> <!-- Desired framerate. True framerate may not reach this if set too high. -->
<!-- Make arguments available to parameter server -->
<param name="$(arg cam_name)/image_width" type="int" value="$(arg width)" />
<param name="$(arg cam_name)/image_height" type="int" value="$(arg height)" />
<param name="$(arg cam_name)/target_fps" type="int" value="$(arg fps)" />
<!-- Define the GSCAM pipeline -->
<env name="GSCAM_CONFIG" value="nvcamerasrc ! video/x-raw(memory:NVMM),
width=(int)$(arg width), height=(int)$(arg height), format=(string)I420, framerate=(fraction)$(arg fps)/1 !
nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR" />
<!-- Start the GSCAM node -->
<node pkg="gscam" type="gscam" name="$(arg cam_name)">
<param name="camera_name" value="$(arg cam_name)" />
<param name="frame_id" value="$(arg frame_id)" />
<param name="sync_sink" value="$(arg sync_sink)" />
<remap from="camera/image_raw" to="$(arg cam_name)/image_raw" />
<remap from="/set_camera_info" to="$(arg cam_name)/set_camera_info" />
</node>
<node name="republish" type="republish" pkg="image_transport" output="screen" args="in:=/usb_cam/image_raw" />
</launch>cvlc -vvv v4l2:///dev/video0:chroma=h264:width=1920:height=1080 --demux h264 --sout '#std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://a.rtmp.youtube.com/live2/xxxxx}'[73b00510] core input debug: Buffering 68%
[73b00510] core input debug: Buffering 89%
[73b00510] core input debug: Stream buffering done (336 ms in 268 ms)
[73b00510] core input debug: Decoder wait done in 0 ms
[72b31508] avcodec mux debug: writing header
Трансляция h264 видео без перекодирования с камеры Logitech C920