1

I want to know the syntax or command on how I can save all frames as jpg images from my 20 mins mp4 video using GStreamer. With FFmpeg I am able to do it but not sure about gst-launch-1.0

devl
  • 19
  • 6

1 Answers1

1

Should be something along these lines:

gst-launch-1.0 filesrc location=<video_file> ! decodebin ! videoconvert ! jpegenc ! multifilesink location=%05d.jpg
Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21
  • jetson@jetson-desktop:~/Downloads$ gst-launch-1.0 filesrc location=toy_cars.mp4 ! decodebin ! videoconvert ! jpegenc ! multifilesink location=images/img%05d.jpg Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Opening in BLOCKING MODE Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 261 – devl Aug 13 '21 at 18:24
  • That sounds like a jetson specific error. Probably it wants to use a hardware decoder which is failing for some reason. – Florian Zwoch Aug 13 '21 at 18:26
  • WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter0: not negotiated Additional debug info: gstbasetransform.c(1415): gst_base_transform_reconfigure (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter0: not negotiated ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: Internal data stream error. Additional debug info: qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: streaming stopped, reason not-negotiated (-4) – devl Aug 13 '21 at 18:26
  • Do you know how I can fix it? Can you take a look please? – devl Aug 13 '21 at 18:27
  • You try setting decoder manually. Replace `decodebin` with `qtdemux ! h264parse ! avdec_h264 ! `. If the video codec is H.264. Else you need to adjust and hoe you have the decoders installed. If you want it on hardware you needs to investigate more. I dont have a jetson. – Florian Zwoch Aug 13 '21 at 18:32
  • Thanks I tried the same and it worked. Do you know how to replicate the same using CPP code of Gstreamer and Deepstream? – devl Aug 13 '21 at 18:42
  • Look at the `gst_parse_launch()` function. It is a helper to create a pipeline from these launch pipelines. For the rest check the Gstreamer tutorial. – Florian Zwoch Aug 13 '21 at 19:17
  • What if I want to extract frames from two videos simultaneously? – devl Sep 23 '21 at 18:30