Closed immek closed 4 months ago
I don't understand your original idea. Why you using split filter? What is original stream format?
I'm a total ffmpeg newbee, so it's quite possible I over engineered something.. . Source stream is a h264 rtsp from a camera. My intention was a pure optimization, I have a dozen different cameras (dahua, reolink, annke, hikvision, h264 and h265), a usb coral and one N100 mini pc. I would like to run the whole thing with detection, recording and addition streams for other clients (tablets etc).
So I wanted to decode the source stream only once and create entrance
for detection entrance-full
for recording and entrance-mjpeg
for wall panel. Using as much hardware acceleration as possible and create as little delay as possible. I thought that split would be the best solution, but maybe I'm wrong :-).
MJPEG won't help you with this. Frigate uses RAW pictures for detections. And will use original format for recording. go2rtc uses original format for streaming. So decoding will be only once for you - detection.
I'm using the additional mjpeg stream for sonoff nspanel with homeassistant and webrtc-camera card. After testing different configuration, I'm getting the best results on the panel with mjpeg - not sure why, maybe processing power limitations or weak wifi signal.
streams:
for_frigate: rtsp://...
for_nspanel: ffmpeg:for_frigate#video=mjpeg#hardware
Now let's get back to the original question 😄 - I would like to understand how to make an incoming mjpeg stream with exec:ffmpeg
- why ... -c:v mjpeg -an -f mjpeg http://172.17.0.1:1984/api/stream.mjpeg?dst=entrance-mjpeg
from the first post does not work?
I truly admire the capabilities of ffmpeg module, but exec
seems more flexibule to me at this time - I can do whatever I want with a stream, change input/output fps, try some magic switches etc.
Also, could you please explain the performance difference between:
streams:
original_camera_steam: rtsp://... #let's assume there is only one
for_frigate-recording: ffmpeg:original_camera_steam#video=h264#hardware#width=...
for_frigate-detect: ffmpeg:original_camera_steam#video=h264#hardware#width=...
for_nspanel: ffmpeg:original_camera_steam#video=mjpeg#hardware#width=...
and:
streams:
original_camera_steam: exec:ffmpeg... split=3... #also hardware
... rtsp://127.0.0.1:8554/for_frigate-record
... rtsp://127.0.0.1:8554/for_frigate-detect
... rtsp://127.0.0.1:8554/for_nspanel
for_frigate-record:
for_frigate-detect:
for_nspanel:
I thought there would be a major difference between these two, but the true is I don't fully understand how go2rtc works inside, how does the data flow between process pipes and when does encoding/decoding takes place.
You do some strange things in your first post. And you're trying to misuse the software. I think with this way you will only increase the load on the CPU, although you are trying to reduce it.
Frigate will run its own ffmpeg process for raw video decoding.
PS. You using wrong format for incoming source. Check docs.
You mean mpjpeg instead of mjpeg? Or something else?
Yes. mpjpeg and mjpeg are different formats
Unfortunately, it's something else. I mentioned it in the first post:
Already tried changing format from mjpeg to mpjpeg or adding -pix_fmt yuv420p but with no difference..
Producer (ffmpeg) works, showing an increasing frame counter, but consumers are timing out.
Please let me know if the problem is relevant
Hello, thank you for your great work on this project!
I am using 1.8.2 with Frigate and currently I'm struggling with incoming mjpeg stream.
This configuration works:
The running mjpeg process:
ffprobe shows:
But I would like to move the stream definition from
entrance-mjpeg
to the split inentrance
filter and map (split=2 -> split=3). The first step to do so is by leaving configurationentrance-mjpeg
empty and trying to run separated ffmpeg process like this:The process seems to run fine, but the stream
http://imms10:5000/live/webrtc/api/stream.mjpeg?src=entrance-mjpeg
no longer works. And ffprobe times out after sending headers. Already tried changing format frommjpeg
tompjpeg
or adding-pix_fmt yuv420p
but with no difference..Any idea what may be the problem?
EDIT: You may have doubts about different IP addresses, but they are all interfaces of the same machine and it has already beed double checked.