no video in RVCamView

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

no video in RVCamView

Post by Marcin_W »

Priviet!

I write such code :

1. on click button
RVCameraInPanel.URL := 'rtsp://user:pass@my_ip:554/cam/realmonitor?channel=1&subtype=0';
RVCameraInPanel.DeviceType := rvdtRTSP;
RVCameraInPanel.VideoFormat := rvvfMP4_MPEG;

RVCamViewInPanel.VideoSource := RVCameraInPanel;
(RVCamViewInPanel.VideoSource as TRVCamera).PlayVideoStream;

2. in RVCamView component (in header) appears the URL,
the OnStartVideoStream event of the RVCamera component is triggered

3. there is no video in RVCamView, I got "No Video" prompt

4. exactly the same code works in other, test, application.
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

I have noticed, that the problematic application after executing:

Code: Select all

 (RVCamViewInPanel.VideoSource as TRVCamera).PlayVideoStream;
almost doesn't consume processor usage (about 0.3%), while the test app consume
about 10%.
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

In Delphi debug window after launching

Code: Select all

(RVCamViewInPanel.VideoSource as TRVCamera).PlayVideoStream

in problematic app:
Thread Start: Thread ID: 8772. Process Security.exe (12984)
Thread Start: Thread ID: 9540. Process Security.exe (12984)
Thread Start: Thread ID: 14972. Process Security.exe (12984)
Module Load: avformat-56.dll. No Debug Info. Base Address: $61680000. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Security.exe (12984)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Security.exe (12984)
Module Unload: swresample-1.dll. Process Security.exe (12984)
Module Unload: avcodec-56.dll. Process Security.exe (12984)
Module Unload: avutil-54.dll. Process Security.exe (12984)
Module Unload: avformat-56.dll. Process Security.exe (12984)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Security.exe (12984)
Module Unload: swresample-1.dll. Process Security.exe (12984)
Module Unload: avutil-54.dll. Process Security.exe (12984)
Module Unload: avcodec-56.dll. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Unload: avutil-54.dll. Process Security.exe (12984)
Module Load: swscale-3.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61770000. Process Security.exe (12984)
Module Unload: avutil-54.dll. Process Security.exe (12984)
Module Unload: swscale-3.dll. Process Security.exe (12984)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Unload: avutil-54.dll. Process Security.exe (12984)
Module Unload: swresample-1.dll. Process Security.exe (12984)
Module Load: avformat-56.dll. No Debug Info. Base Address: $61680000. Process Security.exe (12984)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Security.exe (12984)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Security.exe (12984)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Security.exe (12984)
Module Load: swscale-3.dll. No Debug Info. Base Address: $615F0000. Process Security.exe (12984)

In Delphi debug window after launching

Code: Select all

(RVCamViewInPanel.VideoSource as TRVCamera).PlayVideoStream

