mediaview capture
Posted
#1
(In Topic #817)
Enthusiast

if it is not possible is there a control that will do this?
Posted
Guru

Posted
Guru

MediaView is limited in what it can do,
you might find something with MediaControl which is the gambas GStreamer interface
You will need to search for if it can be done with GStreamer and if yes then figure out how to get MediaControl to do the same.
Posted
Regular

Well, now I show below a simple code to capture the video - video only, no audio - played in a "MediaView" Control of the gb.media Component. From those capturated data a video file of the "Matroska" format will then be created.
The "MediaView" Control consists of "Children" and "sub-Children" (…grandchildren).
One of these "sub-Children" is a "DrawingArea", which is the Object with which the "MediaView" Control displays images and videos.
We will identify the identification number of this "DrawingArea", constitutive of the "MediaView" Control, and with a particular Property of the "ximagesrc" plugin we will capture the video it shows.
The following code is only illustrative, therefore we will capture only the video data of a video file uploaded and executed by the "MediaView" Control.
Code (gambas)
- Event Evento
- Me.Show
- Wait 0.1
- MediaView1.URL = "/path/of/media/we/want/to/capture"
- Wait 0.01
- Raise Evento
- ' ...the happy "MediaView" family:
- ob = MediaView1.Children[0]
- pn1 = ob.Children[0]
- pn2 = pn1.Children[0]
- DrawingArea1 = pn2.Children[0]
- pl = New MediaPipeline
- ' Assign to the property "xid" the "DrawingArea" identification number:
- src["xid"] = DrawingArea1.Id
- ' Set the path of final video file of mkv format (Matroska):
- snk["location"] = "/tmp/file.mkv"
- ' Link the "GStreamer" plugins:
- src.LinkTo(cnv)
- cnv.LinkTo(enc)
- enc.LinkTo(mux)
- mux.LinkTo(snk)
- pl.play
- Wait MediaView1.Duration
- Print "Video file created"
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

Let me splain…. I have gotten very pissed off with zoneminder and monitor which are used for security cameras. both are flakey and difficult to keep working. Yes zoneminder especially. I want to write a new app that works simple and reliable. this means monitoring multiple cameras for changes and recording. So please any help in this is appreciated and anybody that is giving answers please give them with this goal in mind.
Posted
Regular

I am trying to go the other way and can't seem find a way to stream out of mediaview, here what I have been working on:
Public bo As Boolean
Public Sub Form_Open()
bo = True
End
Public Sub send_Click()
Dim pl As MediaPipeline
Dim src, aco, wen, snk, rtp, udp As MediaControl
Dim flt As MediaFilter
pl = New MediaPipeline
src = New MediaControl(pl, "alsasrc")
aco = New MediaControl(pl, "audioconvert")
flt = New MediaFilter(pl, "audio/x-raw,rate=44100,depth=16,channels=2,width=16,signed=true")
rtp = New MediaControl(pl, "rtpL24pay")
udp = New MediaControl(pl, "udpsink host=192.168.3.15 port=5001")
src.LinkTo(aco)
aco.LinkTo(flt)
flt.LinkTo(rtp)
rtp.LinkTo(udp)
pl.Play()
While bo
TextBox1.Text = Str(Time(0, 0, 0, pl.Position * 1000))
Wait 0.01
Wend
pl.Stop()
pl.Close()
Quit
End
Public Sub stop_Click()
bo = False
End
Public Sub Form_Close()
bo = False
End
This is what I tested on gstreamer and it works:
'gst-launch-1.0 alsasrc ! audioconvert ! audio/x-raw,rate=48000,depth=8,channels=2,width=16 ! rtpL24pay ! udpsink host=192.168.3.15 port=5001
What is best way to do this using mediaview, as I have not found a way to get this to work?
Posted
Regular

"HOST" and "PORT" are properties of the "udpsink " GStreamer Plugin.GrantXTV said
udp = New MediaControl(pl, "udpsink host=192.168.3.15 port=5001")
Therefore they should be highlighted and separated.
……
udp = New MediaControl(pl, "udpsink")
udp["host"] = "192.168.3.15"
udp["port"] = 5001
……
If you want to use "gst-launch-1.0 ", you will have to use its corresponding external function "gst_parse_launch()", since it has not been implemented in the Gambas gb.media Component.GrantXTV said
This is what I tested on gstreamer and it works:
'gst-launch-1.0 alsasrc ! audioconvert ! audio/x-raw,rate=48000,depth=8,channels=2,width=16 ! rtpL24pay ! udpsink host=192.168.3.15 port=5001
What is best way to do this using mediaview, as I have not found a way to get this to work?
Exemplum:
https://www.gambas-it.org/wiki/index.php/Eseguire_un_file_audio_usando_una_linea_di_pipeline_con_la_funzione_%27gst_parse_launch()%27
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
1 guest and 0 members have just viewed this.


