Reputation: 1
I want to save a video using GStreamer in the following environment.
Hardware: Raspberry pi (BCM 2709 Revision: a 22082)
OS: Raspbian GNU / Linux 9 (stretch) Webcam: Logitech HD WEBCAM C270
The video saved with following command, the playback speed becomes too faster than expected.
$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! filesink location=video.h264
However, if I change “framerate” to 30/1, I can watch without problems
I checked the frame rate of the video with following command
$ ffmpeg -i video.h 264
Input # 0, h 264, from 'video. H 264':
Duration: N / A, bitrate: N / A
Stream # 0: 0: Video: h 264 (High), yuv 420 p (progressive), 640 x 480 [SAR 1: 1 DAR 4: 3], 25 fps, 25 tbr, 1200 k tbn, 50 tbc
The frame rate is 25/1.
I tried specifying the frame rate to hardware with following command.
$ v4l2-ctl -d / dev / video0 -p 10
Frame rate set to 10.000 fps
But there was no effect.
Also I tried using “videorate” plugin.
$ gst-launch-1.0 v4l2src ! videorate ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! filesink location=video.h264
But it got worse results. Even if playback is started, the video will remain stopped, and after a while it will be played at high speed
The version of GStreamer is 1.10.4. This is the only version available with apt-get. I tried to compile from source code, but building on Raspbian is not supported and it is very difficult.
Update: I tried Lad's suggetion(Thanks!)
But following error message shown...
gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! mp4mux ! filesink location=video.h264
...
ERROR: from element /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: Could not multiplex stream.
Additional debug info:
gstqtmux.c(3391): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstMP4Mux:mp4mux0:
Buffer has no PTS.
What is wrong?
Upvotes: 0
Views: 5928
Reputation: 1438
You are missing mp4mux element in the pipeline. try the following pipeline :
$ gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,format=YV12,framerate=10/1 ! videoconvert ! omxh264enc ! video/x-h264 ! h264parse ! mp4mux ! filesink location=video.h264
Upvotes: 1