Getting troubles in setting the framerate when saving a video.

gligart gligart at gmail.com
Tue Jun 26 14:58:13 UTC 2018


Hello community!
I've been playing around with Gstreamer (1.0) for a month more or less, and
right now I'm really having a hard time in setting the framerate of a
v4l2src. I show you my pipeline and then I explain you what happens instead
of what I expect.

The starting pipeline is:

gst-launch-1.0 videotestsrc pattern=1 !
                     video/x-raw, width=640, height=480, format=YUY2,
framerate=5/1 !
                     queue !
                     clockoverlay !
                     shmsink socket-path=/tmp/foo sync=true
wait-for-connection=false shm-size=10000000

and then I save a video reading from the shared memory in this way
(different shell...):

gst-launch-1.0 shmsrc socket-path=/tmp/foo do-timestamp=true is-live=true !
                     video/x-raw, format=YUY2, width=640, height=480,
pixel-aspect-ratio=1/1, interlace-mode=progressive, framerate=5/1 !
                     queue !
                     videorate max-rate=5 !
                     videoconvert !
                     vaapipostproc !
                     vaapih264enc !
                     h264parse !
                     mpegtsmux !
                     filesink location=videoshm.avi


In this way it works.
Now the problem for me is that instead of videotestsrc I switch on v4l2src,
and natively I can't force its framerate, meaning that even if I pass caps
framerate=5/1 it only changes the metadata, leaving the framerate of the
video the native one, and if I try to save the video with a lower framerate
it does not work anymore. 

The couple of pipelines which do not work are:

gst-launch-1.0 v4l2src device=/dev/video0 !
                     video/x-raw, width=640, height=480, format=YUY2 !     
*even if I force the framerate here it doesn't work
                     queue !
                     clockoverlay !
                     shmsink socket-path=/tmp/foo sync=true
wait-for-connection=false shm-size=10000000

and then if I try to save with:

gst-launch-1.0 shmsrc socket-path=/tmp/foo do-timestamp=true is-live=true !
                     video/x-raw, format=YUY2, width=640, height=480,
pixel-aspect-ratio=1/1, interlace-mode=progressive !
                     queue !
                     videorate max-rate=5 !
                     videoconvert !
                     vaapipostproc !
                     vaapih264enc !
                     h264parse !
                     mpegtsmux !
                     filesink location=videoshm.avi

It saves a corrupted file impossible to be opened with vlc. Instead if I
force the framerate adding "framerate=5/1" to the caps of the pipeline which
writes in the shared memory from v4l2src it saves a video with the metadata
saying 5fps, but when I watch the video I see that the framerate keeps being
the native one...


Now the aim of this is to save the initial input in the shared memory at
native framerate in order to have eventually a real-time streaming of the
camera, but then when I save the video I would like to drop the framerate
down to 5/1 in order not to have a video which is too big. Any idea on how
to solve this? Which is the codec I should use in order to have the lowest
size for the saved video?

Thanks in advance...hoping to clarify my doubts here! 




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list