GStreamer / Qt. Can't stream to ip I need - qt

For test I send a video via 127.0.0.1 ip and it works:
gst-launch-1.0 videotestsrc ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! udpsink host=127.0.0.1 port=10001
But when I set a specific ip, it doesn't want to receive it.
If I try to receive a video from terminal, it writes an error:
bind failed: Error binding to address 192.168.0.152:10001: Cannot assign requested address
I don't understand what's going on and what's the problem.
P.S: I'm a noob with gstreamer and maybe I do something wrong.
if it's necessary, I've tested an ip for an availability and it wasn't busy

If you need to send to an host with following IP 192.168.10.10 :
gst-launch-1.0 videotestsrc ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! rtph264pay config-interval=2 ! udpsink host=192.168.0.152 port=10001
Receiver side :
gst-launch-1.0 udpsrc uri=udp://192.168.0.152:10001 caps="application/x-rtp,media=video,encoding-name=H264,payload=96" ! rtph264depay ! decodebin ! videoconvert ! glimagesink
Best regards

Related

RTMP Nginx exec_push with alaw and h264

I have 2 RTMP servers, one NGINX with the RTMP module, and a second one that can only consume RTMP with H264 and ALAW, which will receive video from the NGINX one.
I successfully pushed my camera image to the second server using Gstreamer:
gst-launch-1.0 v4l2src device="/dev/video0" ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=20 ! flvmux name=flvmux ! rtmpsink location=rtmp://<second_server_ip>:1935/publish/foobar audiotestsrc ! alawenc ! flvmux.
Now, I need to send a video from the NGINX server to the second server, but it needs to have H264 video encoding and ALAW audio encoding.
I tried one more intermediate step, where I streamed to the NGINX server and ran
gst-launch-1.0 rtmpsrc location=rtmp://<nginx_ip>:1935/live/100 ! videoconvert ! video/x-raw,format=I420 ! x264enc speed-preset=ultrafast tune=zerolatency key-int-max=20 ! flvmux name=flvmux ! rtmpsink location=rtmp://<second_server_ip>:1935/publish/foobar audiotestsrc ! alawenc | flvmux.
but I got
Setting pipeline to PAUSED ...
pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstRTMPSrc:rtmpsrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTMPSrc:rtmpsrc0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
What am I missing in the GStreamer command? And how can I add it to the NGINX application to automatically push the streams received? I'm ok with doing it with FFmpeg if I need to.
Thank you
EDIT:
My first server will be fed with a stream from a mobile app. This server (NGINX) is configured like this:
application live {
live on;
interleave on;
}
This server should push to a second server (written in Go), which is going to convert RTMP to WebRTC so I can play the stream in a browser. As I previously stated, I have successfully streamed RTMP to the second server with GStreamer, but I want the first server to automatically push to the second, and it's that push that I been able todo yet.
EDIT 2:
I have used VLC and the encoding is H264, so no problem there. But I do need ALAW instead of MPEG AAC audio, how can I change on the NGINX server when I push it to the second server?

GStreamer/iMX6: streaming h264 encoded video over serial port between iMX6 and PC

