question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't stream h265 with nvidia

See original GitHub issue

Hello, I’m having difficulties getting my Annke C800 cameras configured on my ubuntu AMD Ryzen 5 2600 with a GeForce GTX 1050. I think I have docker setup correctly and running with nvidia but I get “ffmpeg sent a broken frame” when I add my camera. I can view the camera with ffplay. I also have a google coral pcie chip that I haven’t installed yet because I want to see if I can get it working first. Can I use nvidia to transcode h265 and corral for object detection?

Here’s my docker-compose:

version: "3.9"
services:
  frigate:
    container_name: frigate
    privileged: true # this may not be necessary for all setups
    restart: unless-stopped
    image: blakeblackshear/frigate:stable-amd64nvidia
    runtime: nvidia
    environment:
      - NVIDIA_VISIBLE_DEVICES=all
      - NVIDIA_DRIVER_CAPABILIIES=compute,utility,video
    devices:
      - /dev/bus/usb:/dev/bus/usb
      - /dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
      - /dev/dri/card0
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /home/scott/docker_stuff/frigate/config/config.yml:/config/config.yml:ro
      - /media/scott/TV/frigate:/media/frigate
      - type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
        target: /tmp/cache
        tmpfs:
          size: 3000000000
    ports:
      - "5000:5000"
      - "1935:1935" # RTMP feeds
    environment:
      FRIGATE_RTSP_PASSWORD: "xxxx"

Here’s my config:

mqtt:
  host: 192.168.1.41
  port: 1883
  user: xxxx
  password: xxxx
cameras:
  camera1:
    ffmpeg:
      hwaccel_args:
        - -c:v
        - hevc_cuvid
      inputs:
        - path: rtsp://xxxx:xxxx@192.168.1.231:554/H264/ch1/main/av_stream
          roles:
            - detect
            - rtmp
    width: 3840
    height: 2160
    fps: 5
    objects:
        track:
          - person
detectors:
  cpu1:
    type: cpu

And here’s what I get when I ffprobe:

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --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-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --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-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://xxxx:xxxx@192.168.1.231:554/H264/ch1/main/av_stream':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuvj420p(pc), 3840x2160, 14.99 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s

Here’s the ouput of frigate:

Starting frigate ... done
Attaching to frigate
frigate    |  * Starting nginx nginx
frigate    |    ...done.
frigate    | Starting migrations
frigate    | peewee_migrate                 INFO    : Starting migrations
frigate    | There is nothing to migrate
frigate    | peewee_migrate                 INFO    : There is nothing to migrate
frigate    | detector.cpu1                  INFO    : Starting detection process: 51
frigate    | frigate.app                    INFO    : Camera processor started for camera1: 54
frigate    | frigate.app                    INFO    : Capture process started for camera1: 55
frigate    | frigate.mqtt                   INFO    : MQTT connected
frigate    | frigate.video                  INFO    : camera1: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : camera1: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.camera1.detect          ERROR   : Guessed Channel Layout for Input Stream #0.1 : mono
frigate    | ffmpeg.camera1.detect          ERROR   : [flv @ 0x55fc7ddd2340] Video codec hevc not compatible with flv
frigate    | ffmpeg.camera1.detect          ERROR   : Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
frigate    | ffmpeg.camera1.detect          ERROR   :
frigate    | frigate.video                  INFO    : camera1: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : camera1: ffmpeg process is not running. exiting capture thread...

Here’s my nvidia-smi output:

Fri Jul 23 18:32:33 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.57.02    Driver Version: 470.57.02    CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:06:00.0 Off |                  N/A |
| 51%   40C    P8    N/A /  75W |    178MiB /  3016MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2402      G   /usr/lib/xorg/Xorg                166MiB |
|    0   N/A  N/A      2567      G   /usr/bin/gnome-shell                8MiB |
+-----------------------------------------------------------------------------+

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
scottsteelycommented, Jul 27, 2021

Hey, just wanted to say thanks for your help, this is an awesome piece of software! Now to install that Google Coral chip. For anyone else that stumbles across this thread with a similar setup here is my working config:

mqtt:
  host: 192.168.1.41
  port: 1883
  user: xxxx
  password: xxxx
ffmpeg:
  input_args:
    - -c:v
    - hevc_cuvid
  output_args:
    clips: -map 0:v -f segment -segment_time 30 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v h264_nvenc -vf format=nv12 -b:v 4M -r 15
cameras:
  camera1:
    detect:
      enabled: true
      max_disappeared: 120
    ffmpeg:
      inputs:
        - path: 'rtsp://xxxx:xxxxx@192.168.1.231:554/Streaming/Channels/102?transportmode=unicast&profile=Profile_1'
          global_args: -y -hide_banner -loglevel info
          roles:
            - detect
        - path: 'rtsp://xxxx:xxxx@192.168.1.231:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1'
          roles:
            - clips
    width: 640
    height: 480
    fps: 5
    clips:
      enabled: True
    objects:
      track:
        - person
detectors:
  cpu1:
    type: cpu
0reactions
Bonn93commented, Aug 25, 2021

I’m getting this, this issue has a tonne of useful information too.

ffmpeg.rlc810a_1.detect        ERROR   : [flv @ 0x55caba23e380] Video codec hevc not compatible with flv
ffmpeg.rlc810a_1.detect        ERROR   : Could not write header for output file #1 (incorrect codec parameters ?): Function not implemented
ffmpeg.rlc810a_1.detect        ERROR   :

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stream H265 to PC wih Gstreamer and OpenCV
Hello I'm trying to stream video (h265 encoded) from my Jetson module to PC. I tried like this: // Jetson NX code [224.1.1.1:5000] ......
Read more >
Question / Help - How to add H265 HEVC? | OBS Forums
Its built in on your GTX 1070 card. HEVC 265 is supported through hardware acceleration on GTX 1050, 1060, 1070, and 1080 cards...
Read more >
How to Play H.265 Files on VLC without Error - VideoProc
An out-of-date hardware card driver might render your HEVC videos cannot play in VLC media player. To fix the playback error caused by...
Read more >
RX 6500XT doesn't have H264 Encoding, What does ... - Reddit
Hardware encoding at 4k is not supported but 1080p or lower hardware encoding h264 only is available. The dedicated module inside GPU can't...
Read more >
Can't watch H265 | Tom's Hardware Forum
That GPU doesn't have a built-in hardware h265 decoder, so on your PC you'll be software decoding, which is done by the CPU....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found