Issue with filesink video writing

gotsring gotsring at live.com
Tue Feb 2 18:41:58 UTC 2021


GStreamer is not like FFMPEG in that you can't set the video format by just
typing the desired file extension. What your current pipeline is doing is
saving the raw camera data into a file, which is why the file is so large
and probably nothing can play it.

What you probably want is this:
gst-launch-1.0 v4l2src extra-controls=c, exposure_auto=1,
exposure_absolute=166 ! videoconvert ! x264enc ! h264parse ! mp4mux !
filesink location=./test.mp4 -e

Explanation:
 - v4l2src
      The source of the video, in this case from an attached webcam or
something?
 - extra-controls=c, exposure_auto=1, exposure_absolute=166
      extra parameters used by v4l2src
 - videoconvert
       I have no idea what the color format of the camera is. It could be
YUV, RGB, grayscale, etc. This says to automatically convert the color to
something that the H.264 encoder (x264enc) can use
 - x264enc
      A software H.264 encoder. If your machine has support for hardware
encoders, you can swap it out here. Just check the output of
"gst-inspect-1.0 | grep 264"
 - h264parse
      Depending on what's using the H.264 stream coming out of the H.264
encoder, it might have to be in a specific format. This tries to format it
so that mp4mux can use it. This might not be necessary.
 - mp4mux
      The muxer that puts the H.264 stream into an MP4 container file
 - filesink location=test.mp4
      The element that actually saves the data to a file on your computer
 - -e
    The option '-e' tells the command line launcher (gst-launch-1.0) to send
an EOS signal through the pipeline when you type ctrl+c. This is because the
MP4 file needs to finalize before it closes. Otherwise, you won't be able to
play the file at all. Some muxers don't require this, like matroskamux
(.mkv). You can swap mp4mux for matroskamux and get the same result,
basically.

I suggest you go through the tutorials before you do anything else. They are
available in c and python.
https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html?gi-language=c



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


More information about the gstreamer-devel mailing list