Saturday, April 26, 2008

ffmpeg rtp and rtcp audio video problem

if I am sending audio and vide thru ffmpeg, I got flickering in the video;
the reason is ffmpeg video 4999 audio 5000
But I am not getting proper audio at client side; I got some glitches .
Reason :
---------------
1.we have to choose the even number of rtp port;rtcp packets will be sent by the ffmpeg ( rtp port + 1) = rtcp port number;
2. rtp video is sent in 4999 and ffmpeg will send the rtcp info at 5000
3.At the same time ffmpeg will sends audio at RTP port 5000 and RTCP at 5001;
4.So FFMPEG is sending the RTP and RTCP packets in a same Port that is 5000;

Labels: , ,

Friday, April 18, 2008

Audio and Video Port Problem in Audio Testing

RTP AMRTesting :
=================
1.I combined the multiple RTP packets in to a Single packet and passed it to the AMR Paser application;
2.Next added the AMR file extension and AMR start codes and try to play it with QT Player;
Created AMR file is wroking with QT Player; It is working.

3.Pls kindly check the Market Bit of the RTP header format;

if we are sending the audio and video thru INVC transcoder,I printed the RTP packet Number as follows:
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 60, Buffer size = 1389, Marker = 0
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 61, Buffer size = 1389, Marker = 0
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 62, Buffer size = 1389, Marker = 0
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 6, Buffer size = 28, Marker = 128
RTP packet Number = 63, Buffer size = 1389, Marker = 0

ffmpeg sends amr audio to RTP.I got the following:
RTP packet Number = 3, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 3
RTP packet Number = 4, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 4
RTP packet Number = 5, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 5
RTP packet Number = 6, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 6
RTP packet Number = 7, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 7
RTP packet Number = 8, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 8
RTP packet Number = 9, Buffer size = 1389, Marker = 0 HSB = 0 , LSB= 9


while sending audio and video we have the problem;One more thing if we send audio and video, QuickTime player is able to render the audio.


So without the packet number we need to do parsing;
Every Audio Frame Beginning is marked by the Marker bit as Zero;otherwise it will be 1 or TRUE;
If I developed the amr parser for this scenario, It causes the Screech Sound in audio with particular interval.At client side, I received the RTP packets and Dumped it into a file also givesthe same problem;

Solution:
-----------------

Finally I got the Solution:
we are sending video data at 5000 Port We are sending audio data at 5001 Port ;So it causes the problem;
Instead of it If I changed the things as
video as 4500 and Audio as 5000 means there will be no problem So Every RTP amr packet is having header Info;
For Audio and video There must be some difference.So that we can avoid this situation;

Labels: , ,

Monday, February 18, 2008

ffmpeg rate emulation for realtime streaming

we sent the MPEG4 Encoded data thru ffmpeg in a RTP stream.At receiver side, we are not getting the correct number of frames.( Sequence Number of the Frames highly differ).
Like After the RTP Packet (Sequence) number 1526, I got the number as 3600 or something.
ffmpeg sends the Entire data at with 5 minutes( which can be streamed around 30 mins).So there might be the chance for TCP/IP stack overflow. It may causes some packet loss.
(Real Time) if we are sending the video data as same as stream time,then there will be no packet loss. So we send the data to RTP stream using rate emulation ( -re ) command in ffmpeg.
Eventhough we are sending data with this one, we got the packet loss problem.
Check it with the Ethreal packet capture.
Capture RTP packets using Ethreal and RTP stack application at the same time.

Labels: ,

Monday, February 11, 2008

ffmpeg Command To convert the audio to mp2

ffmpeg Command To convert the audio to mp2 :
-------------------------------------------------
ffmpeg -i "D:\Media\Vel1.mpg" -vn -acodec mp2 -ac 1 -ar 22050 -ab 64k "D:\Media\vel1.mp2"

while opening the MP2 file in aGraphEdit , I got the following :

