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

Reading a video file (*.mp4) using gscam

asked 2014-10-07 17:45:42 -0600

jhk gravatar image

updated 2014-10-08 01:14:45 -0600

I am trying to read a video file of mp4 type using gscam and display onto image_view. It seems working at the first try but it does not work again once it is terminated. Is there something I missed? I am new to ROS.

Here are commands that I have typed to read a video file (test_video.mp4) using gscam

$ roscore
$ roslaunch gscam videofile.launch FILENAME:=/home/jhk/test_video.mp4
$ rosrun image_view image_view image:=/video_file/camera/image_raw

It worked well showing the video playing in the image_view. However, after I interrupted the roslaunch by pressing CTRL+C and tried it again. It does not work anymore. The only solution was I had to reboot my ubuntu system. Then it started work again but once I killed the process related to the gscam node and relaunching won't work. Basically, it does not publish streaming. Here is the output of the command at second time.

$ roslaunch gscam videofile.launch FILENAME:=/home/jhk/test_video.mp4

... logging to /home/jhk/.ros/log/5a094bfa-4e27-11e4-8e1f-e82aeab21ee8/roslaunch-COMSCI-4064-5408.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://COMSCI-4064:48329/


 * /rosdistro: indigo
 * /rosversion: 1.11.9
 * /videofile/gscam_driver_v4l/camera_info_url: package://gscam/e...
 * /videofile/gscam_driver_v4l/camera_name: default
 * /videofile/gscam_driver_v4l/frame_id: /videofile_frame
 * /videofile/gscam_driver_v4l/gscam_config: filesrc location=...
 * /videofile/gscam_driver_v4l/reopen_on_eof: True
 * /videofile/gscam_driver_v4l/sync_sink: True

    gscam_driver_v4l (gscam/gscam)


core service [/rosout] found
process[videofile/gscam_driver_v4l-1]: started with pid [5426]
[ INFO] [1412720273.052893830]: Using gstreamer config from rosparam: "filesrc location=/home/jhk/test_video.mp4 ! decodebin ! ffmpegcolorspace"
[ INFO] [1412720273.056832654]: camera calibration URL: package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1412720273.065801792]: Loaded camera calibration from package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1412720273.086922863]: Time offset: 1412719055.015

I have tried to kill the node and cleanup using commands

$ rosnode kill $ rosnode cleanup

but still does not work. I also tried rerun roscore but not successful. Is there any initialization command of ROS? or is there a better way of stopping gscam node?

edit retag flag offensive close merge delete


My best guess is that some part of the gstreamer pipeline is not getting cleaned up properly. I would start there.

ahendrix gravatar image ahendrix  ( 2014-10-07 19:26:30 -0600 )edit

Hello, I have the same problem. Have you already solved it ?

smithers gravatar image smithers  ( 2014-11-11 06:01:21 -0600 )edit

I could not solve the problem with gscam, but I could work around with rbx1 followed by my modification. Check out in my fork on rbx1 ( ).

jhk gravatar image jhk  ( 2014-11-12 18:54:05 -0600 )edit

Thank you very much! I checked out your and I found a problem with my mp4 file. It doesn't find the file. I checked the path and it is right. I was reading about this problem but I am not sure how to solve it. Could be a problem with ffmpeg?

smithers gravatar image smithers  ( 2014-11-13 03:12:27 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-07 10:49:27 -0600

jbohren gravatar image

For h.264-encoded mp4 files, try using it with qtdemux with the following launchfile:

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-10-07 17:45:42 -0600

Seen: 2,199 times

Last updated: Oct 07 '15