in test (working) app:
Thread Start: Thread ID: 11016. Process Project1.exe (7888)
Thread Start: Thread ID: 13812. Process Project1.exe (7888)
Thread Start: Thread ID: 15964. Process Project1.exe (7888)
Module Load: avformat-56.dll. No Debug Info. Base Address: $61680000. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Project1.exe (7888)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Project1.exe (7888)
Module Unload: swresample-1.dll. Process Project1.exe (7888)
Module Unload: avcodec-56.dll. Process Project1.exe (7888)
Module Unload: avutil-54.dll. Process Project1.exe (7888)
Module Unload: avformat-56.dll. Process Project1.exe (7888)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Project1.exe (7888)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Unload: swresample-1.dll. Process Project1.exe (7888)
Module Unload: avutil-54.dll. Process Project1.exe (7888)
Module Unload: avcodec-56.dll. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Unload: avutil-54.dll. Process Project1.exe (7888)
Module Load: swscale-3.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61770000. Process Project1.exe (7888)
Module Unload: avutil-54.dll. Process Project1.exe (7888)
Module Unload: swscale-3.dll. Process Project1.exe (7888)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Unload: avutil-54.dll. Process Project1.exe (7888)
Module Unload: swresample-1.dll. Process Project1.exe (7888)
Module Load: avformat-56.dll. No Debug Info. Base Address: $61680000. Process Project1.exe (7888)
Module Load: avutil-54.dll. No Debug Info. Base Address: $61F10000. Process Project1.exe (7888)
Module Load: avcodec-56.dll. No Debug Info. Base Address: $5E480000. Process Project1.exe (7888)
Module Load: swresample-1.dll. No Debug Info. Base Address: $63570000. Process Project1.exe (7888)
Module Load: swscale-3.dll. No Debug Info. Base Address: $615F0000. Process Project1.exe (7888)
Thread Start: Thread ID: 15204. Process Project1.exe (7888)
Module Load: MSWSOCK.dll. No Debug Info. Base Address: $74CD0000. Process Project1.exe (7888)
Thread Start: Thread ID: 13056. Process Project1.exe (7888)
Module Load: CRYPTSP.dll. No Debug Info. Base Address: $727E0000. Process Project1.exe (7888)
Module Load: RSAENH.dll. No Debug Info. Base Address: $727B0000. Process Project1.exe (7888)
Module Load: bcrypt.dll. No Debug Info. Base Address: $767B0000. Process Project1.exe (7888)
Module Load: CRYPTBASE.dll. No Debug Info. Base Address: $727A0000. Process Project1.exe (7888)
Module Load: NAPINSP.dll. No Debug Info. Base Address: $669E0000. Process Project1.exe (7888)
Module Load: PNRPNSP.dll. No Debug Info. Base Address: $669C0000. Process Project1.exe (7888)
Module Load: wshbth.dll. No Debug Info. Base Address: $67080000. Process Project1.exe (7888)
Module Load: nlaapi.dll. No Debug Info. Base Address: $669A0000. Process Project1.exe (7888)
Module Load: IPHLPAPI.DLL. No Debug Info. Base Address: $75B90000. Process Project1.exe (7888)
Module Load: DNSAPI.dll. No Debug Info. Base Address: $719E0000. Process Project1.exe (7888)
Module Load: NSI.dll. No Debug Info. Base Address: $776D0000. Process Project1.exe (7888)
Module Load: WINRNR.dll. No Debug Info. Base Address: $66990000. Process Project1.exe (7888)
Thread Start: Thread ID: 13168. Process Project1.exe (7888)
Thread Start: Thread ID: 14340. Process Project1.exe (7888)
Thread Start: Thread ID: 11756. Process Project1.exe (7888)
Thread Start: Thread ID: 15660. Process Project1.exe (7888)
Thread Start: Thread ID: 13828. Process Project1.exe (7888)
Thread Start: Thread ID: 2456. Process Project1.exe (7888)
Thread Start: Thread ID: 9156. Process Project1.exe (7888)
Thread Start: Thread ID: 10876. Process Project1.exe (7888)
Thread Start: Thread ID: 10228. Process Project1.exe (7888)
Thread Exit: Thread ID: 13168. Process Project1.exe (7888)
Thread Exit: Thread ID: 14340. Process Project1.exe (7888)
Thread Exit: Thread ID: 11756. Process Project1.exe (7888)
Thread Exit: Thread ID: 15660. Process Project1.exe (7888)
Thread Exit: Thread ID: 13828. Process Project1.exe (7888)
Thread Exit: Thread ID: 2456. Process Project1.exe (7888)
Thread Exit: Thread ID: 9156. Process Project1.exe (7888)
Thread Exit: Thread ID: 10876. Process Project1.exe (7888)
Thread Exit: Thread ID: 10228. Process Project1.exe (7888)
Thread Exit: Thread ID: 15204. Process Project1.exe (7888)
Thread Start: Thread ID: 7224. Process Project1.exe (7888)
Thread Start: Thread ID: 2364. Process Project1.exe (7888)

I see, that in problematic app some DLLs are not loaded:
MSWSOCK.dll
CRYPTSP.dll,
RSAENH.dll,
bcrypt.dll,
CRYPTBASE.dll,
NAPINSP.dll,
PNRPNSP.dll,
wshbth.dll,
nlaapi.dll,
IPHLPAPI.DLL,
DNSAPI.dll,
NSI.dll,
WINRNR.dll
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

Well, all DDLs I've described above are loaded earlier in problematic app, before start playing stream.
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

I've upgraded from version 8.0 to 8.1, did not help.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: no video in RVCamView

Post by Sergey Tkachenko »

1) Make sure that the project that works and the project that does not work have the same version of RVMedia
2) Make sure that these projects have the same bitness (32 bit / 64 bits)
3) Make sure that these projects use the same version of FFmpeg. It's better to place FFmpeg DLLs at the same folder as EXE file, and do not call LoadFFMpegLibraries to load FFmpeg from another location.
4) Make sure that bitnesses of FFmpeg DLLs and the projects are the same
5) Make sure that RVCamera in the both projects have identical property settings. Subproperties of FFmpegProperty property are especially important.
To simplify comparison, view the form's DFM as text (right click the form at design time, choose "View as Text" in the context menu, find properties of TRVCamera)
6) Make sure that you do not have event handlers that may affect the result assigned to event of TRVCamera
7) Check the events: OnLoginFailed, OnEndVideoStream, OnStartVideoStream.
Are they called? What's the value of Status parameter of OnEndVideoStream?
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

Thank you for your response.

ad. 1, 2, 3, 4, 5
Checked.

ad. 6
I've found in unit MRVType constant RV_WM_USER. I understand it is used for messages.
I've changed it to RV_WM_USER = $400 + $1D4C;, because value $400 interferes with constant in problematic app.
Unfortunately it did not help. Maybe I have to make changes in other files?

ad. 7
OnLoginFailed - is not fired neither in test (working) app nor in problematic app
OnEndVideoStream, OnStartVideo and OnStartVideoStream - are fired fired in both apps, OnEndVideoStream returns 0 in both cases
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

I forgot to mention, I use Delphi 10.4, Windows 10 64bits, both apps are 32 bits.
Maybe some project properties could make difference?
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

Unit MRVFFMPEGObject:

Code: Select all

function  TRVMFFMPEG.PlayDecode : boolean;
var
  frame_finished:      Integer;
  delay:               double;
  IsFirstFrame, DropIt: Boolean;
begin
  Result := False;

  Err := ReadFrame(FormatContext, Packet, DecCurTime);
  if (Err < 0) then
    Exit;

  try

    IsDecodeStart := False;
    if GetPacketStreamIndex(Packet) = DecVideoStreamIndex then
    begin

      frame_finished := 0;
      // Video stream packet
      DecodeVideo(VideoCodecContext, DecFrame, Packet, frame_finished);

unit MRVFFmpegSW:

Code: Select all

function GetPacketStreamIndex(pPacket: PCustomAVPacket) : Integer;
begin
  case rvFFMPEG of
    rvffmpeg_Ver1:
      Result := PAVPacket_Old(pPacket)^.stream_index;
    rvffmpeg_Ver2:
      Result := PAVPacket(pPacket)^.stream_index;
    else
      Result := PAVPacket57(pPacket)^.stream_index;
  end;
end;

In test application GetPacketStreamIndex returns PAVPacket57(pPacket)^.stream_index,
in problematic application returns PAVPacket(pPacket)^.stream_index
This causes that the condition is not met in

Code: Select all

if GetPacketStreamIndex(Packet) = DecVideoStreamIndex then
frame is not rendered, but function TRVMFFMPEG.PlayDecode always returns true
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

Sergiej, please take a look at TRVCamRTSPGetThread - looks like values width and/or height are "shifted" in memory.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: no video in RVCamView

Post by Sergey Tkachenko »

As for the condition

Code: Select all

if GetPacketStreamIndex(Packet) = DecVideoStreamIndex then
Packets received using FFmpeg may be of different stream types: video, audio, subtitles.
Normally, video has a single video stream.
RVMedia searches for the first video stream in video and plays packets only if they belong to this stream. Other packets are ignored.

Video stream index is calculated in FindFormatContextVideoStream (MRVFFmpegSW.pas)
Theoretically, video file may define several video streams, but the actual video may be not in the first stream. In this case, RVMedia will not be able to play this video (as well as many other video players).

You can debug FindFormatContextVideoStream and check the count of video streams, and the count of AVMEDIA_TYPE_VIDEO streams.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: no video in RVCamView

Post by Sergey Tkachenko »

As for TRVCamRTSPGetThread, please describe where is the problem exactly
(maybe by email, richviewgmailcom )
Marcin_W
Posts: 10
Joined: Tue Apr 27, 2021 2:03 pm

Re: no video in RVCamView

Post by Marcin_W »

Sent email to :
richview at gmail.com
Post Reply