I have a simple GStreamer pipeline that I instantiate through OpenCV VideoWriter
LOG_INFO("Opening VP8 GStreamer writer object at "
<< host << ":" << port << " with " << horizontal_resolution
<< "x" << vertical_resolution << "p#" << fps << "fps"
<< "(color=" << is_color << ")");
const std::string filename{
" appsrc is-live=true ! videoconvert ! "
" vp8enc cpu-used=2 threads=2 min_quantizer=5 max_quantizer=5 deadline=100000 ! "
" rtpvp8pay ! application/x-rtp,media=video,encoding-name=VP8,payload=96 ! "
" udpsink host= " + host + " port= " + port
};
writer.open(
filename,
cv::CAP_GSTREAMER,
fps,
cv::Size{horizontal_resolution, vertical_resolution},
is_color
);
On my host machine it runs smoothly but when I cross-compile and run on the target I get the following:
Opening VP8 GStreamer writer object at 127.0.0.1:8004 with 160x120p#30fps(color=true)
0:00:00.003785000 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "appsrc"!
0:00:00.003901750 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "appsrc"
0:00:00.003951125 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "videoconvert"!
0:00:00.003972875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "videoconvert"
0:00:00.003998375 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=#(nil)]
0:00:00.004042250 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "vp8enc"!
0:00:00.004070875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "vp8enc"
0:00:00.004105500 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=#(nil)]
0:00:00.004135750 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "rtpvp8pay"!
0:00:00.004160250 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "rtpvp8pay"
0:00:00.004186875 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=#(nil)]
0:00:00.004309875 3484 0xe7e0ac0 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "udpsink"!
0:00:00.004336375 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "udpsink"
0:00:00.004364125 3484 0xe7e0ac0 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=#(nil)]
(EXE:3484): GStreamer-CRITICAL **: gst_debug_log_valist: assertion 'category != NULL' failed
** (EXE:3484): CRITICAL **: gst_app_src_end_of_stream: assertion 'GST_IS_APP_SRC (appsrc)' failed
My Yocto configuration file is the following, target platform is a i.MX8M Mini.
require conf/distro/include/yocto-uninative.inc
MACHINE ??= "e0219"
UBOOT_CONFIG ??= "sd"
UBOOT_CONFIG[sd] ??= "e0219_config"
#MACHINE ??= 'imx8mmevk'
DISTRO ?= 'fsl-imx-xwayland'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
CONF_VERSION = "1"
DL_DIR ?= "${BSPDIR}/downloads/"
CORE_IMAGE_EXTRA_INSTALL += " net-tools iputils dhcpcd"
CORE_IMAGE_EXTRA_INSTALL += " openssh nano python3 ethtool i2c-tools strace spitools"
CORE_IMAGE_EXTRA_INSTALL += " tcpdump socat opencv libmicrohttpd libsrtp curl boost"
CORE_IMAGE_EXTRA_INSTALL += " nmap python-djangorestframework net-snmp"
CORE_IMAGE_EXTRA_INSTALL += " openmp llvm"
ACCEPT_FSL_EULA = "1"
If I understand this correctly the opencv recipe should require gstreamer and some of its plugins but it seems to me that, after the build, GStreamer can't find the needed plugins to run the pipeline. Here's the output of gst-inspect:
$ gst-inspect-1.0
coreelements: capsfilter: CapsFilter
coreelements: concat: Concat
coreelements: dataurisrc: data: URI source element
coreelements: downloadbuffer: DownloadBuffer
coreelements: fakesrc: Fake Source
coreelements: fakesink: Fake Sink
coreelements: fdsrc: Filedescriptor Source
coreelements: fdsink: Filedescriptor Sink
coreelements: filesrc: File Source
coreelements: funnel: Funnel pipe fitting
coreelements: identity: Identity
coreelements: input-selector: Input selector
coreelements: output-selector: Output selector
coreelements: queue: Queue
coreelements: queue2: Queue 2
coreelements: filesink: File Sink
coreelements: tee: Tee pipe fitting
coreelements: typefind: TypeFind
coreelements: multiqueue: MultiQueue
coreelements: valve: Valve element
coreelements: streamiddemux: Streamid Demux
staticelements: bin: Generic bin
staticelements: pipeline: Pipeline object
Total count: 2 plugins, 23 features
How can I solve this?
Update 2 using #Subrata suggestion
I added the packages suggested by #Subrata to my local.conf like so:
CORE_IMAGE_EXTRA_INSTALL += " gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav"
And now can see 179 plugins through gst-inspect.
Launching my application I'm still missing an element, but it's a step in the right direction.
Opening VP8 GStreamer writer object at 127.0.0.1:8004 with 160x120p#30fps(color=true)
0:00:00.053317750 3520 0x16290b00 WARN GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "vp8enc"!
0:00:00.053537875 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "vp8enc"
0:00:00.053606125 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no sink [source=#0x16293290]
0:00:00.057937500 3520 0x16290b00 ERROR GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=#0x162a0250]
0:00:00.081852625 3520 0x1629f720 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:<appsrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Try reinstalling the gstreamer packages like gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly and gstreamer1.0-libav.
Following packages will provide: gstreamer1.0-audiosink, gstreamer1.0-audiosource, gstreamer1.0-videosink, gstreamer1.0-videosource, gstreamer1.0-visualization
libav have elements for encoding 40+ formats (MPEG, DivX, MPEG4, AC3, DV, ...), decoding elements for decoding 90+ formats (AVI, MPEG, OGG, Matroska, ASF, ...).
To complete the answer of #Subrata:
You need to install the package corresponding to the elements requiered by gstreamer.
I don't know which Yocto version you are using but you can see which gstreamer elements are installed by default on gstreamer. In the meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good.inc file:
PACKAGECONFIG ??= " \
${GSTREAMER_ORC} \
${#bb.utils.filter('DISTRO_FEATURES', 'pulseaudio x11', d)} \
cairo flac gdk-pixbuf gudev jpeg libpng soup speex taglib v4l2 \
"
[...]
PACKAGECONFIG[vpx] = "--enable-vpx,--disable-vpx,libvpx"
Now you are required vp8enc, included in vpx library, but, as you can see, the PACKAGECONFIG variable does not contains this option.
You need to add a .bbappend file with this option added to use this plugin, in your meta :your-meta/repices-multimedia/gstreamer/gstreamer1.0-plugins-good_%.bbappend
PACKAGECONFIG_append=" vpx"
If you plan to write a recipe which needs this vpx element, you can add it in the RDEPENDS:
DEPENDS=" gstreamer1.0 gstreamer1.0-plugins-good"
RDEPENDS_${PN}=" gstreamer1.0 \
gstreamer1.0-plugins-good-vpx "
Related
In my Ubuntu 20.04 machine I have installed gstreamer following the official docs at https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c
Then I have installed the following:
$ sudo apt install va-driver-all gstreamer1.0-vaapi
But when I tried to use the vaapih265enc, the pipeline fails:
$ export GST_VAAPI_ALL_DRIVERS=1
$ gst-launch-1.0 filesrc location=output.mp4 ! h264parse ! vaapih264dec ! vaapih265enc rate-control=cbr bitrate=5000 ! video/x-h265,profile=main ! h265parse ! filesink location=output2.mp4
WARNING: erroneous pipeline: no element "vaapih265enc"
If I inspect the plugin, the output shows as:
$ gst-inspect-1.0 vaapi
Plugin Details:
Name vaapi
Description VA-API based elements
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so
Version 1.16.2
License LGPL
Source module gstreamer-vaapi
Source release date 2019-12-03
Binary package gstreamer-vaapi
Origin URL http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
vaapijpegdec: VA-API JPEG decoder
vaapimpeg2dec: VA-API MPEG2 decoder
vaapih264dec: VA-API H264 decoder
vaapivp8dec: VA-API VP8 decoder
vaapivp9dec: VA-API VP9 decoder
vaapih265dec: VA-API H265 decoder
vaapipostproc: VA-API video postprocessing
vaapidecodebin: VA-API Decode Bin
vaapisink: VA-API sink
vaapijpegenc: VA-API JPEG encoder
vaapih264enc: VA-API H264 encoder
11 features:
+-- 11 elements
When I grep for h265 lines in the library, I found the encoder:
$ strings /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so | grep h265
gst_h265_parser_free
gst_h265_slice_hdr_free
gst_h265_parser_parse_vps
gst_h265_parser_parse_sps
gst_h265_parser_parse_pps
gst_h265_parser_parse_sei
gst_h265_parser_identify_nalu_hevc
gst_h265_parser_new
gst_h265_parser_parse_slice_hdr
gst_h265_parser_identify_nalu_unchecked
gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal
gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
vaapih265enc
video/x-h265
video/mpeg, mpegversion=2, systemstream=(boolean)false; video/mpeg, mpegversion=4; video/x-divx; video/x-xvid; video/x-h263; video/x-h264; video/x-h265; video/x-wmv; video/x-vp8; video/x-vp9;
video/mpeg, mpegversion=2, systemstream=(boolean)false; video/mpeg, mpegversion=4; video/x-divx; video/x-xvid; video/x-h263; video/x-h264; video/x-h265; video/x-wmv; video/x-vp8; video/x-vp9;
video/x-h265, stream-format = (string) { hvc1, byte-stream }, alignment = (string) au
../../../gst/vaapi/gstvaapiencode_h265.c
gst_vaapiencode_h265_set_config
_h265_byte_stream_next_nal
_h265_convert_byte_stream_to_hvc
gst_vaapiencode_h265_alloc_buffer
video/x-h265, stream-format = (string) { hvc1, byte-stream }, alignment = (string) au, profile = (string) { main, main-10 }
../../../../gst-libs/gst/vaapi/gstvaapiutils_h265.c
gst_vaapi_utils_h265_get_chroma_format_idc
gst_vaapi_utils_h265_get_chroma_type
gst_vaapi_utils_h265_get_level
gst_vaapi_utils_h265_get_profile_idc
gst_vaapi_utils_h265_get_profile
../../../../gst-libs/gst/vaapi/gstvaapidecoder_h265.c
gst_vaapi_decoder_h265_set_alignment
gst_vaapi_decoder_h265_parse
gst_vaapi_decoder_h265_decode_codec_data
gst_vaapi_encoder_h265_get_profile_tier_level
gst_vaapi_encoder_h265_set_max_profile
gst_vaapi_encoder_h265_reconfigure
gst_vaapi_encoder_h265_reordering
gst_vaapi_encoder_h265_encode
gst_vaapi_encoder_h265_get_codec_data
gst_vaapi_encoder_h265_get_pending_reordered
../../../../gst-libs/gst/vaapi/gstvaapiencoder_h265.c
What can I do to make it available for gstreamer?
I am trying to convert a webcam on a raspberry pi to x264, but keep running into an error about an " Unsupported profile constrained-baseline".
GST_DEBUG=3 /home/pi/gst-rtsp-server/examples/test-launch "( v4l2src device=/dev/video0 ! videoconvert ! omxh264enc ! h264parse ! rtph264pay name=pay0 )"
stream ready at rtsp://127.0.0.1:8554/test
0:00:03.043939441 10314 0x75c08350 WARN v4l2src gstv4l2src.c:692:gst_v4l2src_query:<v4l2src0> Can't give latency since framerate isn't fixated !
0:00:03.044207251 10314 0x7491de30 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:<appsrc1:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.044211053 10314 0x7491de60 FIXME default gstutils.c:3981:gst_pad_create_stream_id_internal:<appsrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:03.087901354 10314 0x7491de90 ERROR omxh264enc gstomxh264enc.c:706:gst_omx_h264_enc_set_format:<omxh264enc-omxh264enc0> Unsupported profile constrained-baseline
0:00:03.087992083 10314 0x7491de90 ERROR omxvideoenc gstomxvideoenc.c:2239:gst_omx_video_enc_set_format:<omxh264enc-omxh264enc0> Subclass failed to set the new format
0:00:03.088080988 10314 0x7491de90 WARN videoencoder gstvideoencoder.c:678:gst_video_encoder_setcaps:<omxh264enc-omxh264enc0> rejected caps video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)5/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
0:00:03.092800068 10314 0x7491de90 ERROR omxh264enc gstomxh264enc.c:706:gst_omx_h264_enc_set_format:<omxh264enc-omxh264enc0> Unsupported profile constrained-baseline
0:00:03.092867411 10314 0x7491de90 ERROR omxvideoenc gstomxvideoenc.c:2239:gst_omx_video_enc_set_format:<omxh264enc-omxh264enc0> Subclass failed to set the new format
0:00:03.092942775 10314 0x7491de90 WARN videoencoder gstvideoencoder.c:678:gst_video_encoder_setcaps:<omxh264enc-omxh264enc0> rejected caps video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)5/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
0:00:03.092983764 10314 0x7491de90 WARN GST_PADS gstpad.c:4226:gst_pad_peer_query:<videoscale0:src> could not send sticky events
0:00:04.001816134 10314 0x7491de90 ERROR omxh264enc gstomxh264enc.c:706:gst_omx_h264_enc_set_format:<omxh264enc-omxh264enc0> Unsupported profile constrained-baseline
0:00:04.001956914 10314 0x7491de90 ERROR omxvideoenc gstomxvideoenc.c:2239:gst_omx_video_enc_set_format:<omxh264enc-omxh264enc0> Subclass failed to set the new format
0:00:04.002098111 10314 0x7491de90 WARN videoencoder gstvideoencoder.c:678:gst_video_encoder_setcaps:<omxh264enc-omxh264enc0> rejected caps video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)5/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
0:00:04.037642275 10314 0x7491de90 ERROR omxh264enc gstomxh264enc.c:706:gst_omx_h264_enc_set_format:<omxh264enc-omxh264enc0> Unsupported profile constrained-baseline
0:00:04.037781284 10314 0x7491de90 ERROR omxvideoenc gstomxvideoenc.c:2239:gst_omx_video_enc_set_format:<omxh264enc-omxh264enc0> Subclass failed to set the new format
0:00:04.037959303 10314 0x7491de90 WARN videoencoder gstvideoencoder.c:678:gst_video_encoder_setcaps:<omxh264enc-omxh264enc0> rejected caps video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)5/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
0:00:04.038154562 10314 0x7491de90 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:04.038222947 10314 0x7491de90 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason not-negotiated (-4)
0:00:04.038854870 10314 0x75c08350 WARN rtspmedia rtsp-media.c:1834:default_handle_message: 0x75c4e120: got error Internal data stream error. (gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:media-pipeline/GstBin:bin0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4))
0:00:04.039143357 10314 0x20b2490 WARN rtspmedia rtsp-media.c:2127:wait_preroll: failed to preroll pipeline
0:00:04.039219346 10314 0x20b2490 WARN rtspmedia rtsp-media.c:2384:gst_rtsp_media_prepare: failed to preroll pipeline
0:00:04.053306794 10314 0x7491de90 ERROR omxh264enc gstomxh264enc.c:706:gst_omx_h264_enc_set_format:<omxh264enc-omxh264enc0> Unsupported profile constrained-baseline
0:00:04.053442678 10314 0x7491de90 ERROR omxvideoenc gstomxvideoenc.c:2239:gst_omx_video_enc_set_format:<omxh264enc-omxh264enc0> Subclass failed to set the new format
0:00:04.053582781 10314 0x7491de90 WARN videoencoder gstvideoencoder.c:678:gst_video_encoder_setcaps:<omxh264enc-omxh264enc0> rejected caps video/x-raw, width=(int)1920, height=(int)1080, framerate=(fraction)5/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
0:00:04.079457589 10314 0x20b2490 ERROR rtspclient rtsp-client.c:678:find_media: client 0x2010610: can't prepare media
0:00:04.081144660 10314 0x20b2490 ERROR rtspclient rtsp-client.c:2210:handle_describe_request: client 0x2010610: no media
There isn't anything in the docs for omxh264enc about profiles that I can find:
gst-inspect-1.0 omxh264enc
Factory Details:
Rank primary + 1 (257)
Long-name OpenMAX H.264 Video Encoder
Klass Codec/Encoder/Video
Description Encode H.264 video streams
Author Sebastian Dröge <sebastian.droege#collabora.co.uk>
Plugin Details:
Name omx
Description GStreamer OpenMAX Plug-ins
Filename /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so
Version 1.14.4
License LGPL
Source module gst-omx
Source release date 2018-10-02
Binary package GStreamer OpenMAX Plug-ins source release
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstVideoEncoder
+----GstOMXVideoEnc
+----GstOMXH264Enc
+----GstOMXH264Enc-omxh264enc
Implemented Interfaces:
GstPreset
Pad Templates:
SRC template: 'src'
Availability: Always
Capabilities:
video/x-h264
width: [ 16, 4096 ]
height: [ 16, 4096 ]
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-raw
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Pad Template: 'sink'
SRC: 'src'
Pad Template: 'src'
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "omxh264enc-omxh264enc0"
parent : The parent of the object
flags: readable, writable
Object of type "GstObject"
qos : Handle Quality-of-Service events from downstream
flags: readable, writable
Boolean. Default: false
control-rate : Bitrate control method
flags: readable, writable, changeable only in NULL or READY state
Enum "GstOMXVideoEncControlRate" Default: -1, "default"
(0): disable - Disable
(1): variable - Variable
(2): constant - Constant
(3): variable-skip-frames - Variable Skip Frames
(4): constant-skip-frames - Constant Skip Frames
(-1): default - Component Default
target-bitrate : Target bitrate in bits per second (0xffffffff=component default)
flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
quant-i-frames : Quantization parameter for I-frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
quant-p-frames : Quantization parameter for P-frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
quant-b-frames : Quantization parameter for B-frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
inline-header : Inline SPS/PPS header before IDR
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: true
periodicity-idr : Periodicity of IDR frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
periodicty-idr : Periodicity of IDR frames (0xffffffff=component default) DEPRECATED - only for backwards compat
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
interval-intraframes: Interval of coding Intra frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
b-frames : Number of B-frames between two consecutive I-frames (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
entropy-mode : Entropy mode for encoding process
flags: readable, writable, changeable only in NULL or READY state
Enum "GstOMXH264EncEntropyMode" Default: -1, "default"
(0): CAVLC - CAVLC entropy mode
(1): CABAC - CABAC entropy mode
(-1): default - Component Default
constrained-intra-prediction: If enabled, prediction only uses residual data and decoded samples from neighbouring coding blocks coded using intra prediction modes
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
loop-filter-mode : Enable or disable the deblocking filter (0xffffffff=component default)
flags: readable, writable, changeable only in NULL or READY state
Enum "GstOMXH264EncLoopFilter" Default: -1, "default"
(0): enable - Enable deblocking filter
(1): disable - Disable deblocking filter
(2): disable-slice-boundary - Disables deblocking filter on slice boundary
(-1): default - Component Default
I am new to gstreamer so I could be reading this all wrong, would appreciate any ideas or feedback! Thanks!
You can change that through the SRC cap, try e.g.:
v4l2src device=/dev/video0 ! videoconvert ! omxh264enc ! video/x-h264,profile=baseline ! h264parse ! rtph264pay name=pay0
I have the following pipeline :
v4l2src -> queue -> h264parse -> avdec_h264 -> identity ->
imagefreeze(added/removed dynamically) -> glupload -> glcolorconvert ->
gltransformation -> glimagesink
I have a added a probe on the element identity srcpad.
Based, on the user-input I add or remove dynamically the element imagefreeze
Here is the pseudo code :
#show live video on rendering window till no user input
#if user_input == 1:
insert_imagefreeze #analogous to image being displayed on rendering window
#if user_input == 2:
delete_imagefreeze #resume back showing live video as before
Inserting imagefreeze is no problem, it works fine. I can observe the results that I would want to with a imagefreeze
However, after the element imagefreeze is added, the element v4l2src task goes to a paused state. Here is the info log :
0:03:39.608226968 [333m29510[00m 0x1561c00 [36mINFO [00m [00m v4l2src gstv4l2src.c:949:gst_v4l2src_create:<source>[00m sync to 0:03:39.066664476 out ts 0:03:39.375180156
0:03:39.608449406 [333m29510[00m 0x1561c00 [36mINFO [00m [00m basesrc gstbasesrc.c:2965:gst_base_src_loop:<source>[00m pausing after gst_pad_push() = eos
0:03:39.608561724 [333m29510[00m 0x1561c00 [36mINFO [00m [00m task gsttask.c:316:gst_task_func:<source:src>[00m Task going to paused.
Can anyone explain, why the source element of pipeline goes to a paused state once a new element is added to the pipeline.
And snippets from actual code :
def add_delete(self):
if ui_input_cnt = 1 #updated based on user input
self.idsrcpad = self.identity.get_static_pad("src")
self.in_idle_probe = False
self.probeID = self.idsrcpad.add_probe(Gst.PadProbeType.IDLE,self.lengthen_pipeline)
if ui_input_cnt = 2
self.probeID2 = self.idsrcpad.add_probe(Gst.PadProbeType.IDLE,self.shorten_pipeline)
def lengthen_pipeline(self,pad,info):
print("entered callback")
global pipeline
#restrict only 1 call to this callback
if self.in_idle_probe == True:
print("callback for now restricted to one call per thread")
return Gst.PadProbeReturn.OK
if self.in_idle_probe == False:
self.in_idle_probe == True
#create image freze element
self.ifreeze = Gst.ElementFactory.make("imagefreeze","ifreeze")
# increment reference
self.ifreeze.ref()
#add imagefreze to pipeline
pipeline.add(self.ifreeze)
#sync image freeze state to main pipeline
self.ifreeze.sync_state_with_parent()
#unlink identity and upload
#1.get sink pad of upload and srcpad of identity
sinkpad = self.upload.get_static_pad("sink")
srcpad = self.identity.get_static_pad("src")
print("unlinking identit srcpad - uplaod sinkpad")
if self.check_and_unlink(srcpad,sinkpad):
#2.get sink pad of imagefreeze
sinkpad = self.ifreeze.get_static_pad("sink")
#3. link identity src pad to image freeze sinkpad
print("linking identity srcpad - ifreeze sinkpad")
self.check_and_link(srcpad,sinkpad)
#4. link imagefreeze src pad to upload sink pad
#get image freeze srcpad and sinkpad of upload
srcpad = self.ifreeze.get_static_pad("src")
sinkpad = self.upload.get_static_pad("sink")
print("linking ifreeze srcpad - upload sinkpad")
if self.check_and_link(srcpad,sinkpad):
return Gst.PadProbeReturn.REMOVE
else:
print("ERORR : unlinking")
return -1
The functions check_and_link(srcpad,sinkpad) and check_and_unlink(srcpad,sinkpad), does no more than checking the src and sink pads, and then linking and unlinking accordingly.
The sink sends a EOS event, when the imagefreeze is added dynamically. This makes the pipeline go into a PAUSED state. However, why the sink receives a EOS event is still unclear, and needs further investigation. More information of the observations are provided here.
I know this question has been posted several times. But none of the solutions worked for me.
I am trying to play .wav files using gstreamer apis.
The below command plays .wav files (with or without the audioconvert):
gst-launch-1.0 filesrc location=sound.wav ! wavparse ! audioconvert ! alsasink
I have written a simple c++ code for the above command referring the GStreamer Hello world example. But it ends with "Internal data flow error". This is my code:
{
gst_init(NULL, NULL);
m_pipeline = gst_pipeline_new("audio-player");
m_fileSource = gst_element_factory_make("filesrc", "file-source");
m_parser = gst_element_factory_make("wavparse", "wav-parser");
m_sink = gst_element_factory_make("alsasink", "audio-output");
if (!m_pipeline || !m_fileSource || !m_parser || !m_sink) {
g_printerr ("One or more elements could not be created !! \n");
return false;
}
/* Set up the pipeline */
else {
/* set the input filename to the source element */
g_object_set (G_OBJECT (m_fileSource), "location", path.toLatin1().data(), NULL);
/* set a message handler on a bus */
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (m_pipeline));
gst_bus_add_watch(bus, bus_call, this);
gst_object_unref(bus);
/* add all elements into the pipeline */
gst_bin_add_many (GST_BIN (m_pipeline), m_fileSource, m_parser, m_sink, NULL);
/* link the elements together */
gst_element_link (m_fileSource, m_parser);
g_signal_connect(m_parser, "pad-added", G_CALLBACK(on_pad_added), m_sink);
}
gst_element_set_state(m_pipeline, GST_STATE_READY);
gst_element_set_state(m_pipeline, GST_STATE_PAUSED);
}
on_pad_added(GstElement *src_element, GstPad *src_pad, gpointer data)
{
GstElement *sink_element = (GstElement *)data;
GstPad *sink_pad = gst_element_get_static_pad(sink_element, "sink");
gst_pad_link(src_pad, sink_pad);
gst_object_unref(sink_pad);
src_element = NULL;
}
I even tried the solutions suggested in this link; replaced "oggdemux" with "wavparse" and "vorbisdec" with "identity" from the Gstreamer Hello World example as suggested in this link. Error I received:
0:00:00.289443936 1624 0x1234e00 WARN basesrc gstbasesrc.c:3470:gst_base_src_start_complete:<file-source> pad not activated yet
0:00:00.290993573 1624 0x1740030 FIXME default gstutils.c:3643:gst_pad_create_stream_id_internal:<wav-parser:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.291883886 1624 0x1740030 WARN wavparse gstwavparse.c:1564:gst_wavparse_stream_headers:<wav-parser> Ignoring chunk bext
0:00:00.292198262 1624 0x1740030 WARN wavparse gstwavparse.c:1564:gst_wavparse_stream_headers:<wav-parser> Ignoring chunk junk
0:00:00.305086920 1624 0x1234e00 WARN basesrc gstbasesrc.c:3470:gst_base_src_start_complete:<file-source> pad not activated yet
0:00:00.306444838 1624 0x17400c0 FIXME default gstutils.c:3643:gst_pad_create_stream_id_internal:<wav-parser:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:00.307224214 1624 0x17400c0 WARN wavparse gstwavparse.c:1564:gst_wavparse_stream_headers:<wav-parser> Ignoring chunk bext
0:00:00.307636819 1624 0x17400c0 WARN wavparse gstwavparse.c:1564:gst_wavparse_stream_headers:<wav-parser> Ignoring chunk junk
0:00:00.526277506 1624 0x17400c0 WARN wavparse gstwavparse.c:2186:gst_wavparse_loop:<wav-parser> error: Internal data flow error.
0:00:00.526495475 1624 0x17400c0 WARN wavparse gstwavparse.c:2186:gst_wavparse_loop:<wav-parser> error: streaming task paused, reason not-linked (-1)
0:00:00.527296570 1624 0x1740030 WARN wavparse gstwavparse.c:2186:gst_wavparse_loop:<wav-parser> error: Internal data flow error.
0:00:00.527439278 1624 0x1740030 WARN wavparse gstwavparse.c:2186:gst_wavparse_loop:<wav-parser> error: streaming task paused, reason not-linked (-1)
ERROR: Internal data flow error.
ERROR: Internal data flow error.
What am I missing in the code?
You get a not-linked error, some element was left unlinked.
The element is wavparse. Your code is trying to wait for it to add a pad to link it, but wavparse has an 'always' source pad, meaning that it is there since the creation of the element so you can just link it directly just like you did with your filesrc.
I wish to build a single gstreamer pipeline that does both rtp audio send and receive.
Based on the examples (few as they are) that I've found, here is my almost working code.
(the program is written in Rexx, but it's pretty obvious what is happening, I think. Here, it looks a lot like bash!). Line catenation char is comma. The "", bits just insert blank lines for readability.
rtp_recv_port = 8554
rtp_send_port = 8555
pipeline = "gst-launch -e",
"",
"gstrtpbin",
" name=rtpbin",
"",
"udpsrc port="rtp_recv_port, -- do-timestamp=true
' ! "application/x-rtp,media=audio,payload=8,clock-rate=8000,encoding-name=PCMA,channels=1" ',
" ! rtpbin.recv_rtp_sink_0",
"",
"rtpbin. ",
" ! rtppcmadepay",
" ! decodebin ",
' ! "audio/x-raw-int, width=16, depth=16, rate=8000, channels=1" ',
" ! volume volume=5.0 ",
" ! autoaudiosink sync=false",
"",
"autoaudiosrc ",
" ! audioconvert ",
' ! "audio/x-raw-int,width=16,depth=16,rate=8000,channels=1" ',
" ! alawenc ",
" ! rtppcmapay perfect-rtptime=true mtu=2000",
" ! rtpbin.send_rtp_sink_1",
"",
"rtpbin.send_rtp_src_1 ",
" ! audioconvert",
" ! audioresample",
" ! udpsink port="rtp_send_port "host="ipaddr
pipeline "> pipe.out"
If I comment out the lines after
" ! autoaudiosink sync=false",
The receive-only portion works just fine. However, if I leave those lines in place I get this error:
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2582): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-linked (-1)
So what's suddenly become unlinked? I'd understand if the error was in the autoaudiosrc portion, but suddenly showing up in the udpsrc section?
Suggestion of help, anyone?
(FWIW) After I get this part working I will go back in and add the rtcp parts or the pipeline.
Here is a pipeline that will send and receive audio (full duplex). I manually set the sources so that it is expandable(you can put video on this as well and I have a sample pipeline for you if you want to do both). I set the jitter buffer mode to BUFFER because mine is implemented on a network with a TON of jitter. Now, within this sample pipe, you could add all your variable changes (volume, your audio source, encoding and decoding etc.).
sudo gst-launch gstrtpbin \
name=rtpbin audiotestsrc ! queue ! audioconvert ! alawenc ! \
rtppcmapay pt=8 ! rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 ! \
multiudpsink clients="127.0.0.1:5002" sync=false async=false \
udpsrc port=5004 caps="application/x-rtp, media=audio, payload=8, clock-rate=8000, \
encoding-name=PCMA" ! queue ! rtpbin.recv_rtp_sink_0 \
rtpbin. buffer-mode=RTP_JITTER_BUFFER_MODE_BUFFER ! rtppcmadepay ! alawdec ! alsasink
I have had issues with the Control(RTCP) packets. I have found that a loop back test is not sufficient if you are utilizing RTCP. You will have to test on two computers talking to each other.
Let me know if this works for you as I have tested on 4 different machines and all have worked.