Playing multiple video using libvlc and Qt

2020-03-31 05:33发布

I have created a sample application in Qt where i have to display camera stream in a 2x2 grid. I am using libvlc to play the stream and i am able to display the video as well. But i am facing few issues

  1. Vlc is creating a separate window to render the video. Its not displayed on the area provided by Qt Application.

Here is my code

void playerView::createPlayer()
    {
        const char *const vlc_args[] = {
                  "--avcodec-hw=any",
                  "--plugin-path=C:\QtSDK\vlc-2.2.1\plugins" };

        vlcinstance = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args);

        const char* url = "rtsp://<camera ip>/cam0_0";


        /* Create a new LibVLC media descriptor */
        media = libvlc_media_new_location(vlcinstance, url);

        // Create a media player playing environement
        vlcmp = libvlc_media_player_new(vlcinstance);

        libvlc_media_player_set_hwnd(vlcmp, (void*)videodisplay->winId());
        libvlc_media_player_set_media(vlcmp, media);
        libvlc_media_player_play (vlcmp);
    }
  1. As i need to display 3 videos in a 2x2 grid, I am creating 3 vlc player instances to play the video. 2 windows are getting created and video is played. On creating the 3rd one, it crashes with the below error.

    directdraw vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) direct2d vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) Warning: option --plugin-path no longer exists. Warning: option --plugin-path no longer exists. Warning: option --plugin-path no longer exists. Warning: option --plugin-path no longer exists. Warning: option --plugin-path no longer exists. Warning: option --plugin-path no longer exists. [008ceb04] directdraw vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) [008ceb04] direct2d vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) glwin32 vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) wingdi vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) [008ceb04] glwin32 vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) [008ceb04] wingdi vout display error: Win32VoutCreateWindow RegisterClass FAILED (err=1410) core vout display error: Failed to change zoom caca vout display error: Unsupported query in vout display caca core vout display error: Failed to set on top core vout display error: Failed to change source AR [008ceb04] core vout display error: Failed to change zoom [008ceb04] caca vout display error: Unsupported query in vout display caca [008ceb04] core vout display error: Failed to set on top [008ceb04] core vout display error: Failed to change source AR core vout display error: Failed to set on top [H264 Decoder @ 0387aee0] invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [h264 @ 038b8400] decode_slice_header error [H264 Decoder @ 038fd000] invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode [038c6544] core vout display error: Failed to set on top core input error: ES_OUT_RESET_PCR called core input error: ES_OUT_RESET_PCR called [02c4264c] core input error: ES_OUT_RESET_PCR called [02c41a1c] core input error: ES_OUT_RESET_PCR called core input error: ES_OUT_RESET_PCR called [h264 @ 038c3d00] decode_slice_header error [h264 @ 038c3d00] decode_slice_header error [H264 Decoder @ 0cb12c40] invalid mixed IDR / non IDR frames cannot be decoded in slice multithreading mode [02c427b4] core input error: ES_OUT_RESET_PCR called

    Error is related to GPU and i dont have any idea how to fix this issue using libvlc. Even search doesnt help to find a right solution.

Please show me some light to proceed as i m totally stuck !!

标签: qt libvlc
0条回答
登录 后发表回答