blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
17.66k stars 1.62k forks source link

[Support]: Http Api ffmpeg error : pipe:: Invalid data found when processing input #1957

Closed adminabcomtech closed 2 years ago

adminabcomtech commented 2 years ago

Describe the problem you are having

Hello,

i'm trying to get a mp4 clip from timestamp with http APi. this api endpoint is not documented, but it is implemented in that file http.py

Here's my call http://my-ip:5000/api/mast/start/1633672800/end/1633672920/clip.mp4

and the FFmpg error :

[2021-10-08 11:13:08] frigate.http                   ERROR   : ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-rkmpp --enable-libdrm --enable-v4l2_m2m --enable-neon --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
pipe:: Invalid data found when processing input

I've record in media path for that period.

Can we use that api point?

Any though about this error?

Kr,

Johan

Version

0.9.1-800F33E

Frigate config file

mqtt:
  host: my_ip
  user: mqtt_user
  password: ********
cameras:
  mast:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - h264_v4l2m2m
      inputs:
        - path: rtsp://ipcam:8557/PSIA/Streaming/channels/2?videoCodecType=H.264
          roles:
            - detect
            - rtmp
            - record
    detect:
      width: 1280
      height: 720
    objects:
      track:
        - person
        - car
    record:
      enabled: True
    rtmp:
      enabled: True
    snapshots:
      enabled: True

Relevant log output

[2021-10-08 11:18:36] frigate.http                   ERROR   : ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-rkmpp --enable-libdrm --enable-v4l2_m2m --enable-neon --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
pipe:: Invalid data found when processing input

FFprobe output from your camera

(* from another os *)

ffprobe version 4.3.2-0+deb11u2 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 10 (Debian 10.2.1-6)
  configuration: --prefix=/usr --extra-version=0+deb11u2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[rtsp @ 0x55d0e7560a00] max delay reached. need to consume packet
[rtsp @ 0x55d0e7560a00] RTP: missed 4 packets
Input #0, rtsp, from 'rtsp://10.1.24.203:8557/PSIA/Streaming/channels/2?videoCodecType=H.264':
  Metadata:
    title           : RTSP/RTP stream from IPNC
    comment         : 2?videoCodecType=H.264
  Duration: N/A, start: 1.880000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, progressive), 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc

Frigate stats

{"detection_fps":0.0,"detectors":{"cpu":{"detection_start":0.0,"inference_speed":131.86,"pid":217}},"mast":{"camera_fps":5.0,"capture_pid":223,"detection_fps":0.0,"pid":221,"process_fps":0.0,"skipped_fps":0.0},"service":{"storage":{"/dev/shm":{"free":1987.1,"mount_type":"tmpfs","total":1989.1,"used":2.0},"/media/frigate/clips":{"free":933051.7,"mount_type":"ext4","total":983358.5,"used":279.8},"/media/frigate/recordings":{"free":933051.7,"mount_type":"ext4","total":983358.5,"used":279.8},"/tmp/cache":{"free":1988.8,"mount_type":"tmpfs","total":1989.1,"used":0.3}},"uptime":82048,"version":"0.9.1-800f33e"}}

Operating system

HassOS

Install method

HassOS Addon

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

redvision RVX_IPNC

Any other information that may be helpful

No response

blakeblackshear commented 2 years ago

That function is used when downloading a clip for an event from the UI, so it should work. It does store a file in /tmp, so if the file is too large, it could break something. What are you trying to use that endpoint for?

adminabcomtech commented 2 years ago

Thanks for your answer, i'm trying to do something like this in home assistant Capture d’écran de 2021-10-08 15-16-40

my test call is for a clip of 2 min.

i'll check the download link in application

Edit : Where in the application did you use this end point? endpoint i can find are like this one, with event_id and this one are working. /api/events/\<event-id>/clip.mp4?download=true

blakeblackshear commented 2 years ago

I would try using the VOD endpoints instead. That won't require assembling a mp4 in cache and should work better.

adminabcomtech commented 2 years ago

Hi,

I've time to make a bit more test, and there's something goes wrong when creating index.m3u8 on endpoint /vod/{camera}/start/{timestamp}/end/{timestamp}/index.m3u8

i use this python command to create url : print (f"http://10.1.24.127:5000/vod/rvx_ip30_irwl_w/start/{time.time()- 360}/end/{time.time()}/index.m3u8")

So i should have a clip of 5 minutes. But more i wait to get index.m3u8, the shortest it is.

Here's result when i use same url with same timestamp at different time.

> ls -al index*
-rw-r--r-- 1 belese belese 1113  4 nov 10:15  index.m3u8
-rw-r--r-- 1 belese belese  968  4 nov 10:16 'index (1).m3u8'
-rw-r--r-- 1 belese belese  794  4 nov 10:17 'index (2).m3u8'
-rw-r--r-- 1 belese belese  220  4 nov 10:20 'index (3).m3u8'

You can find all index file in attachement index.zip

Ps: I also updated the Frigate Addon to DEBUG 0.9.4-26AE608

Johan

adminabcomtech commented 2 years ago

Ok, i haven't no retain in records, seem it's now ok. I'll close it, and sorry for disturbance