Recently, I have started to work on a project that aims at live video streaming applications based on imx6 processors. A quick description of what I have done so far and what I am trying to do:
Setup: imx6 board(Boundary devices Sabre Lite) acting as the video server(using GStreamer imx plugins), and a PC running Ubuntu on it that receives data from imx6 and streams the video using GStreamer features.
On the imx6 processor, I run the 'testvideosrc' and have successfully streamed it using the RTP over UDP using eternet interface between the imx6 and the PC.
Accessing the serial port using the device files in Linux, next I tried out dumping the video data from imx6 board to a serial port and reading this serial port on the PC. For this, the baud rate of both devices was configured to 115200 baud. The encoding 'bitrate' is configured to 5Kbps. Here are the commands:
IMX6:
#gst-launch-1.0 -v videotestsrc pattern=18 ! video/x- raw,width=100,height=50 ! imxvpuenc_h264 bitrate=5 ! h264parse ! filesink location=/dev/ttyUSB1
PC:
#CAPS=video/x-h264
#gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 ! $CAPS ! h264parse ! avdec_h264 ! autovideosink sync=true
There are no errors observed on the imx6 board.
However, I see the following errors at the PC side:
# GST_DEBUG=3 gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 ! $CAPS ! h264parse ! avdec_h264 ! autovideosink sync=true
Setting pipeline to PAUSED …
0:00:00.066439392 15475 0x556d8a01d160 WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete: pad not activated yet
Pipeline is PREROLLING …
0:00:21.730466251 15475 0x556d8a000940 WARN capsfilter
gstcapsfilter.c:455:gst_capsfilter_prepare_buf: error: Filter caps do not completely specify the output format
0:00:21.730523691 15475 0x556d8a000940 WARN capsfilter gstcapsfilter.c:455:gst_capsfilter_prepare_buf: error: Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:21.730676173 15475 0x556d8a000940 WARN basetransform gstbasetransform.c:2159:default_generate_output: could not get buffer from pool: error
0:00:21.730742223 15475 0x556d8a000940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: Internal data stream error.
0:00:21.730775478 15475 0x556d8a000940 WARN basesrc gstbasesrc.c:3055:gst_base_src_loop: error: streaming stopped, reason error (-5)
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(455): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …
Since, the encoding rate is 5Kbps (bitrate=5, as specified in the above command), I suppose it is possible to send this amount of data via the serial port. I realize that currently, the caps negotiation fails, however, I am unsure of how to proceed with this.
On the PC side, reading the serial port with 'cat /dev/ttyUSB1' succeeds with limited data. The data is unreadable(as expected), however it is not a continuous stream.
Does anyone have an idea, on how to solve this. I also think, I am misinterpreting the usage of Linux device files, when I am attempting to read over the serial data file using GStreamer.
My later test, would be to use an actual camera(MIPI) and try streaming it over serial port. Does it seem feasible or is a completely crazy idea to do?
With the following commands, I could get this working on serial with a baud of 19200. However, the latency is very high in the range of 5-6 seconds. With a baud of 1M, it works with less noticeable latency < 1s.
imx6:
gst-launch-1.0 -v videotestsrc pattern=18 ! video/x-raw,width=100,height=50
! imxvpuenc_h264 bitrate=5 ! h264parse ! filesink location=/dev/ttyUSB0
blocksize=1024 max-bitrate=19000 sync=false
PC:
gst-launch-1.0 -v filesrc location=/dev/ttyUSB1 blocksize=1024 ! $CAPS !
h264parse ! avdec_h264 lowres=2 skip-frame=0 ! autovideosink sync=false

Wordpress Vs Fcgid - 500 internal server error

I am using wordpress application with multisite concept. Also my web hosting working with mod_fcgid as a server API. At some instances the my site getting 500 internal server error. When I looked into the error log, it shows the repeated warning errors like "[warning] mod_fcgid: stderr: PHP Warning: Creating default object from empty value in /var/www/vhosts/mywjb.com/httpdocs/wp-includes/ms-load.php on line 113". How do I resolve this problem. Can any one help?
Thanks in advance,
My Web server was working with FCGI mode. So the FCGI processing with multiple PHP requests (wordpress), and the apache logging the FCGI related errors, when the requests gets failed with FCGI.
Below is my wordpress code,
111 global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
112 if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
113 $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
.........
I have fixed this issue by shifting the server mode from FCGI to CGI.
But compared to CGI, working with FCGI only most efficient and performance boosting technology.
Thanks

How To Find Proxy is Http or Socks

