MathieuDuponchelle / MathieuDuponchelle.github.io

blog
1 stars 0 forks source link

How to write GStreamer (1.0) elements in python (Part 2) #3

Open MathieuDuponchelle opened 6 years ago

bao-O commented 2 years ago

I tried a pipeline from you:

gst-launch-1.0 matroskamux name=mux ! progressreport ! filesink location=out.mkv \
compositor name=comp background=black \
sink_0::zorder=1 sink_0::ypos=550 sink_1::zorder=0 ! \
videoconvert ! x264enc tune=zerolatency bitrate=15000 ! queue ! mux. \
uridecodebin uri=file:/home/meh/devel/gst-build/python-plotting.mp4 name=dec ! \
audio/x-raw ! tee name=t ! queue ! audioconvert ! audioresample ! volume volume=10.0 ! \
volume volume=10.0 ! audioplot window-duration=3.0 ! video/x-raw, width=1280, height=150 ! \
comp.sink_0 \
t. ! queue ! audioconvert ! audioresample ! opusenc ! queue ! mux. \
dec. ! video/x-raw ! videoconvert ! deinterlace ! comp.sink_1

with uridecodebin was replaced my absolute path mp4 file. But I got his error:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:dec: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:dec:
failed delayed linking some pad of GstDecodeBin named dec to some pad of GstTee named t
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:dec/GstCapsFilter:capsfilter3: not negotiated
Additional debug info:
gstbasetransform.c(1415): gst_base_transform_reconfigure (): /GstPipeline:pipeline0/GstDecodeBin:dec/GstCapsFilter:capsfilter3:
not negotiated
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:dec/GstQTDemux:qtdemux0: Internal data stream error.
Additional debug info:
qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstDecodeBin:dec/GstQTDemux:qtdemux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

What did I do wrong or something happened with my gst-python installation?

MathieuDuponchelle commented 2 years ago

Difficult to tell, you'll want to try and simplify the pipeline until it does work, that should tell you what the problem is.

bao-O commented 2 years ago

Thank for your reply. I will try minimize the pipeline and see what happened. I have one more question want to ask. Currently, I want to create a custom plugin do similar task like this, where the plugin can change output caps. I go first with this example first, but in do_transform function, when I check outbuffer size, it's was same as inbuffer, look like do_fixate_caps has no effect. Can you take a look at this example and give me an advice. I leaved an issue for the author but he had been inactive for a long time and now I'm stucking at this

MathieuDuponchelle commented 2 years ago

@DoriHp I don't know if that is what you'll want to hear, but I would recommend reading up on GStreamer tutorials and taking the time to experiment so you can get your own understanding, writing elements requires some knowledge of the framework :)

LrWm3 commented 10 months ago

Is the complete source for this article available somewhere?

I am curious how the do_generate_output call looks as I would like to take a similar approach elsewhere. I did not know about this and had to work around not knowing with how I implemented my do_transform method.

I think the full source would be a very helpful reference.

MathieuDuponchelle commented 9 months ago

@LrWm3 yes, you can find the latest version @ https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-python/examples/plugins/python/py_audiotestsrc.py?ref_type=heads

LrWm3 commented 9 months ago

I didn't read your original article very carefully, I see now the full source is available!

I actually think you meant to link this though: https://github.com/GStreamer/gst-python/blob/master/examples/plugins/python/audioplot.py

Thanks again for writing this wonderful article and helping me better understand how gstreamer works :heart:

MathieuDuponchelle commented 9 months ago

oh I thought this was part one my bad :)