ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is it possible to convert .avi file into rosbag file in ROS_KINETIC_KAME

asked 2019-03-05 07:15:07 -0600

SUBHASH gravatar image

updated 2019-03-07 05:18:29 -0600

gvdhoorn gravatar image

I am not understanding how to run a video using ros_kinetic_kame. Please share me a video or complete process with all required packages that how to convert a .avi file into rosbag format.


Edit: This is my error I found :

$  roslaunch video_stream_opencv camera.launch video_stream_provider:="/home/test/Desktop/Prj/output.avi"
... logging to /home/test/.ros/log/98df6008-40c1-11e9-9e42-c81f6622f107/roslaunch-DH1CT5Z1-14580.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://DH1CT5Z1:34887/

SUMMARY
========

PARAMETERS
 * /camera/camera_stream/buffer_queue_size: 100
 * /camera/camera_stream/camera_info_url: 
 * /camera/camera_stream/camera_name: camera
 * /camera/camera_stream/flip_horizontal: False
 * /camera/camera_stream/flip_vertical: False
 * /camera/camera_stream/fps: 30.0
 * /camera/camera_stream/frame_id: camera
 * /camera/camera_stream/height: 0
 * /camera/camera_stream/loop_videofile: False
 * /camera/camera_stream/set_camera_fps: 30.0
 * /camera/camera_stream/video_stream_provider: /home/test/Deskto...
 * /camera/camera_stream/width: 0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /camera/
    camera_stream (video_stream_opencv/video_stream)

ROS_MASTER_URI=http://localhost:11311

process[camera/camera_stream-1]: started with pid [14597]
[ INFO] [1551955599.176597852]: Resource video_stream_provider: /home/test/Desktop/Prj/output.avi
[ INFO] [1551955599.176662227]: Getting video from provider: /home/test/Desktop/Prj/output.avi
[ INFO] [1551955599.179496159]: Video stream provider type detected: videofile
[ INFO] [1551955599.180594786]: Camera name: camera
[ INFO] [1551955599.181613177]: Setting camera FPS to: 30
[ INFO] [1551955599.181655102]: Camera reports FPS: 20
[ INFO] [1551955599.182527461]: Setting buffer size for capturing frames to: 100
[ INFO] [1551955599.183486775]: Throttling to fps: 30
[ INFO] [1551955599.184338937]: Publishing with frame_id: camera
[ INFO] [1551955599.185229180]: Provided camera_info_url: ''
[ INFO] [1551955599.186110557]: Flip horizontal image is: false
[ INFO] [1551955599.187001087]: Flip vertical image is: false
[ INFO] [1551955599.191553137]: using default calibration URL
[ INFO] [1551955599.191696665]: camera calibration URL: file:///home/test/.ros/camera_info/camera.yaml
[ INFO] [1551955599.191759949]: Unable to open camera calibration file [/home/test/.ros/camera_info/camera.yaml]
[ WARN] [1551955599.191787319]: Camera calibration file /home/test/.ros/camera_info/camera.yaml not found.
[ INFO] [1551955599.191810010]: Opened the stream, starting to publish.
[camera/camera_stream-1] process has finished cleanly
log file: /home/test/.ros/log/98df6008-40c1-11e9-9e42-c81f6622f107/camera-camera_stream-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
edit retag flag offensive close merge delete

Comments

Yes, it is possible. Can you please tell us what have you tried and what didn't work exactly. As a start you can use video_stream_opencv, video_player is outdated.

Jasmin gravatar image Jasmin  ( 2019-03-05 15:11:08 -0600 )edit

How to get the video_stream_opencv I have tries to get its packages but all I find the error for broken packages only

SUBHASH gravatar image SUBHASH  ( 2019-03-07 01:07:53 -0600 )edit

I've posted an answer for your first question that should work once the package is installed correctly. Can you please share the dependency errors that you've got to help you solve them.

Jasmin gravatar image Jasmin  ( 2019-03-07 02:36:14 -0600 )edit

did you use sudo apt-get install ros-kinetic-video-stream-opencv to install the package or install it from source?

Jasmin gravatar image Jasmin  ( 2019-03-07 02:39:19 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-03-07 02:33:02 -0600

Jasmin gravatar image

updated 2019-03-07 03:02:51 -0600

I've used video_stream_opencv once with ROS indigo,

Installed it with sudo apt-get install ros-indigo-video-stream-opencv

And run it on an .avi video as follows:

#check if the input video is fine:
$ rosrun video_stream_opencv test_video_resource.py path_to_your_video/your_video.avi
#run it:
$ roslaunch video_stream_opencv camera.launch video_stream_provider:="path_to_your_video/your_video.avi"

The output topic is /camera/image_raw, note that you may need to adjust some parameters if needed (fps, frame_id...)

Once you have your topic ready you can record a bag of your video data directly with rosbag record

If your need is images published to a ROS topic, we are already there!

But if you just need the bag file and want a more direct conversion you may make use of this link and this question's answer.

edit flag offensive delete link more

Comments

After executing $ rosrun video_stream_opencv test_video_resource.py home/Desktop/Prj/output.avi Error: Trying to open resource: home/Desktop/Prj/output.avi Error opening resource: home/Desktop/Prj/output.avi Maybe opencv VideoCapture can't open it

SUBHASH gravatar image SUBHASH  ( 2019-03-07 03:36:27 -0600 )edit

Please tell me the process to execute this code with ROS. Does it need video_stream_opencv?

SUBHASH gravatar image SUBHASH  ( 2019-03-07 03:47:11 -0600 )edit

Check the path to your video file again, I think that the user name is missing, it should be something like /home/user_name/Desktop/...

Jasmin gravatar image Jasmin  ( 2019-03-07 03:56:34 -0600 )edit

$ roslaunch video_stream_opencv camera.launch video_stream_provider:="path_to_your_video/your_video.avi" To launch this command roscore opened in another tab is required?

SUBHASH gravatar image SUBHASH  ( 2019-03-07 04:07:13 -0600 )edit

It should run roscore automatically... Maybe, I'm not sure in this case. Did it work only when having a running roscore?

Jasmin gravatar image Jasmin  ( 2019-03-07 04:26:40 -0600 )edit

I got this error: $ roslaunch video_stream_opencv camera.launch video_stream_provider:="/hometest/Desktop/Prj/output.avi" ... logging to /home/test/.ros/log/98df6008-40c1-11e9-9e42-c81f6622f107/roslaunch-DH1CT5Z1-14432.log Checking log directory for disk usage. This may take awhile. goto next commen

SUBHASH gravatar image SUBHASH  ( 2019-03-07 04:41:17 -0600 )edit

This worked properly: rosrun video_stream_opencv test_video_resource.py path_to_your_video/your_video.avi Now I want to convert my .avi file to .bag file How to do that? $ roslaunch video_stream_opencv camera.launch video_stream_provider:="path_to_your_video/your_video.avi" above command gave me err

SUBHASH gravatar image SUBHASH  ( 2019-03-07 04:44:36 -0600 )edit

what kind of error, can you post it here?

Jasmin gravatar image Jasmin  ( 2019-03-07 04:49:00 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-03-05 07:15:07 -0600

Seen: 810 times

Last updated: Mar 07 '19