[Feature request] Record video with GStreamer using a callback. #1
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
java-gi/examples#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello,
is there any plan of adding some extensive examples with GStreamer?
A good examples could be recording the screen with GStreamer using a callback.
The libs seems so cool but it's a bit hard to use without proper examples :)
Thanks
Davide
Hi Davide,
That would certainly be a cool example (though supporting multiple operating systems and windowing systems (Xorg/Wayland) would probably go a bit too far).
I'm currently working on a few other things though, but I'll keep it in mind.
Regards,
Jan-Willem
@jwharm thanks for the answer and for considering my "feature request".
Please take in mind that GStreamer uses the same interfaces for screen capture on Windows, Linux and Mac.
This are some examples on Windows and Linux.
Windows
./gst-launch-1.0 d3d11screencapturesrc ! d3d11convert ! d3d11download ! autovideosinkLinux
./gst-launch-1.0 ximagesrc ! videoscale ! videoconvert ! autovideosinkas you can see the pipelines are a bit different but the interface from the bindings should be identical.
@sblantipodi I added a "screen recorder" example with a pipeline that contains a Tee that splits the stream into a Vorbis encoder and saves to file, and a second stream that goes to an AppSink that allows you to do custom operations on the stream data.
It is currently in the "screen-recorder" branch:
https://github.com/jwharm/java-gi-examples/tree/screen-recorder
If you clone the java-gi-exapmles repo, checkout the "screen-recorder" branch, navigate to the
ScreenRecorderfolder and rungradle runthe app should record 5 seconds of screentime, and display an asterisk every time a buffer sample is received in the appsink callback function.Hope this helps
hi @jwharm, this is a great news, thanks for creating this example.
I can't wait to explore this bindings... it looks awesome.
I am trying to gradle run the software but it seems that it can't find the gstreamer lib even if it is installed.
do you have any suggestion? thanks!
The library
libgstreamer-1.0.socannot be found in the library path.If you're on a Debian/Ubuntu based distribution, can you please run the following command and let me know the output:
ls /lib/x86_64-linux-gnu/libgstreamer-1.0.so* -lOr if you're on Fedora, please run:
ls /lib64/libgstreamer-1.0.so* -lOr if you're using Arch:
ls /usr/lib/libgstreamer-1.0.so* -lAlso, the following info might be useful:
ldd /usr/bin/gst-launch-1.0@jwharm
I'm using Ubuntu 23.04
this is the output of the commands:
@sblantipodi Java-GI expects the soname
libgstreamer-1.0.so, without the.0extension. I will log an issue to change the library loader to consider the.0soname; in the meantime, you can create a symlink as a workaround:Let me know if you encounter other issues!
@jwharm
done it but same error
I reproduced the issue on an Ubuntu install.
It seems that the folder
/lib/x86_64-linux-gnuis not on the Java library path by default.I added it to the Java library path in the
build.gradlewith the-Djava.library.path=option.Change this block:
To this:
Be aware that every example has its own
build.gradlefile, so if you want to run the other examples, you will have to change their build files too.Afterwards, there were a bunch of missing dependencies. I solved that by installing all packages that are listed on this page under the "Install GStreamer on Ubuntu or Debian" header.
After that, it worked for me.
Let me know if it works!
hi @jwharm thanks for the answer and for the awesome work here...
it's amazing how new this binding is and what great results you achieved here...
in this way it works, I'm going to explore this binding in depth, so please expect some questions :)
are you considering to support Windows too?
the corresponding ximagesrc for windows is d3d11screencapturesrc
Just create a d3d11screencapturesrc Element and use it instead of the ximagesrc.
this is a very greats news, I need some days to try it out because I'm very busy this period but I can't wait to find out more about this bindings... I'll report back if I find any problems... thank you for your great work.
OK, I will keep the issue ticket open for now.
Hi @jwharm,
I am trying to run the screenrecorder demo on Windows 11.
When I run the gradlew.bat I have this output:
what I am doing wrong?
Try
gradlew.bat run@jwharm
should I use a different gradle version?
No, the line "One element could not be created. Exiting" is printed from the example app, so gradle is working fine.
You might have to change that piece of code to find out which element exactly is null, and continue from there.
@sblantipodi I've setup a matrix room: #java-gi:matrix.org. If you want, you can contact me there.
I'm closing this issue; if there are any other questions or issues, please log a new issue.