0

I'm trying to save multiple files in RAW format (PGM) from a video source by using Gstreaamer. By reading thanks to the gst-inspect tool the differents sources and sinks available for the differents plugins that I use, I can't find the right way to achieve my goal. I use mfw_v4lsrc for the source video, ffenc_pgm to encode and filesink to save the file.

this is my command line: gst-launch mfw_v4lsrc device=/dev/video0 name=source ! video/x-raw-yuv, width=250, height=250 ! ffenc_pgm ! filesink location=test.pgm

I stay stuck with could not link source to ffenc_pgm.

I'm able to obtain a live and save in jpeg. But for my goal, I need your help.

Thanks

deletMe
  • 65
  • 2
  • 9

2 Answers2

0

It can either be because your source element can't produce a format that ffenc_pgm expects (it seems only to want grayscale formats) or because of the 250x250 resolution restriction you imposed that, again, your source element might not be able to produce.

You can try adding converters to help there:

gst-launch mfw_v4lsrc device=/dev/video0 name=source ! videoscale ! video/x-raw-yuv, width=250, height=250 ! ffmpegcolorspace ! ffenc_pgm ! filesink location=test.pgm

also, you might want to replace filesink with multifilesink if what you want is one file per buffer, filesink will create a single file. I'm not aware of how pgm files work so I can't advise on that.

One last tip: please move to gstreamer 1.x series, 0.10 is obsolete and unmantained for 3+ years.

thiagoss
  • 2,034
  • 13
  • 8
0

Ok,

By using this :

gst-launch -v mfw_v4lsrc device=/dev/video0 num-buffers=9 ! ffmpegcolorspace ! video/x-raw-gray, width=248,height=248, format=(fourcc)I420 ! ffenc_pgm ! multifilesink location="frame%d.pgm"

I've got 9 pgm files validate with xnview. However, those files are encoded with a grayscale equals to 255, but I need to encode on 1024 (2 bytes per pixel), with P5 magic number. I don't find in ffmpegcolorspace or with ffenc_pgm how to do this...

deletMe
  • 65
  • 2
  • 9
  • ffenc_pgm doesn't consider the max gray value on its sink. For this, I'm going to migrate to gstreamer-1.x as @thiagoss said. In fact, avenc_pgm (that replaces ffenc_pgm in 1.x version of gstreamer) takes care of the bpp on its sink. So it works. – deletMe Jan 19 '16 at 16:34