HEVC/H265 stream issue with flv container / output codecs
See original GitHub issueDescribe the bug Unable to get a stream/record from a RLC810A camera, mixed errors from video codec not compatible with flv and could not write header for output file, incorrect code parameters.
Version of frigate 0.8.4-5043040
Config file Include your full config file wrapped in triple back ticks.
mqtt:
host: 10.5.80.20
port: 1883
topic_prefix: frigate
client_id: frigate
stats_interval: 60
cameras:
rlc520a_1:
ffmpeg:
hwaccel_args:
- -c:v
- h264_cuvid
input_args:
- -avoid_negative_ts
- make_zero
- -fflags
- nobuffer
- -flags
- low_delay
- -strict
- experimental
- -fflags
- +genpts+discardcorrupt
- -use_wallclock_as_timestamps
- "1"
- -rtsp_transport
- tcp
output_args:
record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v h264_cuvid -c copy
inputs:
- path: rtsp://stream:stream@10.5.70.22:554//h264Preview_01_main
roles:
- detect
- rtmp
- record
width: 2560
height: 1920
fps: 30
detect:
enabled: false
record:
enabled: true
retain_days: 2
rlc810a_1:
ffmpeg:
hwaccel_args:
- -c:v
- hevc_cuvid
input_args:
- -avoid_negative_ts
- make_zero
- -fflags
- nobuffer
- -flags
- low_delay
- -strict
- experimental
- -fflags
- +genpts+discardcorrupt
- -use_wallclock_as_timestamps
- "1"
- -rtsp_transport
- tcp
output_args:
record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v h264_nvenc -c:a aac #-c:a copy -loglevel error #-vf format=yuv420p|cuda,hwupload -r 25
inputs:
- path: rtsp://stream:stream@10.5.70.23:554/h265Preview_01_main
roles:
- detect
- rtmp
- record
width: 3840
height: 2160
fps: 25
detect:
enabled: false
record:
enabled: true
retain_days: 2
Frigate container logs
frigate.video INFO : rlc810a_1: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate.video INFO : rlc810a_1: ffmpeg process is not running. exiting capture thread...
ffmpeg.rlc520a_1.detect ERROR : rtsp://stream:stream@10.5.70.22:554//h264Preview_01_main: Immediate exit requested
ffmpeg.rlc810a_1.detect ERROR : [flv @ 0x55c0daa7ac80] 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 :
Frigate stats
{
"detection_fps": 0.0,
"detectors": {
"coral": {
"detection_start": 0.0,
"inference_speed": 10.0,
"pid": 36
}
},
"rlc520a_1": {
"camera_fps": 0.0,
"capture_pid": 41,
"detection_fps": 0.0,
"pid": 39,
"process_fps": 0.0,
"skipped_fps": 0.0
},
"rlc810a_1": {
"camera_fps": 0.0,
"capture_pid": 42,
"detection_fps": 0.0,
"pid": 40,
"process_fps": 0.0,
"skipped_fps": 0.0
},
"service": {
"storage": {
"/dev/shm": {
"free": 1073.4,
"mount_type": "tmpfs",
"total": 1073.7,
"used": 0.4
},
"/media/frigate/clips": {
"free": 2038621.0,
"mount_type": "nfs4",
"total": 2146434.5,
"used": 107813.5
},
"/media/frigate/recordings": {
"free": 2038621.0,
"mount_type": "nfs4",
"total": 2146434.5,
"used": 107813.5
},
"/tmp/cache": {
"free": 2000.0,
"mount_type": "tmpfs",
"total": 2000.0,
"used": 0.0
}
},
"uptime": 241,
"version": "0.8.4-5043040"
}
}
FFprobe from your camera
Run the following command and paste output below
ffprobe rtsp://stream:stream@10.5.70.23:554/
ffprobe version 4.3.1 Copyright (c) 2007-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-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
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
Input #0, rtsp, from 'rtsp://stream:stream@10.5.70.23:554/':
Metadata:
title : Session streamed by "preview"
comment :
Duration: N/A, start: 0.000375, bitrate: N/A
Stream #0:0: Video: hevc, yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
Stream #0:1: Audio: aac, 16000 Hz, mono, fltp
Screenshots N/A
Computer Hardware
- OS: Ubuntu 20.04 with Nvidia P620 GPU
- Install method: Docker / Bash script
- Virtualization: Vmware ESXi 6.7 U3
- Coral Version: None
- Network Setup: Wired, VLANs
Camera Info:
- Manufacturer: Reolink
- Model: 810A
- Resolution: 4K
- FPS: 25 or any~
Additional context Docker init script:
#!/bin/bash
# MQTT Dirs
mkdir -p $HOME/mqtt/config -p $HOME/mqtt/data $HOME/mqtt/logs
# Frigate Dirs
mkdir -p $HOME/frigate/config /mnt/frigate/media
docker network create frigate
docker stop frigate mqtt
docker rm frigate mqtt
# Start MQTT
docker run -d \
--network=host \
--name=mqtt \
--restart=unless-stopped \
-v $HOME/mqtt/config:/mosquitto/config \
-v $HOME/mqtt/data:/mosquitto/data \
-v $HOME/mqtt/logs:/mosquitto/log \
eclipse-mosquitto:1.6
sleep 10s
# Start Frigate Ctr
docker run -d \
--network=host \
--name=frigate \
--restart=unless-stopped \
-v $HOME/frigate/config/frigate.yml:/config/config.yml:ro \
-v /mnt/frigate/media:/media/frigate \
-v /etc/localtime:/etc/localtime:ro \
-e FRIGATE_RTSP_PASSWORD=password \
--mount type=tmpfs,target=/tmp/cache,tmpfs-size=2000000000 \
--shm-size=1G \
--gpus=all \
-e NVIDIA_VISIBLE_DEVICES=all \
-e NVIDIA_DRIVER_CAPABILITIES=compute,utility,video \
blakeblackshear/frigate:stable-amd64nvidia
Nvidia passthrough/gpu is working, a stream on a RLC520A works fine - but disconnected during this command inside the container.
/opt/frigate# nvidia-smi
Wed Aug 25 06:04:30 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| 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 Quadro P620 Off | 00000000:1B:00.0 Off | N/A |
| 41% 48C P0 N/A / N/A | 0MiB / 2000MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Streamable Container for HEVC (H.265) - Video StackExchange
flv is a container which can be used to stream videos while they are being encoded. flv supports h. 264 codec. However, flv...
Read more >High Efficiency Video Coding - Wikipedia
High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video compression standard designed as part of the...
Read more >ffmpeg Documentation
Stream handling is set via the -codec option addressed to streams within a specific output file. In particular, codec options are applied by...
Read more >YouTube Upload Formats: Everything You Need to Know
Your video editing software should be able to export to one of ... What is the difference between video file containers and video...
Read more >x265 mkv - Lampadis Media
How to easily fix Plex 4K HEVC MKV/MP4 playback issues? ... On the Custom Output set your Container Format to Matroska (mkv) and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is something unclear? There is guidance above on 3 ways to get an h265 camera into frigate:
You can’t use RTMP with h265. You either have to switch to h264, disable rtmp, or re-encode to h264 on the fly.
There will also be issues with watching back recording on web devices. This is an issue inherent with h265 and not something that frigate can control.
me too on this one , how do you get h265 cameras to work with frigate stably .