Set Quality of vpuenc mjpg?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Any patch is available to achieve various bitrates with mjpeg codec? I've tried with unit test program, file size remains the same. Any suggestions for this? I'm using gstreamer-0.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is really holding me up. Is it or is it not impossible to adjust qualityof MJPEG encode? I can't stream somewhere between 5 and 30mbps 720p depending on the image. I need a semi-constant bitrate. I tried VBR and CBR (0 and 1) I tried quantParam and bitRate and nothing changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
iisue was elevated to app team and below feedback from experts:
----------------------------------------
You only have access to few parameters listed when you use
$ gst-inspect vpuenc
make sure you focus on one gst only (gst1.0 OR gst0.1)
If you find some supported command line which produces inconscistent result, please, share here and I can work to reproduce.
Oh, another important question, BSP release version and freescale reference board?
----------------------------------------
Best regards
igor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuri,
From what I've found the bitrate and quant value to vpuenc has no effect what-so-ever for the JPEG codec, and I would assume this is simply a limitation of the codec within the vpudec firmware. It doesn't matter what version of gstreamer, gst-fsl-plugins, or vpulib I use. It appears to have the desired effect for all other codecs (MPEG4, H264, H263), just not JPEG.
If you can prove me wrong, I would be love to hear exactly what software you are using and what gst-launch pipeline you are using.
Regards,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please let me look at log of command
$ gst-inspect vpuenc
Regards,
Yuri.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuri,
# gst-inspect vpuenc
Factory Details:
Long name: VPU-based video encoder
Class: Codec/Encoder/Video
Description: Encode raw video to compressed data by using VPU
Author(s): Multimedia Team <shmmmw@freescale.com>
Rank: primary + 1 (257)
Plugin Details:
Name: vpu.imx
Description: VPU-based video codec
Filename: /usr/lib/gstreamer-0.10/libmfw_vpu.so
Version: 3.0.11
License: LGPL
Source module: gst-fsl-plugins
Binary package: Freescle Gstreamer Multimedia Plugins
Origin URL: http://www.freescale.com
GObject
+----GstObject
+----GstElement
+----GstVpuEnc
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-raw-yuv
format: TNVP
video/x-raw-yuv
format: NV12
video/x-raw-yuv
format: I420
SRC template: 'src'
Availability: Always
Capabilities:
video/mpeg
mpegversion: 4
systemstream: false
video/x-h263
video/x-h264
image/jpeg
Element Flags:
no flags set
Element Implementation:
Has change_state() function: gst_vpuenc_state_change
Has custom save_thyself() function: gst_element_save_thyself
Has custom restore_thyself() function: gst_element_restore_thyself
Element has no clocking capabilities.
Element has no indexing capabilities.
Element has no URI handling capabilities.
Pads:
SRC: 'src'
Implementation:
Has custom eventfunc(): gst_vpuenc_src_event
Has custom queryfunc(): gst_pad_query_default
Has custom iterintlinkfunc(): gst_pad_iterate_internal_links_default
Has getcapsfunc(): gst_pad_get_fixed_caps_func
Has acceptcapsfunc(): gst_pad_acceptcaps_default
Pad Template: 'src'
SINK: 'sink'
Implementation:
Has chainfunc(): gst_vpuenc_chain
Has custom eventfunc(): gst_vpuenc_sink_event
Has custom queryfunc(): gst_pad_query_default
Has custom iterintlinkfunc(): gst_pad_iterate_internal_links_default
Has bufferallocfunc(): gst_vpuenc_alloc_buffer
Has setcapsfunc(): gst_vpuenc_setcaps
Has acceptcapsfunc(): gst_pad_acceptcaps_default
Pad Template: 'sink'
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "vpuenc0"
codec : The codec type for encoding
flags: readable, writable
Enum "vpuenc_codec" Default: 0, "mpeg4"
(0): mpeg4 - video/mpeg, mpegversion=(int)4, systemstream=(boolean)false
(5): h263 - video/x-h263
(6): avc - video/x-h264
(12): mjpg - image/jpeg
seqheader-method : (0)auto; (1)send in codec_data of caps; (2)send with first buffer; (3)always send codec_data with buffers
flags: readable, writable
Integer. Range: 0 - 3 Default: 0
timestamp-method : (0)use input buffer's timestamp; (1)use GST_CLOCK_TIME_NONE
flags: readable, writable
Integer. Range: 0 - 1 Default: 0
cbr : constant bitrate
flags: readable, writable
Boolean. Default: true
bitrate : set bit rate in bps, valid only when cbr is true, 0: auto
flags: readable, writable
Integer64. Range: 0 - 2147483647 Default: 0
gopsize : set number of frame in a gop
flags: readable, writable
Integer. Range: 1 - 2147483647 Default: 15
quant : set quant value, valid only when cbr is false: H.264(0-51), Mpeg4/H.263(1-31), -1:auto
flags: readable, writable
Integer. Range: -1 - 51 Default: -1
framerate-nu : set framerate numerator
flags: readable, writable
Integer. Range: 1 - 2147483647 Default: 30
framerate-de : set framerate denominator
flags: readable, writable
Integer. Range: 1 - 2147483647 Default: 1
force-framerate : enable force fixed framerate for encoding
flags: readable, writable
Boolean. Default: false
I see nothing above that tells me that MJPG doesn't support varied bitrates (it does seem to indicate perhaps that quant isn't support for MJPG).
So again, I ask the simple question: Does gst-fsl-plugins vpuenc support a quality/bitrate property that ultimately varies the outputted framesize and if not where is the limitation? From my testing vpuenc supports varying bitrate/quant to produce output frames that vary in size for other codes so I believe this is a limitation of the vpu firmware itself.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like gstreamer 0.10 is used in the case.
Would You please use only gstreamer 1.0 ?
We have been suggested by multimedia team to only
use gstreamer 1.0 because they are going to finish the
gst0.1 support.
Regards,
Yuri.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuri,
The same behavior occurs with gst1.0.
I feel like we are going in circles here. If you feel that the MJPG vpuenc codec with gst-fsl-plugins really does allow variable bitrate support as seems to be indicated by all documentation I've read, please show me exactly what gstreamer pipeline and software versions you are using and demonstrate to me that it works (your choice of software, your choice of hardware - I'll figure out the differences if I have a known good scenario to work from).
Regards,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please see the last message from MM team
For vpu mjpeg encoder, customer need to set related parameter table to adjust the quality.
Related api includes:
encop.EncStdParam.mjpgParam.mjpg_qMatTable=...
vpu_EncOpen(&handle, &encop);
There is already one default table in freescale's vpu unit test, customer can adjust the quality through scaling it.
Customer can refer to jpeg specification for more details.
So, if one needs to have this setup via gstreamer, they can change its source code.
The unit tests and the VPU user guide can help here.
Unfortunately, it looks like we have an pointless plugin parameter, however, in other hand,
the parameter is already there, customers decide if they need to implement it and how.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am facing the same challenge as you guys do. Trying to stream JPEGs (MJPEG) over UDP, but JPEG frames are too big and thus being dropped by the udpsink.
Please clarify: The parameters aren't implemented in gst-fsl-plugin level or in VPU firmware level?
If the new implementation should be in firmware level, would it be about changing/recompiling the /lib/firmware/vpu/vpu_fw_imx6d.bin?
I am a Linux software developer and I must say that this is really frustrating for me since this kind of development is out of my scope and is blocking my progress.
Does anyone have any patch or something that can help to control the JPEG compression?
Thanks,
Yechiel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yechiel,
Correct - gst-fsl-plugins does not implement the ability to alter the JPEG quality. The 'fix' would need to go into the vpulib by adding multiple quantization tables and selecting one based on the quality parameter passed up through the plugin.
This feature is also missing from the gstreamer-imx plugins (which I feel are a much better solution for IMX6 IPU/VPU/GPU hardware acceleration in Gstreamer) but again, its not really an issue with the plugins but the wrapper around the VPU that they use.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim, hello !
Looks like the quality parameters do not work for MJPG, I will inform
the team about it.
Regards,
Yuri.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In order to control size of JPEG stream one can use compress ratio:
For VBR(bitRate=0): user can set proper 'quantParam' value to control the quality
less value, better quality, higher bitrate.
For CBR(bitRate>0): user can set proper 'bitRate' value to control the quality
higher value, better quality.
Have a great day,
Yuri
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuri,
This appears to not work using gst-fsl-plugin (4.0.3 or earlier 3.0.11) and can be shown via the following pipelines:
gst-launch videotestsrc num-buffers=1 ! vpuenc codec=mjpg cbr=false bitrate=0 quant=10 ! filesink location=/tmp/test.jpg && ls -l /tmp/test.jpg # yeilds a 9315 byte file every time
gst-launch videotestsrc num-buffers=1 ! vpuenc codec=mjpg cbr=true bitrate=100 quant=10 ! filesink location=/tmp/test.jpg && ls -l /tmp/test.jpg # yeilds a 9315 byte file every time
It doesn't seem to matter what params I provide for cbr, bitrate, or quant - it always results in a 9315 byte file
Tim
partner
gateworks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried bitrate in the gst-launch-0.10 however it didn't change the datarate. Is this only available through the library?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
bump? I've tried bitrate and quant and neither affected the bitrate of the stream.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bump?