Before Running mediastream. C, make sure that you have compiled ortp, FFMPEG, x264, speex, msx264, and mediastream2. For details about the compilation, see my previous two articles compiling mediastreamer2 and FFMPEG.
------------------------------------------------------------------------
First, let's take a look at mediastreamer2.
This program is not implemented: Two sessions are used to simultaneously transmit video and audio.
It uses a full-duplex session to transmit video or audio. The same program runs on both the local host and remote host, and only one payload can be selected at a time.
1. Use the filter encapsulated by the mediastreamer2 library to capture the sound from the sound card, encode the sound and send it to the remote host through RTP. At the same time, it receives the RTP packet sent from the remote host and decodes it to the sound card for playback.
Filter graph:
Soundread-> EC-> encoder-> rtpsend
Rtprecv-> Decode-> dtmfgen-> EC-> soundwrite
2. Use the filter encapsulated by the mediastreamer2 library to capture the image from the camera, encode the image, and send it to the remote host through RTP (with local video preview). At the same time, it receives the RTP packet from the remote host, video Playback After decoding.
Filter graph:
Source-> pixconv-> tee-> encoder-> rtpsend
Tee-> output
Rtprecv-> decoder-> output
------------------------------------------------------------------------------
Program Command Parameters
Mediastream -- local <port> -- remote <IP: Port> -- payload <payload type number>
[-- Fmtp <fmtpline>] [-- jitter <miliseconds>]
Compile
# GCC mediastream. C-o mediastream-lmediastreamer-dvideo_enabled
Audio part:
PC1 IP: 192.168.1.44
PC2 IP: 192.168.1.45
PC1 #./mediastream -- local5010 -- remote 192.168.1.45: 6010 -- payload 110
PC2 #./mediastream -- local6010 -- remote 192.168.1.44: 5010 -- payload 110
110 refers to speex Speech Codec
Video Section:
PC1 #./mediastream -- local5010 -- remote 192.168.1.45: 6010 -- payload 102
PC2 #./mediastream -- local6010 -- remote 192.168.1.44: 5010 -- payload 102
Payload 102 refers to the h264 encoding/decoding method.
------------- The following red problem occurs ------------------------
Ortp-message-using permissive Algorithm
Ortp-error-videostream.c: no encoder available for payload 102: hashed.
Ortp-message-quality indicator:-1.000000
Solution: Compile and install msx264. Although x264 was installed before, mediastreamer2 does not know how to use x264. You must use msx264 to encapsulate x264 as an available mediastreamer2 interface.
Msx264: An H.264 plugin for mediastream2/Linphone
Final running result: the larger image Displays the remote image, and the smaller image in the lower right corner shows the local preview.