alnaseh
Posts: 48
Joined: Thu Jun 23, 2016 5:12 am

how to save camera output in mp4 format

Thu May 16, 2019 4:29 pm

Hi,

i have been trying to save the camera output with gstreamer in mp4 but facing difficulties.

the following pipeline is not working

Code: Select all

[email protected]:~ $ raspivid -n -t 0 -w 640 -h 480 -fps 8 -pf high -o - | gst-launch-1.0 -v fdsrc ! video/x-h264,width=640,height=480,framerate=8/1 ! h264parse ! splitmuxsink location=test_%03d.mp4 max-size-time=30000000000
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstFileSink:sink: async = false
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)                      8/1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)8                      /1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)8/                      1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)t                      rue, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)01640028ffe1000e2764002                      8ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0.GstGhostPad:video.GstProxyPad:proxypad0: caps = video/x-h264, width=(int)640, heig                      ht=(int)480, framerate=(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-dept                      h-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_d                      ata=(buffer)01640028ffe1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480,                       framerate=(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uin                      t)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)0                      1640028ffe1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer.GstQTMuxPad:video_0: caps = video/x-h264, width=(int)640, height=(                      int)480, framerate=(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-ch                      roma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=                      (buffer)01640028ffe1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480,                       framerate=(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(ui                      nt)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)                      01640028ffe1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0.GstGhostPad:video: caps = video/x-h264, width=(int)640, height=(int)480, framerate                      =(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, pars                      ed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)01640028ff                      e1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer.GstQTMuxPad:video_0: caps = NULL
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstFileSink:sink: location = test_000.mp4
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 6
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 7
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 8
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 9
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 10
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 11
Pipeline is PREROLLED ...
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer.GstQTMuxPad:video_0: caps = video/x-h264, width=(int)640, height=(                      int)480, framerate=(fraction)8/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-ch                      roma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=                      (buffer)01640028ffe1000e27640028ac2b40501ed00f1226a001000528ee010f2c
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 12
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 13
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 14
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 15
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 16
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 17
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 18
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 19
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 20
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 21
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 22
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 23
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 24
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 25
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 26
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 27
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 28
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 29
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 30
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstQueue:queue0: max-size-buffers = 31
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstFileSink:sink.GstPad:sink: caps = video/quicktime, variant=(string)iso
ERROR: from element /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer: Could not multiplex stream.
Additional debug info:
gstqtmux.c(4832): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer:
Buffer has no PTS.
Execution ended after 0:00:05.200177188
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
only mpegts is working but how to get mp4 from the raspivid output. another attempt is with the following:

Code: Select all

raspivid -n -t 0 -w 640 -h 480 -fps 25 -pf high -o - | gst-launch-1.0 -v fdsrc ! h264parse ! decodebin ! queue ! omxh264enc ! "video/x-h264,framerate=25" ! h264parse ! splitmuxsink location=test_%03d.mp4 max-size-time=30000000000
but also not working.

any help is appreciated. those pipelines supposed to work with specific src format but it seems not with raspivid output

Return to “Camera board”