Can anyone tell me how to find the proxy server is http or socks ? Is that based on port number ? how it differs ?
Thanks in advance
try it as http: curl -x http://x.x.x.x:y check-host.net/ip. if fails, try as socks: curl -x socks://x.x.x.x:y check-host.net/ip.
No, the proxy type is not based on port numbers. The ports are assigned by network admins and can be anything they want.
Your only hope is if your network is configured to use some type of proxy auto-config to provide the specific proxy details to clients when needed.
Otherwise, there is no way to query the proxy itself. You have to know ahead of time what type of proxy it is so you know how to communicate with it correctly.
Try this script:
$ cat get_version.py
#!/usr/bin/python
import struct
import socket
import sys
try:
server = sys.argv[1]
port = sys.argv[2]
except:
print "Usage: server port"
try:
sen = struct.pack('BBB', 0x05, 0x01, 0x00)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(( server , int( port ) ))
s.sendall(sen)
data = s.recv(2)
s.close()
version, auth = struct.unpack('BB', data)
print 'server : port is ', server, ':', port, '; varsion: ', version
except Exception as e:
print e

TCP States Implementation

In my networking course, I studied that there are 11 tcp states, They are as follows:
Closed
Listen
Syn_Sent
Syn_Rcvd
Established
Fin_Wait_1
Fin_Wait_2
Closing
Time_Wait
Last_Ack
Close_Wait
I don't know exactly how many of these states are actually implemented in Linux Kernel Network Architecture.
I want to write a program using system calls which can capture all these states which are implemented in Linux Kernel.
Actually i want to use socket programming and system calls for just capturing these states like :
whenever I do netstat -taupen | grep tcp , I want to see all these connection's states in the State column for the same tcp connection at different times.
Somebody give me some idea on how to program such a code.
First of all, you'll need to implement both the the client and server sides of the connection and you'll probably need to run them from an external script so that they can be passed proper parameters and / or killed at the needed times to demonstrate the various states in a way viewable from netstat. The best reference for the details of doing something like this would be Steven's Unix Network Programming. If you browser through the book and the source code ( which can be downloaded here ) you'll see examples of ways to intentionally cause various TCP connection states in an observable manner. One thing you'll want to look at is the code for non-blocking connects and also look up SO_REUSEADDR, SO_LINGER, time-wait assassination. There's no substitute for reading Steven's when it comes to a subject like this.
They are all implemented but you can only observe these with socket API calls:
Closed
Listen
Syn_Sent (non-blocking only)
Established
Fin_Wait_1 (implicit)
Fin_Wait_2 (only by trying to read and getting EOF)
Closing (non-blocking only)
Last ACK (only by trying to reuse port)
If you're not happy Inferring the state from external observation (packet tracing), then you'll have to instrument the kernel code: add some log statements in the transition code, recompile the kernel ..
/usr/src/linux-source-2.6.32/net/ipv4# head -n 250 tcp.c | grep -n "^[^a-zA-Z0-9]*TCP_" | sed "s|^.*(TCP_[A-Z0-9_]).|\1|" | while read S ; do echo -e "\n $S :" ; grep -l $S ./* | tr '\n' ' '; done ; echo
TCP_SYN_SENT :
./af_inet.c ./tcp.c ./tcp_input.c ./tcp_ipv4.c ./tcp_output.c
TCP_SYN_RECV :
./inet_connection_sock.c ./inet_diag.c ./tcp.c ./tcp_input.c ./tcp_ipv4.c ./tcp_minisocks.c
TCP_ESTABLISHED :
./datagram.c ./raw.c ./tcp.c ./tcp_input.c ./tcp_ipv4.c ./udp.c
TCP_FIN_WAIT1 :
./tcp.c ./tcp_input.c
TCP_FIN_WAIT2 :
./tcp.c ./tcp_input.c ./tcp_minisocks.c ./tcp_timer.c
TCP_CLOSING :
./tcp.c ./tcp_input.c
TCP_TIME_WAIT :
./inet_diag.c ./inet_timewait_sock.c ./tcp.c ./tcp_input.c ./tcp_ipv4.c ./tcp_minisocks.c
TCP_CLOSE_WAIT :
./tcp.c ./tcp_input.c
TCP_LAST_ACK :
./tcp.c ./tcp_input.c
TCP_CLOSE :
./af_inet.c ./inet_connection_sock.c ./inet_hashtables.c ./raw.c ./tcp.c ./tcp_cong.c ./tcp_input.c ./tcp_ipv4.c ./tcp_output.c ./tcp_timer.c ./udp.c

Resources