Vel1.mp2 -> MPEG-1 Stream Splitter (Audio)-> MPEG Audio Decoder -> Default Directsound Device.

By Default all the filters are available in Dshow as In-built.

Labels: ,

Thursday, January 24, 2008

ffmpeg RTP streaming


ffmpeg -vcodec mpeg4 -i D:\Media\vel1.mp4 -an -s 176x144 -vcodec rawvideo -f rtp rtp://127.0.0.1:5000/

while running this in a commandline, we got the following things in ffmpeg command informations.


I copied the following things in a rawvideo.sdp file and opened it in a
QuickTime player. Now the video is playing.


SDP:( this content will be generated by ffmpeg)
--------
v=0
o=- 0 0 IN IPV4 127.0.0.1
t=0 0
s=No Name
a=tool:libavformat
c=IN IP4 127.0.0.1
m=video 5000 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1




Labels: ,

Thursday, January 03, 2008

Capture video and audio from devices and send it to RTP Stream

Capture video and audio from devices and send it to RTP :

1.I installed the cygwin in windowsXP.
2.I copied the FFMPEG with .exe
3. I connected the webcam,microphone in my pc.
4. I run this command in cygwin shell as follows :

$ ./ffmpeg -v 100 -f vfwcap -s "640x480" -i /dev/video0 -vcodec mpeg4 -f rtp rt
p://127.0.0.1:8090 -f audio_device -i /dev/dsp -acodec mp2 -f rtp rtp://127.0.0
.1:9090 2>&1 | tee ffmpeg_log_win32.txt


./ is the standard for running .exe files in cygwin shell.


we can switch over to drive using the following command:

cd D:
cd C:
we have to run the ffmpeg from the directory at which the it is being installed.


I opened the .sdp file in a QuickTime player.
After buffering the quicktime player shows the data.
SDP stands for Session Description Protocol.
.SDP file content is as follows :



v=0
o=- 0 0 IN IPV4 127.0.0.1
t=0 0
s=No Name
a=tool:libavformat
c=IN IP4 127.0.0.1
m=video 8090 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1
m=audio 9090 RTP/AVP 14
a=rtpmap:14 MPA/90000

I used the DS Network receiver to receive data from the specified port.
(8090) and using Dump Filter, I dumped the data in to a file.
FFMPEG transmits the data in Transport Stream format.
Our MPEG4 Encoder and decoders are in Program Stream.

Labels: , ,

Capture video and audio from devices and send it to RTP Stream

Capture video and audio from devices and send it to RTP :

1.I installed the cygwin in windowsXP.
2.I copied the FFMPEG with .exe
3. I connected the webcam,microphone in my pc.
4. I run this command in cygwin shell as follows :

$ ./ffmpeg -v 100 -f vfwcap -s "640x480" -i /dev/video0 -vcodec mpeg4 -f rtp rt
p://127.0.0.1:8090 -f audio_device -i /dev/dsp -acodec mp2 -f rtp rtp://127.0.0
.1:9090 2>&1 | tee ffmpeg_log_win32.txt


./ is the standard for running .exe files in cygwin shell.


we can switch over to drive using the following command:

cd D:
cd C:
we have to run the ffmpeg from the directory at which the it is being installed.


I opened the .sdp file in a QuickTime player.
After buffering the quicktime player shows the data.
SDP stands for Session Description Protocol.
.SDP file content is as follows :



v=0
o=- 0 0 IN IPV4 127.0.0.1
t=0 0
s=No Name
a=tool:libavformat
c=IN IP4 127.0.0.1
m=video 8090 RTP/AVP 96
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1
m=audio 9090 RTP/AVP 14
a=rtpmap:14 MPA/90000

I used the DS Network receiver to receive data from the specified port.
(8090) and using Dump Filter, I dumped the data in to a file.
FFMPEG transmits the data in Transport Stream format.
Our MPEG4 Encoder and decoders are in Program Stream.

Labels: , ,