如何反复播放rtsp流?

时间:2015-12-14 09:55:29

标签: c++ vlc rtsp libvlc

我使用下面的命令行为媒体文件构建vlc rtsp流服务器,并使用vlc sdk播放它,但播放器将在最后一帧冻结,如何让播放器重复播放rtsp netstream而不冻结?提前谢谢。

vlc -vvv test.mp4 --sout-keep --sout "#transcode{vcodec=h264,vb=0,scale=0,acodec=mp3,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://:8554/stream}"
const char * const vlc_args[] = {  "--vout",  "wingdi" };
if (m_vlcInst == NULL)
{
    m_vlcInst = libvlc_new(sizeof(vlc_args)/sizeof(vlc_args[0]), vlc_args);
}
if (m_vlcMedia == NULL)
{
    //  "rtsp://127.0.0.1:1234/vedio"
    m_vlcMedia = libvlc_media_new_location(m_vlcInst, strRtspUrl.GetBuffer());
}
if (m_vlcMplay == NULL)
{
    m_vlcMplay = libvlc_media_player_new_from_media(m_vlcMedia);
}
HWND hWndVedio = GetDlgItem(IDC_STATIC_VEDIO)->GetSafeHwnd();
libvlc_media_player_set_hwnd(m_vlcMplay, hWndVedio);
libvlc_media_player_play(m_vlcMplay);

0 个答案:

没有答案