This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Linux
I'm trying to compress video stream from camera module via gstreamer-1.0 on am5728 evm.
I found that ducati codecs, provided with sitara linux sdk is lossy, but I need in lossless video codes. As I know mjpeg is that I need
I write small program on gstreamer, that encodes stream via avenc_mjpeg and save it as avi file. But there is two problems:
1. Saved video is faster, than real situation, recording on the camera module.
2. I've checked output avi file and found, that mjpeg in libav is lossy too (mediainfo checking is attached below).
What am I supposed to do to fix those problems?
I found avenc_ljpeg, as I understand it is a lossless jpeg encoder for video, but it doesn't work in my pipeline. I's very strange because it nearly all the same that a avenc_mjpeg:
There is same src templates, and sink templates differs only one supporting format.
Working pipeline with avenc_mjpeg: gst-launch-1.0 v4l2src num-buffers=100 device=/dev/video1 ! videoconvert ! avenc_mjpeg ! avimux ! filesink location=./mjpeg-test.avi
Doesn't working pipeline with avenc_ljpeg: gst-launch-1.0 v4l2src num-buffers=100 device=/dev/video1 ! videoconvert ! avenc_ljpeg ! avimux ! filesink location=./mjpeg-test.avi
I'm also attaching result of gst-launch ljpeg pipeline.
3582.log.txt
Hello,
The both codec that you are referring are software codecs (not TI elements).
Ilya Kravchuk said:1. Saved video is faster, than real situation, recording on the camera module.
Could you try to set ....! filesink location=.... sync=true ?
Ilya Kravchuk said:Doesn't working pipeline with avenc_ljpeg: gst-launch-1.0 v4l2src num-buffers=100 device=/dev/video1 ! videoconvert ! avenc_ljpeg ! avimux ! filesink location=./mjpeg-test.avi
I would recommend:
1.try with videotestsrc element instead of v4l2src.
2.set the formats(in caps) before and after videoconvert element.
3. make sure what are the colorformat that avenc_ljpeg supports. You could check this with gst-inspect avenc_ljpeg.
BR
Margarita
I know that this codecs are not TI elements. I can't use TI codecs, provided by ducati plugin, because this codecs are lossy.
When I'm trying pipeline with videotestsrc and sync=true or sync=false param in filesink, it's okay, video isn't accelerated:
gst-launch-1.0 videotestsrc num-buffers=50 ! videoconvert ! avenc_mjpeg ! avimux ! filesink location=./mjpeg-sync.avi sync =true
When I'm trying to do it with v4l2src and sync=true or false, output video file is faster than it should be:
gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=50 ! videoconvert ! avenc_mjpeg ! avimux ! filesink location=./mjpeg-sync-v4l.avi sync =true
When I'm trying to do it with ljpeg and playing outputfile, appears only black screen. As I've seen in gst-inspect, ljpeg is all the same that mjpeg. Only one difference is that ljpeg can works with BGR, BGRA, I420, Y444, Y42B src, when mjpeg can works with I420, Y444, Y42B src only, and nothing else.
When I'm trying to set caps before and after videoconvert it throws an error, because it sets BGR format on src and sink, when it is linked with ljpeg and I420, when it is linked with mjpeg:
gst-launch-1.0 videotestsrc -v num-buffers=500 ! capsfilter caps=video/x-raw,format=YUY2 ! videoconvert ! capsfilter caps=video/x-raw,format=I420 ! avenc_ljpeg ! avimux ! filesink location=./mjpeg-caps-sync.avi sync =true
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = "video/x-raw\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ format\=\(string\)I420"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = "video/x-raw\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ format\=\(string\)I420"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = "video/x-raw\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive\,\ format\=\(string\)I420"
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "video/x-raw\,\ format\=\(string\)YUY2\,\ width\=\(int\)320\,\ height\=\(int\)240\,\ framerate\=\(fraction\)30/1\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ interlace-mode\=\(string\)progressive"
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.
Additional debug info:
../../../../gstreamer-1.6.3/libs/gst/base/gstbasesrc.c(2943): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming task paused, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
/GstPipeline:pipeline0/GstAviMux:avimux0.GstPad:src: caps = video/x-msvideo
/GstPipeline:pipeline0/GstAviMux:avimux0.GstPad:src: caps = "NULL"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = "NULL"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = "NULL"
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = "NULL"
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = "NULL"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = "NULL"
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = "NULL"
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = "NULL"
Freeing pipeline ...
Thanks for your reply, but this codec already is unsuitable, because it doesn't give enough compressing for grayscale image.