저는 Gstreamer 1.0을 사용하여 RTMP를 통해 USB 웹캠 피드를 보내려고 합니다. Raspberry Pi에서 OMX h264 인코더를 사용하는 다음 작업 파이프라인이 있습니다.
gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegdec ! videoconvert ! queue ! omxh264enc ! h264parse ! flvmux ! rtmpsink location='<rtmp URL>'
내가 겪고 있는 문제는 목표 비트 전송률, 제어 속도 등과 같은 매개 변수를 인코더에 추가하면 다음 오류가 발생한다는 것입니다.
ERROR: from element /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0: Could not initialise supporting library.
Additional debug info:
gstvideoencoder.c(1627): gst_video_encoder_change_state (): /GstPipeline:pipeline0/GstOMXH264Enc-omxh264enc:omxh264enc-omxh264enc0:
Failed to open encoder
어떤 아이디어가 있나요?
편집: 구문에 문제가 있는 경우를 대비하여 매개변수가 포함된 파이프의 모습은 다음과 같습니다.
gst-launch-1.0 v4l2src device=/dev/video0 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegdec ! videoconvert ! queue ! omxh264enc target-bitrate=10000 ! h264parse ! flvmux ! rtmpsink location='<rtmp URL>
답변1
나에게 도움이 된 해결책은 을 지정하는 것이었 control-rate
으므로 내 경우에는
... ! omxh264enc target-bitrate=500000 control-rate=1 ! ...
$ 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 <[email protected]>
Plugin Details:
Name omx
Description GStreamer OpenMAX Plug-ins
Filename /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so
Version 1.0.0.1
License LGPL
Source module gst-omx
Source release date 2015-11-11 17:35 (UTC)
Binary package GStreamer OpenMAX Plug-ins git
Origin URL Unknown package origin
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstVideoEncoder
+----GstOMXVideoEnc
+----GstOMXH264Enc
+----GstOMXH264Enc-omxh264enc
Implemented Interfaces:
GstPreset
Pad Templates:
SINK template: 'sink'
Availability: Always
Capabilities:
video/x-raw
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
SRC template: 'src'
Availability: Always
Capabilities:
video/x-h264
width: [ 16, 4096 ]
height: [ 16, 4096 ]
Element Flags:
no flags set
Element Implementation:
Has change_state() function: gst_omx_video_enc_change_state
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: 'sink'
Implementation:
Has chainfunc(): gst_video_encoder_chain
Has custom eventfunc(): gst_video_encoder_sink_event
Has custom queryfunc(): gst_video_encoder_sink_query
Has custom iterintlinkfunc(): gst_pad_iterate_internal_links_default
Pad Template: 'sink'
SRC: 'src'
Implementation:
Has custom eventfunc(): gst_video_encoder_src_event
Has custom queryfunc(): gst_video_encoder_src_query
Has custom iterintlinkfunc(): gst_pad_iterate_internal_links_default
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"
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 (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