Can't get libvlc to play sdp file - voip

I have the following sdp file which my program generates:
v=0
c=IN IP4 192.168.0.20
t=0 0
m=audio 1235 RTP/AVP 101
a=recvonly
a=rtpmap:101 speex/16000/1
a=fmtp:101 media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)101, ssrc=(uint)3395200432, clock-base=(uint)1773032113, seqnum-base=(uint)12387
a=maxptime:20
m=video 1234 RTP/AVP 97
a=recvonly
a=rtpmap:97 H264/90000
I am certain that my server is streaming to those ports with those payload types and caps.
However, vlc does not pick up either the video or the audio.
Yet if you reverse the video and audio, like so:
v=0
c=IN IP4 192.168.0.20
t=0 0
m=video 1234 RTP/AVP 97
a=recvonly
a=rtpmap:97 H264/90000
m=audio 1235 RTP/AVP 101
a=recvonly
a=rtpmap:101 speex/16000/1
a=fmtp:101 media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)101, ssrc=(uint)3395200432, clock-base=(uint)1773032113, seqnum-base=(uint)12387
a=maxptime:20
, I pick up the video but still no audio.
Any ideas?

So, randomly stumbling on this... a heads up.
This is because the even ports are typically used for RTP and odd for RTCP. VLC uses Live555 for its backend RTP/RTCP parsing and I'm pretty sure the even/odd thing is a hardcoded situation.

Ok, so for those of you googling this. For some reason, you can only receive media on even port numbers in vlc.

Related

How to remove noise added when converting pcma/aluw file I received in RTP to wav?

This is the sdp:
v=0
o=root 807151903 807151903 IN IP4 104.154.78.142
s=Asterisk PBX 11.18.0
c=IN IP4 104.154.78.142
t=0 0
m=audio 13822 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
I'm taking all the payloads and combine them to one file using rdp-parser.
var b = p.parseRtpPacket(msg)
fs.appendFileSync("./b", b.payload)
I also tried other RTP parse libraries to be sure it's not the issue with the parser.
Then I'm running ffmpeg:
ffmpeg -f mulaw -ar 8000 -i b a.wav
Now I'm playing the file. I'm hearing my voice, and lot of noise in the background.
Why? and how to fix it?
You should use the -alaw format instead. And it will work for you.

Stream MP4 using FFMPEG on remote VLC

I'm trying to stream a MP4 file from my Embedded device and play it in the VLC in my laptop. My H/W setup look like below
-------------- ------------------
| Board | Ethernet | Window Laptop |
| (Android N)|----------------| VLC |
| 192.168.1.5| | 192.168.1.2 |
| ffmpeg | |----------------|
|------------|
I'm trying to issue ffmpeg command from board side and it look like below
Embedded board ---
./ffmpeg -re -i vid.mp4 -vcodec copy -an -f rtp rtp://192.168.1.2:1234 -vn -acodec copy -f rtp rtp://192.168.1.2:1234
On Laptop VLC side my sdp file look like below
v=0
o=- 453271780569021 453271780586833 IN IP4 /192.168.1.5
s=Unnamed
i=N/A
c=IN IP4 /192.168.1.2
t=0 0
a=recvonly
m=video 1234 RTP/AVP 96
a=rtpmap:96 H264/90000
I don't see any stream on VLC side. I believe there is something wrong command which I couldn't figured yet. Please let me know if anyone knows how I can achieve this. By the way the video file is not limited to MP4 format , i'm open for any file format.
Thanks, Satish
Thanks for Suggestion. Actually I was able to get it working. I just modified my SDP file like below (it was simply the copy/paste the SDP content generated from ffmpeg command).
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 57.57.100
m=video 1234 RTP/AVP 96
c=IN IP4 192.168.1.2
b=AS:612
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J0LgHqkYFAX/LgDUGAQa2wrXvfAQ,KN4JyA==; profile-level-id=42E01E
m=audio 1234 RTP/AVP 97
c=IN IP4 192.168.1.2
b=AS:65
a=rtpmap:97 MPEG4-GENERIC/22050/2
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1390
Thanks, Satish

HTTP Live Stream stops playing after a while

