I have some videostreams that are H.264 which needs to be converted to
MPEG2 for instance. I think that is the media transcoding you mention
and therefore I wanted to use the libAV library. If I test this as a
standalone application besides the proxy server, it would be something like:
libvlc_instance_t *libvlc;
libvlc_media_t *m;
libvlc_media_player_t *mp;
char const *vlc_argv[] =
{
"--sout=#rtp{sdp=rtsp://192.168.1.101:5678/mjpeg/axis-media/media.amp}",
};
int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);
/* Load the VLC engine */
libvlc = libvlc_new (vlc_argc, vlc_argv);
/* Create a new item */
m = libvlc_media_new_location (libvlc,
"rtsp://192.168.1.101:1235/axis-media/media.amp");
/* Create a media player playing environement */
mp = libvlc_media_player_new_from_media(m);
/* No need to keep the media now */
libvlc_media_release(m);
/* play the media_player */
*libvlc_media_player_play(mp);*
for (int i = 0; i < 60; i++) {
printf(".");
sleep(1);
fflush(stdout);
}
/* Stop playing */
libvlc_media_player_stop (mp);
/* Free the media_player */
libvlc_media_player_release (mp);
libvlc_release (libvlc);
This works only if the original stream
(rtsp://192.168.1.101:1235/axis-media/media.amp) is already started
before the transcoded stream
(rtsp://192.168.1.101:5678/mjpeg/axis-media/media.amp) is played.
The above code needs to be integrated in my application which uses the
LIVE555 library in such a way that the user can directly play the
"transcoded camerastream"
(rtsp://192.168.1.101:5678/mjpeg/axis-media/media.amp).
Best regards,
Frank van Eijkelenburg
On 02-09-15 09:34, Ross Finlayson wrote:
I am sorry if Iitwasn't clear enough. Your suggestion is exactly what
I want to do: implement my own LIVE555 transcoding filter (based on
libAV). My confusion is about the registering of urls and where to
put the libAV play command. Do I need to register two urls: the
"normal camerastream" and the "transcoded camerastream", or should it
be enough to just use the "transcoded camerastream”?
You create (using “ProxyServerMediaSession::createNew()”) a single
“ProxyServerMediaSession” object, with the “rtsp://“ <rtsp://%93> URL
for the ‘back-end’ stream, as usual.
However, you also pass - as the last parameter to
“ProxyServerMediaSession::createNew()” - a pointer to a
“MediaTranscodingTable” object. See
“liveMedia/include/MediaTranscodingTable.hh”.
I.e., you would define your own subclass of “MediaTranscodingTable”,
and reimplement - in this subclass - the “lookupTranscoder()” virtual
function. Your “lookupTranscoder()” implementation would look
something like the following (e.g., this is what I do in my new WebRTC
demo to transcode from MPEG-4 to VP8 video):
//////////
FramedFilter*
MyMediaTranscodingTable::lookupTranscoder(MediaSubsession& inputCodecDescription, char*& outputCodecName)
{
if (strcmp(inputCodecDescription.codecName(), "MP4V-ES") == 0) {
outputCodecName = strDup("VP8");
return myMPEG4toVP8VideoTranscoder::createNew(envir(),
inputCodecDescription.readSource());
} else {
outputCodecName = NULL;
return NULL;
}
}
//////////
In this example, “myMPEG4toVP8VideoTranscoder” is a “FramedFilter”
subclass that transcodes MPEG-4 video frames to VP8 video frames. You
would write a similar “FramedFilter” subclass for whatever pair(s) of
codecs you want to transcode. And, of course, you have to implement
the transcoding yourself.
In your email, you refer to a “libAV play command”. I’m not sure what
you mean by this, but perhaps you’re referring to the fact that the
‘libAV’ library has its own RTSP client functionality. Ignore that;
it’s crap. We do all of the RTSP/RTP (at both the back and front ends
of our proxy server); you'd use ‘libAV’ (formerly FFMPEG) merely for
media transcoding. (Or, if you have some other way to do transcoding
(e.g., in hardware), then you’d use that instead.)
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel