Open cosismo opened 1 year ago
You can do this easily enough -- you instantiate a playbin
, set the video-sink
property with the element you want (or you use a gst_parse_launch()
variant), and then set the pipeline
property on the GstSyncClient
to that playbin
instance.
Solved. Thanks. TLDR; I followed your suggestion + moved to RaspOS Bullseye 64 bits with gstreamer 1.18
The detailed solution:
I added:
GstElement *sinkk = gst_element_factory_make("kmssink", "video-output");
g_object_set(G_OBJECT(self->pipeline), "video-sink", sinkk, NULL);
here: sync-client after instantiate playbin
And it works, but only ~ 1 in 10 times, usually throws a segmentation fault. Before I tried more changes, I tested the same code modification on my x86 setup and it works without problems. So I conclude that this was a raspi platform specific problem and changed my RaspOS lite Buster 32 bits gstreamer 1.14 to RaspOS Bullseye lite 64bit gstreamer 1.18.
It seems to work now.
In fact the autovideosink works with this setup, but there are a weird color problem (i believe there area swap in the reds and blues or something like that), so I use the kmssink.
Thank you very much again!
PS I have zero experience with the gst API so I ask ChatGPT for an example setting video-sink and use it with some deductions to apply an ugly AI-enabled-glue-coding. :D
Nice! Just for reference, how you might do this in the client (rather than the library code) is to change the code over here:
// Put this at the top with other declarations
GstElement *pipeline, *sink;
// Now scroll down to this line
client = gst_sync_client_new (addr, port);
// And add these lines
sink = gst_element_factory_make("kmssink", "video-output");
g_object_get (G_OBJECT (client), "pipeline", &pipeline, NULL);
g_object_set (G_OBJECT (pipeline), "video-sink", sink, NULL);
gst_object_unref (pipeline);
I tested and it works with my RPi setup. Obviously to not touch the library code is a preferred option, so I will use this solution.
Audio is not working, but I suspect that is an alsasink related problem that perhaps could be solved changing some alsa config or moving to pulseaudiosink. However for this particular project I don't need audio, so I will not go deep for now. But when I have a little more time I will check it and report it for other users.
Meanwhile, again, thanks for your work and generosity.
EDIT: Changing to Fake KMS and installing pulseaudio solves the problem with hdmi audio. (In /boot/config/txt
, replace dtoverlay=vc4-kms-v3d
with dtoverlay=vc4-fkms-v3d
)
That's good to hear -- happy to help!
I successfully play a videousing the library on x86 hardware, but failed on a Raspberry Pi 4. RaspbianOS lite Buster. (based on Debian 10 server, no gui).
I can compile and run the example with no errors, but there are not any video output I read #7 and tested gst-launch:
gst-launch-1.0 playbin uri=file:///home/pi/media/printgwmm.mp4
and it failed. But using kmmal:gst-launch-1.0 playbin uri=file:///home/pi/media/printgwmm.mp4 video-sink="kmssink"
it works.The logs for
./test-server -f pl.txt --gst-debug-level=4
are: http://sprunge.us/jYOsshI assume the library uses autovideosink and the problem is that is selecting other sink like ximagesink or glimagesink that is not working with my setup.
So my specific question is, how can I change the sink in the code? Is hardcoded? I can't find any option on the command line arguments. Or what are your recommendation?
Thanks in advance.