I have a problem with streaming with ffserver. After I start ffserver and desktop-capture, everything seems to work fine.
Then I open the browser and access the output(http://localhost:8090/test1.mpeg). It
plays fine for 6-7 seconds then it stops and I have to refresh the page to get it work again. Does anyone know why that happens and how I can correct it?
Here is my ffserver.conf
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 40000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 10000K
ACL allow 127.0.0.1
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Feed>
<Stream test1.mpeg>
Feed feed1.ffm
Format mpeg
AudioBitRate 32
AudioChannels 1
AudioSampleRate 44100
VideoBitRate 300
VideoFrameRate 30
VideoSize 1280x1024
VideoCodec mpeg1video
AudioCodec libvorbis
NoAudio
StartSendOnKey
</Stream>
my desktop-capture:
ffmpeg -f x11grab -r 40 -s 800x600 -framerate 50 -i :0.0+4,529 -map 0 -codec:v mpeg1video -codec:a libvorbis http://localhost:8090/feed1.ffm
The Problem was, that the VideoBitRate was too low. I changed it to 3000 and now it runs without Problems.
now my ffserver.conf looks like this:
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 40000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 10000K
ACL allow 127.0.0.1
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
</Feed>
<Stream test1.mpeg>
Feed feed1.ffm
Format mpeg
AudioBitRate 50
AudioChannels 1
AudioSampleRate 44100
# Bitrate for the video stream
VideoBitRate 3000
VideoFrameRate 30
VideoSize 1280x1024
VideoCodec mpeg1video
AudioCodec libvorbis
NoAudio
StartSendOnKey
</Stream>

Is there anyone who can successfully run real time streaming with ffserver?

I hope to stream my video camera and audio mic. using ffserver.
ffserver says it could do such, but I just can't find any working source?
If someone knows, could you please show me how it's done?
Please refer to following links:
Simple video streaming with ffserver
Live video streaming
from Ubuntu (the link is broken)
Following is configuration of my test env:
ffserver configuration [/etc/ffserver.conf]
HttpPort 8090
RtspPort 5554
HttpBindAddress 0.0.0.0
MaxClients 1000
MaxBandwidth 10000
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 5M
</Feed>
<Stream test.mpeg4>
Feed feed1.ffm
Format rtp
VideoCodec mpeg4
VideoFrameRate 15
VideoBufferSize 80000
VideoBitRate 100
VideoQMin 1
VideoQMax 5
VideoSize 352x288
PreRoll 0
Noaudio
</Stream>
Run ffserver like following:
ffserver -d
Start video capture from web camera:
ffmpeg -r 25 -s 352x288 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm
Now you can play your stream using any rtsp client. In my example I use ffplay:
ffplay "rtsp://localhost:5554/test.mpeg4
I just tested this configuration on my laptop. And it works fine!
I also try this for video and audio but neither the video nor the sound could be established.
HttpPort 8090
RtspPort 8554
HttpBindAddress 0.0.0.0
MaxClients 1000
MaxBandwidth 10000
NoDefaults
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 5M
ACL allow 127.0.0.1
</Feed>
<Stream test>
Feed feed1.ffm
Format rtp
#VideoCodec libx264
#VideoFrameRate 25
#VideoBufferSize 80000
VideoBitRate 4000
VideoSize 1920x1080
AudioCodec aac
Strict -2
AudioBitRate 8000
AudioChannels 2
AudioSampleRate 44100
AVOptionAudio flags +global_header
</Stream>
But by adding the "Noaudio", only the video is playing. How to fix the problem؟

Snort http_inspect preprocessor will not alert to traffic

I am currently testing the Snort IDS for a project, I followed the Snort 2.9.5.3 installation guide. I am having an issue to correctly configure http_inspect so that it alerts to traffic.
The (virtual) network Snort is monitoring consists of it, an Ubuntu machine running DVWA (192.168.9.30) and a Kali Linux VM (192.168.9.20). I have created a local rule for any packet's contents of /etc/passwd. This rule has detected fragmented packets sent from the Kali VM to the DVWA VM (using file inclusion)
I believe I have configured the http_inspect to generate alerts for URL encoding, multiply slashes and self-referencing (see below). After running the evasion methods I check the terminal output from Snort and it shows that it did detect the use of these methods but it doesn't generate an alert.
snort.conf
# HTTP normalization and anomaly detection. For more information, see README.http_inspect
preprocessor http_inspect: global iis_unicode_map unicode.map 1252 compress_depth 65535 decompress_depth 65535
preprocessor http_inspect_server: server default \
http_methods { GET POST PUT SEARCH MKCOL COPY MOVE LOCK UNLOCK NOTIFY POLL BCOPY BDELETE BMOVE LINK UNLINK OPTIONS HEAD DELETE TRACE TRACK CONNECT SOURCE SUBSCRIBE UNSUBSCRIBE PROPFIND PROPPATCH BPROPFIND BPROPPATCH RPC_CONNECT PROXY_SUCCESS BITS_POST CCM_POST SMS_POST RPC_IN_DATA RPC_OUT_DATA RPC_ECHO_DATA } \
chunk_length 500000 \
server_flow_depth 0 \
client_flow_depth 0 \
post_depth 65495 \
oversize_dir_length 500 \
max_header_length 750 \
max_headers 100 \
max_spaces 200 \
small_chunk_length { 10 5 } \
ports { 36 80 81 82 83 84 85 86 87 88 89 90 311 383 591 593 631 801 818 901 972 1158 1220 1414 1533 1741 1830 2301 2381 2809 3029 3037 3057 3128 3443 3702 4000 4343 4848 5117 5250 6080 6988 7000 7001 7144 7145 7510 7770 7777 7779 8000 8008 8014 8028 8080 8082 8085 8088 8090 8118 8123 8180 8181 8222 8243 8280 8300 8500 8509 8800 8888 8899 9000 9060 9080 9090 9091 9443 9999 10000 11371 12601 34443 34444 41080 50000 50002 55252 55555 } \
non_rfc_char { 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 } \
enable_cookie \
extended_response_inspection \
inspect_gzip \
normalize_utf \
unlimited_decompress \
normalize_javascript \
apache_whitespace no \
ascii yes \
bare_byte no \
directory yes \
double_decode yes \
iis_backslash no \
iis_delimiter no \
iis_unicode no \
multi_slash yes \
utf_8 yes \
u_encode yes \
webroot no
Local rule
alert tcp any any -> 192.168.9.30 80 (msg:"Potential File Inclusion of /etc/passwd"; flow:to_server,established; classtype:attempted-recon; content:"/etc/passwd"; nocase; sid:1122; rev:1;)
Discovered the answer, more through luck. Turns out the rule I have supplied in the question needed a slight modification over the snort.conf file. The 'content' field needed to be changed to 'uricontent'. With this modification the http_inspect pre-processor will examine the URI field of any packets examined.
Click here for more detail

Resources