Skip to content

VideoEncoder does not encode to v4l2 loopback device #544

@vryabokon1705

Description

@vryabokon1705

Environment

  • OS version: Ubuntu 22.04
  • Source or binary build: binary
    Gz-common: 5.4.2-1
    Gz-sim: 7.6.0-1

Description

  • Expected behavior: v4l2 loopback device simulates video from world`s camera
  • Actual behavior: Simulation fails with error log message: "[Err] [VideoEncoder.cc:435] Unable to allocate format context. Video encoding not started"

Steps to reproduce

  1. Build fork of regular CameraVideoRecorder plugin with possibility to use v4l2 format : https://github.com/vryabokon1705/camera-videro-recorder2.git
  2. Copy libCameraVideoRecorder2.so to $HOME/.gz/sim/plugins/
  3. Make copy of camera_video_record_dbl_pendulum.sdf as camera_video_record_dbl_pendulum_copy.sdf
  4. Edit camera_video_record_dbl_pendulum_copy.sdf:
    <sensor name="camera" type="camera">
    <plugin filename="CameraVideoRecorder2" name="streamer::CameraVideoRecorder2">
    <service>camera/record_video</service>
    </plugin>
    ...
    </sensor>
  5. Check existing v4l2 devices
    ls /dev/video*
  6. Create v4l2 loopback device:
    sudo modprobe v4l2loopback
    find new created v4l2 loopback device path (let it be /dev/video1)
    ls /dev/video*
  7. Start gazebo simulator:
    gz sim camera_video_record_dbl_pendulum_copy.sdf
  8. Start gazebo service:
    gz service -s /camera/record_video --reqtype gz.msgs.VideoRecord --reptype gz.msgs.Boolean --timeout 300 --req 'start: true, format:"v4l2", save_filename:"/dev/video1"'

Output

image
image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions