roflcoopter / viseron

Self-hosted, local only NVR and AI Computer Vision software. With features such as object detection, motion detection, face recognition and more, it gives you the power to keep an eye on your home, office or any other place you want to monitor.
MIT License
1.51k stars 155 forks source link

ffprobe in container can not finish #627

Closed freisei closed 12 months ago

freisei commented 1 year ago

Hi!

on a prticular camera ffprobe times out every time, so i get no stream.

[2023-07-06 09:00:17] [ERROR ] [viseron.components.ffmpeg.stream.k1_tor] - Retrying None in 4.0 seconds as it raised FFprobeTimeout: FFprobe command timed out after 30s.

I've played a litte bit around and found out that ffprobe only in the container behaves like this.

To ensure the same version i got the statical build from ffmpeg.org

ffprobe version N-66244-g468615f204-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)

it works fine on command-line outside of the container:

root@srvnvr:/usr/local/src/ffmpeg-git-20230621-amd64-static# ./ffprobe -analyzeduration 2000000 -hide_banner -loglevel debug -print_format json -show_error -show_streams rtsp://10.119.1.71:554/s1
{
[tcp @ 0x77240c0] No default whitelist set
[tcp @ 0x77240c0] Original list of addresses:
[tcp @ 0x77240c0] Address 10.119.1.71 port 554
[tcp @ 0x77240c0] Interleaved list of addresses:
[tcp @ 0x77240c0] Address 10.119.1.71 port 554
[tcp @ 0x77240c0] Starting connection attempt to 10.119.1.71 port 554
[tcp @ 0x77240c0] Successfully connected to 10.119.1.71 port 554
[rtsp @ 0x7721280] SDP:
v=0
o=- 1688583684669122 1 IN IP4 0.0.0.0
s=video1
i=video1
t=0 0
a=tool:LIVE555 Streaming Media v2015.04.22
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:video1
a=x-qt-text-inf:video1
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKwbGsB4AiflwFuAgICgAAB9AAAJxB0MABP/gABZ/ld5caGAAn/wAAs/yu8uFA==,aO44MA==
a=control:track1

Failed to parse interval end specification ''
[rtsp @ 0x7721280] video codec set to: h264
[rtsp @ 0x7721280] RTP Packetization Mode: 1
[rtsp @ 0x7721280] RTP Profile IDC: 64 Profile IOP: 0 Level: 28
[rtsp @ 0x7721280] Extradata set to 0x7721980 (size: 61)
[rtp @ 0x7726740] No default whitelist set
[udp @ 0x7727300] No default whitelist set
[udp @ 0x7727300] end receive buffer size reported is 425984
[udp @ 0x7726b00] No default whitelist set
[udp @ 0x7726b00] end receive buffer size reported is 425984
[rtsp @ 0x7721280] setting jitter buffer size to 500
[rtsp @ 0x7721280] hello state=0
Failed to parse interval end specification ''
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
    Last message repeated 1 times
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
[h264 @ 0x7725ec0] Format yuvj420p chosen by get_format().
[h264 @ 0x7725ec0] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0x7725ec0] Decoding VUI
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
    Last message repeated 1 times
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
    Last message repeated 1 times
[h264 @ 0x7725ec0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x7725ec0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x7725ec0] Decoding VUI
    Last message repeated 1 times
[rtsp @ 0x7721280] max_analyze_duration 2000000 reached at 2000000 microseconds st:0
Input #0, rtsp, from 'rtsp://10.119.1.71:554/s1':
  Metadata:
    title           : video1
    comment         : video1
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0, 4, 1/90000: Video: h264 (High), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 1 fps, 2 tbr, 90k tbn
[h264 @ 0x775f300] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x775f300] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x775f300] Decoding VUI
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 1920,
            "height": 1080,
            "coded_width": 1920,
            "coded_height": 1080,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuvj420p",
            "level": 40,
            "color_range": "pc",
            "color_space": "bt709",
            "color_transfer": "bt709",
            "color_primaries": "bt709",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "r_frame_rate": "2/1",
            "avg_frame_rate": "1/1",
            "time_base": "1/90000",
            "bits_per_raw_sample": "8",
            "extradata_size": 61,
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0,
                "captions": 0,
                "descriptions": 0,
                "metadata": 0,
                "dependent": 0,
                "still_image": 0
            }
        }
    ]
}

when i run the same inside the container it runs forever:

root@d9941bdf2277:/usr/local/src/ffmpeg-git-20230621-amd64-static# ./ffprobe -analyzeduration 2000000 -hide_banner -loglevel debug -print_form                                       at json -show_error -show_streams rtsp://10.119.1.71:554/s1
{
[tcp @ 0x63ef180] No default whitelist set
[tcp @ 0x63ef180] Original list of addresses:
[tcp @ 0x63ef180] Address 10.119.1.71 port 554
[tcp @ 0x63ef180] Interleaved list of addresses:
[tcp @ 0x63ef180] Address 10.119.1.71 port 554
[tcp @ 0x63ef180] Starting connection attempt to 10.119.1.71 port 554
[tcp @ 0x63ef180] Successfully connected to 10.119.1.71 port 554
[rtsp @ 0x63ec380] SDP:
v=0
o=- 1688583684669122 1 IN IP4 0.0.0.0
s=video1
i=video1
t=0 0
a=tool:LIVE555 Streaming Media v2015.04.22
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:video1
a=x-qt-text-inf:video1
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=640028;sprop-parameter-sets=Z2QAKKwbGsB4AiflwFuAgICgAAB9AAAJxB0MABP/gABZ/ld5caGAAn/wAAs/yu8uFA                                       ==,aO44MA==
a=control:track1

Failed to parse interval end specification ''
[rtsp @ 0x63ec380] video codec set to: h264
[rtsp @ 0x63ec380] RTP Packetization Mode: 1
[rtsp @ 0x63ec380] RTP Profile IDC: 64 Profile IOP: 0 Level: 28
[rtsp @ 0x63ec380] Extradata set to 0x63f0f20 (size: 61)
[rtp @ 0x63f1840] No default whitelist set
[udp @ 0x63f2480] No default whitelist set
[udp @ 0x63f2480] end receive buffer size reported is 425984
[udp @ 0x63f20c0] No default whitelist set
[udp @ 0x63f20c0] end receive buffer size reported is 425984
[rtsp @ 0x63ec380] setting jitter buffer size to 500
[rtsp @ 0x63ec380] hello state=0
Failed to parse interval end specification ''
[h264 @ 0x63f10c0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x63f10c0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x63f10c0] Decoding VUI

So what is different in the container? Or is there any other problem?

Greets Freisei

roflcoopter commented 12 months ago

I am not sure why FFprobe behavse this way for some streams sadly.

There is a workaround however, for that particular camera you can set the following config options manually and FFprobe will be skipped entirely: width, height, fps, codec and audio_codec.

If the stream does not have audio, you set audio_codec: null.