Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel Quick Sync Support #736

Open
mitchross opened this issue Mar 10, 2023 · 99 comments
Open

Intel Quick Sync Support #736

mitchross opened this issue Mar 10, 2023 · 99 comments
Labels
enhancement New feature or request

Comments

@mitchross
Copy link

Hello -
I would like to know the commands to use Intel Quick Sync with this project

https://jellyfin.org/docs/general/administration/hardware-acceleration/#intel-quicksync
https://deploy-preview-4055--frigate-docs.netlify.app/configuration/hardware_acceleration

I previously opened up...
#548

@mitchross
Copy link
Author

@mrlt8 I rewrote my docker - intel - qsv container. I know FFMpeg with qsv works, because this command works ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p output.yuv

When I run this ffmpeg command

- name: FFMPEG_CMD
  value: 'ffmpeg -loglevel verbose -f h264 -hwaccel qsv -hwaccel_output_format qsv -i - -c:v h264_qsv -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}'
  
  I get this error in the logs..... 

Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
[h264 @ 0x55c29e745100] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x55c29ef16b40] w:1920 h:1080 pixfmt:yuv420p tb:1/1200000 fr:20/1 sar:0/1
[auto_scale_0 @ 0x55c29ef18d80] w:iw h:ih flags:'' interl:0
[format @ 0x55c29ef174c0] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x55c29ef18d80] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x0
Last message repeated 3 times
[h264_qsv @ 0x55c29e547bc0] Using device qsv0 (type qsv) with h264_qsv encoder.
[h264_qsv @ 0x55c29e547bc0] Encoder: input is system memory surface
[h264_qsv @ 0x55c29e547bc0] Using the constant bitrate (CBR) ratecontrol method
[h264_qsv @ 0x55c29e547bc0] MFMode:2
[h264_qsv @ 0x55c29e547bc0] Selected ratecontrol mode is unsupported
[h264_qsv @ 0x55c29e547bc0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x55c29e5329c0] Statistics: 1049163 bytes read, 0 seeks
Conversion failed!
[dog-cam-2] FFMPEG stopped
[kitchen] FFMPEG stopped
[h264 @ 0x56286f856c80] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, unknown/bt709/unknown, progressive, left), 1728x1296, 20 fps, 20 tbr, 1200k tbn

Any thoughts?

@mrlt8
Copy link
Owner

mrlt8 commented Jun 20, 2023

[h264_qsv @ 0x55c29e547bc0] Selected ratecontrol mode is unsupported

Does this help -b:v 3000k? That's what we use with h264_v4l2m2m and h264_nvenc. Each encoder seems to require a little tweaking.

@mitchross
Copy link
Author

Same error with ->   value: 'ffmpeg -loglevel verbose -f h264 -hwaccel qsv -hwaccel_output_format qsv -i - -c:v h264_qsv -b:v 3000k -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}'

[front-door] FFMPEG stopped
[h264 @ 0x557988e0eac0] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 20 fps, 20 tbr, 1200k tbn
[AVHWDeviceContext @ 0x557989080d40] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x557989080d40] libva: VA-API version 1.18.0
[AVHWDeviceContext @ 0x557989080d40] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x557989080d40] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x557989080d40] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x557989080d40] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x557989080d40] Initialised VAAPI connection: version 1.18
[AVHWDeviceContext @ 0x557989080d40] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ().
[AVHWDeviceContext @ 0x557989080d40] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x557988e24940] Initialize MFX session: API version is 1.35, implementation version is 1.35
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
[h264 @ 0x557988eaa2c0] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x5579897b6b40] w:1920 h:1080 pixfmt:yuv420p tb:1/1200000 fr:20/1 sar:0/1
[auto_scale_0 @ 0x5579897b8dc0] w:iw h:ih flags:'' interl:0
[format @ 0x5579897b7500] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x5579897b8dc0] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x0
Last message repeated 3 times
[h264_qsv @ 0x557988e373c0] Using device qsv0 (type qsv) with h264_qsv encoder.
[h264_qsv @ 0x557988e373c0] Encoder: input is system memory surface
[h264_qsv @ 0x557988e373c0] Using the variable bitrate (VBR) ratecontrol method
[h264_qsv @ 0x557988e373c0] MFMode:2
[h264_qsv @ 0x557988e373c0] Selected ratecontrol mode is unsupported
[h264_qsv @ 0x557988e373c0] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x557988e1f800] Statistics: 716685 bytes read, 0 seeks
Conversion failed!
[h264 @ 0x5633bcbf91c0] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x559f50d96ac0] max_analyze_duration 5000000 reached at 5000000 microseconds st:0
Input #0, h264, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 20 fps, 20 tbr, 1200k tbn
[AVHWDeviceContext @ 0x559f50db8b80] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x559f50db8b80] libva: VA-API version 1.18.0
[AVHWDeviceContext @ 0x559f50db8b80] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x559f50db8b80] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x559f50db8b80] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x559f50db8b80] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x559f50db8b80] Initialised VAAPI connection: version 1.18
[AVHWDeviceContext @ 0x559f50db8b80] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ().
[AVHWDeviceContext @ 0x559f50db8b80] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x559f50ed3ac0] Initialize MFX session: API version is 1.35, implementation version is 1.35
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_qsv))
[h264 @ 0x559f50e35e80] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x559f517695c0] w:1920 h:1080 pixfmt:yuv420p tb:1/1200000 fr:20/1 sar:0/1
[auto_scale_0 @ 0x559f5176b840] w:iw h:ih flags:'' interl:0
[format @ 0x559f51769f80] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'format'
[auto_scale_0 @ 0x559f5176b840] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x0
Last message repeated 3 times
[h264_qsv @ 0x559f50db7200] Using device qsv0 (type qsv) with h264_qsv encoder.
[h264_qsv @ 0x559f50db7200] Encoder: input is system memory surface
[h264_qsv @ 0x559f50db7200] Using the variable bitrate (VBR) ratecontrol method
[h264_qsv @ 0x559f50db7200] MFMode:2
[h264_qsv @ 0x559f50db7200] Selected ratecontrol mode is unsupported
[h264_qsv @ 0x559f50db7200] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[AVIOContext @ 0x559f50da7800] Statistics: 894074 bytes read, 0 seeks
Conversion failed!
[garage] FFMPEG stopped
[WyzeBridge] 🎉 Connecting to WyzeCam V3 - Dog Cam 2 on 192.168.1.184
[living-room] FFMPEG stopped
[WyzeBridge] 🎉 Connecting to WyzeCam Doorbell - Front door on 192.168.1.105
[WyzeBridge] 🎉 Connecting to WyzeCam V3 - Garage on 192.168.1.95
[WyzeBridge] 🎉 Connecting to WyzeCam V3 - Deck on 192.168.1.196
[shed] ☁️ Camera is connected via RELAY mode!!
[shed] Stream may consume additional bandwidth!
[shed] 📡 Getting 180kb/s HD stream (H264/20fps) via RELAY mode (WiFi: 71%) FW: 4.36.11.4679 🔒 (DTLS) (2/3)
ffmpeg version n5.1-2-g915ef932a3-20220731 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
[shed] WARNING: Skipping smaller frame at start of stream (frame_size=1)
[h264 @ 0x5557950841c0] Reinit context to 1920x1088, pix_fmt: yuv420p

@mitchross
Copy link
Author

fwiw @mrlt8 frigate's ffmpeg and docker lets me use intel qsv with no issue. My Docker image uses same ffmpeg

If it helped, frigate seems to use these params

https://github.com/blakeblackshear/frigate/blob/9e531b0b5bf34634dc6c44e7eca7e5eaf5a52a25/frigate/ffmpeg_presets.py#L67

@mrlt8
Copy link
Owner

mrlt8 commented Jun 25, 2023

do you need to add -vaapi_device /dev/dri/renderD128?

@mitchross
Copy link
Author

do you need to add -vaapi_device /dev/dri/renderD128?

No dont think so, my test commands from the FFMPEG website didn't require it... Im thinking its something with this line https://github.com/blakeblackshear/frigate/blob/9e531b0b5bf34634dc6c44e7eca7e5eaf5a52a25/frigate/ffmpeg_presets.py#L113C6-L113C6

@mrlt8
Copy link
Owner

mrlt8 commented Jun 25, 2023

that's mostly a video filter..?

Your previous reference shows frigate using -qsv_device and then selecting the appropriate device

@mitchross
Copy link
Author

that's mostly a video filter..?

Your previous reference shows frigate using -qsv_device and then selecting the appropriate device

Here is the command that works natively in my container...

https://trac.ffmpeg.org/wiki/Hardware/QuickSync

image

Theres no need to pass a device... When I run intel_gpu_top the GPU gets activated

@mrlt8
Copy link
Owner

mrlt8 commented Jun 26, 2023

The mrlt8/wyze-bridge:latest-hw image seems to support qsv:

 V....D libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V....D libx264rgb           libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
 V....D libopenh264          OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V....D h264_amf             AMD AMF H.264 Encoder (codec h264)
 V....D h264_nvenc           NVIDIA NVENC H.264 encoder (codec h264)
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
 V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)

would something like this work?

- FFMPEG_CMD=ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i - -c:v h264_qsv -b:v 4000k -vf 'format=nv12|vaapi,hwupload' -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}

or

- FFMPEG_CMD=ffmpeg -hwaccel qsv -c:v h264_qsv -i - -c:v h264_qsv -b:v 4000k -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}

@mitchross
Copy link
Author

@mrlt8 So FFMPEG might support qsv ( intel gen 11+ ) or vaapi (sub intel 11).. but you still need the intel drivers in the docker image . Here is what my docker file looks like https://gist.github.com/mitchross/5dc213dc6d4165704f379be414044235 ... Its based on Frigate's docker file.

So the errors I reported above are based on my docker image... You can build it yourself or I can give a docker hub image...

If you take the docker file, you can shell into it.

run 'intel_gpu_top' to get GPU activity. If you download a sample mp4, then run 'ffmpeg -hwaccel qsv -c:v h264_qsv -i input.mp4 -vf hwdownload,format=nv12 -pix_fmt yuv420p output.yuv' you will see GPU monitor tool spike. This 'intel_gpu_top' in the container or on the host itself.

https://trac.ffmpeg.org/wiki/Hardware/QuickSync

@mrlt8
Copy link
Owner

mrlt8 commented Jun 26, 2023

Some of the ENVs were moved to an external file in v2.3.5. Would something like this work?
https://raw.githubusercontent.com/mrlt8/docker-wyze-bridge/dockerfiles/app/Dockerfile.qsv

@mitchross
Copy link
Author

Some of the ENVs were moved to an external file in v2.3.5. Would something like this work? https://raw.githubusercontent.com/mrlt8/docker-wyze-bridge/dockerfiles/app/Dockerfile.qsv

Ill give this a try tonight... do you have a sample docker compose for me to try also? Just want to ensure our testing is 1:1

@mitchross
Copy link
Author

@mrlt8 Results

Latest-hw Image ( 2.3.5 ) + "ffmpeg -hwaccel qsv -c:v h264_qsv -i - -c:v h264_qsv -b:v 4000k -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}"

Results in the error below ( which I expect as the intel drivers are not present

[WyzeBridge] 🎉 Connecting to WyzeCam V3 - Garage on 192.168.1.95
[vist#0:0/h264 @ 0x55da611288c0] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Input #0, h264, from 'fd:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, unknown/bt709/unknown, progressive), 1728x1296, 25 fps, 40 tbr, 1200k tbn
implib-gen: libdrm.so.2: failed to load library 'libdrm.so.2' via dlopen: libdrm.so.2: cannot open shared object file: No such file or directory
ffmpeg: libdrm.so.2.init.c:61: load_library: Assertion `0 && "Assertion in generated code"' failed.
[vist#0:0/h264 @ 0x559650f28b00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Input #0, h264, from 'fd:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1920x1080, 25 fps, 40 tbr, 1200k tbn
implib-gen: libdrm.so.2: failed to load library 'libdrm.so.2' via dlopen: libdrm.so.2: cannot open shared object file: No such file or directory
ffmpeg: libdrm.so.2.init.c:61: load_library: Assertion `0 && "Assertion in generated code"' failed.
[wyze-doorbell] FFMPEG stopped

Now If I use the command "ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i - -c:v h264_qsv -b:v 4000k -vf 'format=nv12|vaapi,hwupload' -rtsp_transport tcp -f rtsp rtsp://0.0.0.0:8554/{cam_name}"

I get


  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230625
  libavutil      58. 13.101 / 58. 13.101
  libavcodec     60. 21.100 / 60. 21.100
  libavformat    60.  9.100 / 60.  9.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
implib-gen: libX11.so.6: failed to load library 'libX11.so.6' via dlopen: libX11.so.6: cannot open shared object file: No such file or directory
ffmpeg: libX11.so.6.init.c:61: load_library: Assertion `0 && "Assertion in generated code"' failed.
[living-room] WARNING: Skipping smaller frame at start of stream (frame_size=1)
[living-room] FFMPEG stopped

Next I tried your new docker image, I had to hard code the URL for MTX, I think something is busted with the env vars? i was getting 404's on the curl for MTX. After I got that build I am seeing this

[WyzeBridge] [+] Adding Living Room [HL_PAN3]
[WyzeBridge] starting MediaMTX 0.23.6
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/app/wyze_bridge.py", line 35, in run
    self.rtsp.start()
  File "/app/wyzebridge/rtsp_server.py", line 83, in start
    self.sub_process = Popen(["/app/mediamtx", "/app/mediamtx.yml"])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/app/mediamtx'

@mrlt8
Copy link
Owner

mrlt8 commented Jun 27, 2023

There were some changes that moves the default ENVs. Can you try to build with v2.3.5 or the dockerfiles branch?

version: '2.4'
services:
    wyze-bridge:
        container_name: wyze-bridge
        restart: unless-stopped
        ports:
            - 8554:8554 # RTSP
            - 5000:5000 # WEB-UI
        build:
            context: ./app
            dockerfile: Dockerfile.qsv
        devices:
            - /dev/:/dev/
        environment:
            - WYZE_EMAIL=
            - WYZE_PASSWORD=
            - FFMPEG_CMD=

@mitchross
Copy link
Author

There were some changes that moves the default ENVs. Can you try to build with v2.3.5 or the dockerfiles branch?

version: '2.4'
services:
    wyze-bridge:
        container_name: wyze-bridge
        restart: unless-stopped
        ports:
            - 8554:8554 # RTSP
            - 5000:5000 # WEB-UI
        build:
            context: ./app
            dockerfile: Dockerfile.qsv
        devices:
            - /dev/:/dev/
        environment:
            - WYZE_EMAIL=
            - WYZE_PASSWORD=
            - FFMPEG_CMD=

Yea my last messages were built on the 2.3.5 branch, not my own... The last error in the my last post was based on the dockerfiles branch.. I see you made a commit so ill try again tonight!

@mrlt8
Copy link
Owner

mrlt8 commented Jun 28, 2023

I believe you'll also need to set the ENV LIBVA_DRIVER_NAME= to i965 or iHD.

@mrlt8 mrlt8 added the enhancement New feature or request label Jun 28, 2023
@mitchross
Copy link
Author

mitchross commented Jun 29, 2023

When I build/run the compose file I get


[+] Building 6.8s (9/11)
 => [internal] load .dockerignore                                                                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                 0.0s
 => [internal] load build definition from Dockerfile.qsv                                                                                                                        0.0s
 => => transferring dockerfile: 1.95kB                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/amd64/python:3.11-slim-bullseye                                                                                                      0.4s
 => [internal] load build context                                                                                                                                               0.0s
 => => transferring context: 2.17kB                                                                                                                                             0.0s
 => [base 1/1] FROM docker.io/amd64/python:3.11-slim-bullseye@sha256:ed0e7c504b2b8c4517f703252811a6d2ddff5c9320272103d8cc72befbf950a9                                           0.0s
 => CACHED [builder 1/4] RUN echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list &&    apt-get update &&    apt-get ins  0.0s
 => CACHED [builder 2/4] COPY . /build/app/                                                                                                                                     0.0s
 => CACHED [builder 3/4] RUN pip3 install --disable-pip-version-check --prefix=/build/usr/local -r /build/app/requirements.txt                                                  0.0s
 => ERROR [builder 4/4] RUN cd /build && . app/.env &&    mkdir -p tokens img usr/lib/x86_64-linux-gnu/dri &&    curl -L https://github.com/BtbN/FFmpeg-Builds/releases/downlo  6.4s
------
 > [builder 4/4] RUN cd /build && . app/.env &&    mkdir -p tokens img usr/lib/x86_64-linux-gnu/dri &&    curl -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz     | tar --strip-components=1 -C usr/local -Jxf - --wildcards '*ffmpeg' &&    curl -L https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_amd64.tar.gz     | tar xzf - -C app &&    cp app/amd.lib usr/local/lib/libIOTCAPIs_ALL.so &&    cp -R /usr/lib/x86_64-linux-gnu/dri/ usr/lib/x86_64-linux-gnu/dri/ &&    rm app/*.txt app/*.lib app/*.md:
#0 0.286   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#0 0.286                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 96.4M  100 96.4M    0     0  16.0M      0  0:00:05  0:00:05 --:--:-- 16.7M
#0 6.296 curl: (3) URL using bad/illegal format or missing URL
#0 6.297
#0 6.297 gzip: stdin: unexpected end of file
#0 6.297 tar: Child returned status 1
#0 6.297 tar: Error is not recoverable: exiting now
------
failed to solve: process "/bin/sh -c cd /build && . app/.env &&    mkdir -p tokens img usr/lib/x86_64-linux-gnu/dri &&    curl -L https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz     | tar --strip-components=1 -C usr/local -Jxf - --wildcards '*ffmpeg' &&    curl -L https://github.com/bluenviron/mediamtx/releases/download/v${MTX_TAG}/mediamtx_v${MTX_TAG}_linux_amd64.tar.gz     | tar xzf - -C app &&    cp app/amd.lib usr/local/lib/libIOTCAPIs_ALL.so &&    cp -R /usr/lib/x86_64-linux-gnu/dri/ usr/lib/x86_64-linux-gnu/dri/ &&    rm app/*.txt app/*.lib app/*.md" did not complete successfully: exit code: 2
PS C:\Users\thell\Documents\Programming\docker-wyze-bridge> 

@mrlt8
Copy link
Owner

mrlt8 commented Jun 29, 2023

hmm, I wonder if it's not reading the MTX_TAG from the .env file for some reason..?

btw, the Dockerfile.qsv file should now be in the main branch: https://github.com/mrlt8/docker-wyze-bridge/blob/main/app/Dockerfile.qsv

mrlt8 added a commit that referenced this issue Jun 29, 2023
mrlt8 added a commit that referenced this issue Jun 29, 2023
* Build QSV image #736

* Update docker-image.yml

* qsv image metadata

* Fix MFA if unknown primary_option #885

* snapshot time out logging

* changelog
@mrlt8
Copy link
Owner

mrlt8 commented Jun 29, 2023

Prebuilt images with the intel drivers should be available on dockerhub or ghcr.io using the latest-qsv tag

@392media
Copy link

392media commented Jun 29, 2023

Running the prebuilt image pulled with :latest-qsv, got this error:
implib-gen: libX11.so.6: failed to load library 'libX11.so.6' via dlopen: libX11.so.6: cannot open shared object file: No such file or directory
ffmpeg: libX11.so.6.init.c:61: load_library: Assertion `0 && "Assertion in generated code"' failed.

App version shown in the log is 2.3.7

mrlt8 added a commit that referenced this issue Jun 30, 2023
@mitchross
Copy link
Author

hmm, I wonder if it's not reading the MTX_TAG from the .env file for some reason..?

btw, the Dockerfile.qsv file should now be in the main branch: https://github.com/mrlt8/docker-wyze-bridge/blob/main/app/Dockerfile.qsv

Docker compose needs the .env file at the same level as the docker-compose.yml file. This means you'd need to move it to root level or move compose to the app folder...

Next the intel drives need to be part of the final image

&& apt-get install -y curl tar xz-utils ${QSV:+intel-media-va-driver-non-free} ${QSV:+i965-va-driver} \

When you are installing intel-media-driver it should be in the last FROM otherwise its dismissed

mrlt8 added a commit that referenced this issue Jun 30, 2023
* Add libx11 #736

* sort options by priority #885

* Fix API Key/ID for HAS

* changelog
@mrlt8
Copy link
Owner

mrlt8 commented Jun 30, 2023

@392media could you try the latest image?

@mitchross I'm able to build with docker-compose using:

 build:
      context: ./app
      dockerfile: Dockerfile.qsv

or docker build -t wbqsv -f app/Dockerfile.qsv app

@mitchross
Copy link
Author

@392media could you try the latest image?

@mitchross I'm able to build with docker-compose using:

 build:
      context: ./app
      dockerfile: Dockerfile.qsv

or docker build -t wbqsv -f app/Dockerfile.qsv app

got it... you still need to move the intel drives down to the last FROM

RUN echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list
&& apt-get -qq update
&& apt-get -qq install --no-install-recommends --no-install-suggests -y
intel-opencl-icd
mesa-va-drivers libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 radeontop intel-gpu-tools
&& apt-get -qq install --no-install-recommends --no-install-suggests -y
i965-va-driver-shaders
&& rm -f /etc/apt/sources.list.d/debian-testing.list

@mrlt8
Copy link
Owner

mrlt8 commented Jun 30, 2023

I believe they should be in the final image:

qsv

@392media
Copy link

@mitchross what's model of you Intel CPU?

@mitchross
Copy link
Author

@mitchross what's model of you Intel CPU?

Intel 5095

mrlt8 added a commit that referenced this issue Jul 24, 2023
* Start from index 1 for cruise_point/waypoint #835

* update_snapshot via MQTT

* fix camera status always online #907 #920

* Additional MQTT entities #921

* QSV related changes

* i965-va-drivers #736

* FIX power status #921

* Fix cruise_point type #921

Thanks @jhansche

* return index from command payload #921

* Update docker-image.yml

* Monitor and set preferred bitrate #929

* Default to `-` for cruise_point #921

* clear out stale entities #921

* changelog
@mitchross
Copy link
Author

Could someone try the latest dev-qsv image which should have intel-opencl-icd?

Rotate Camera still doesn't work.

These are my input params, ignore the format, they get passed this way to my k8s cluster, but they are docker env compatible.

- name: RECORD_ALL
  value: "True"
- name: RECORD_LENGTH
  value: "1800"
- name: ROTATE_DOOR
  value: "True"
- name: FRESH_DATA
  value: "True"
- name: DEBUG_FFMPEG
  value: "True"
- name: H264_ENC
  value: h264_qsv
- name: LIBVA_DRIVER_NAME
  value: iHD

@chris001
Copy link

@mitchross
When the ffmpeg call to rotate door camera fails, ffmpeg should log the error to the container's log, that should give some clues, could you paste relevant log lines here?

@mitchross
Copy link
Author

This is the command that breaks rotation.. ( do note it rotates fine without these values )

- name: H264_ENC
  value: h264_qsv

I get these logs... (front-door) is the camera to troubleshoot

[front-door] ☁️ Camera is connected via RELAY mode!!
[front-door] Stream may consume additional bandwidth!
[front-door] 📡 Getting 180kb/s HD stream (H264/20fps) via RELAY mode (WiFi: 94%) FW: 4.25.1.314 🔒 (DTLS) (2/3)
[front-door] Re-encoding using h264_qsv [transpose='clock']
[front-door] 📹 Will record 1800s mp4 clips to /record/front-door/
[front-door] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -hwaccel qsv -analyzeduration 50 -probesize 50 -f H264 -i pipe: -flags +global_header -c:v h264_qsv -filter:v vpp_qsv=transpose=clock -b:v 2000k -coder 1 -bufsize 2000k -maxrate 2000k -minrate 2000k -profile:v main -preset fast -forced-idr 1 -force_key_frames expr:gte(t,n_forced*2) -movflags +empty_moov+default_base_moof+frag_keyframe -muxdelay 0 -muxpreload 0 -map 0:v -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/front-door|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/front-door/front-door_%Y-%m-%d_%H-%M-%S_%Z.mp4
ffmpeg version N-111615-g60244d0bec-20230724 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230724
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[tee @ 0x561fddee44c0] filename:'rtsp://0.0.0.0:8554/deck' format:rtsp
[tee @ 0x561fddee44c0]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x561fddee44c0] filename:'/record/deck/deck_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x561fddee44c0]     stream:0 codec:h264 type:video bsfs: AVBSFContext
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/deck|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/deck/deck_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 25 fps, 40 tbr, 20 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[segment @ 0x561fdded6ac0] Selected stream id:0 type:video
[segment @ 0x561fdded6ac0] Opening '/record/deck/deck_2023-07-27_01-46-39_UTC.mp4' for writing
[WyzeBridge] ✅ '/deck stream is UP! (3/3)
[front-door] WARNING: Skipping smaller frame at start of stream (frame_size=4)
[dog-cam-2] ☁️ Camera is connected via RELAY mode!!
[dog-cam-2] Stream may consume additional bandwidth!
[dog-cam-2] 📡 Getting 180kb/s HD stream (H264/20fps) via RELAY mode (WiFi: 98%) FW: 4.36.11.4679 🔒 (DTLS) (2/3)
[dog-cam-2] 📹 Will record 1800s mp4 clips to /record/dog-cam-2/
[dog-cam-2] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -hwaccel qsv -analyzeduration 50 -probesize 50 -f H264 -i pipe: -flags +global_header -c:v copy -movflags +empty_moov+default_base_moof+frag_keyframe -muxdelay 0 -muxpreload 0 -map 0:v -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dog-cam-2|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/dog-cam-2/dog-cam-2_%Y-%m-%d_%H-%M-%S_%Z.mp4
ffmpeg version N-111615-g60244d0bec-20230724 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230724
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[front-door] WARNING: frame too old
[dog-cam-2] WARNING: Skipping smaller frame at start of stream (frame_size=1)
[h264 @ 0x558cae46ee40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x558cae45d2c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x558cae486940] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x558cae486600] Adding streams from explicit maps...
[vost#0:0/copy @ 0x558cae482780] Created video stream from input stream 0:0
[out#0/tee @ 0x558cae486600] Codec AVOption flags () has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[tcp @ 0x558cae4f3400] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x558cae4f3400] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x558cae484340] SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 60.10.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoMkAAr8gAEHrf/8CgA==,KO48gAA=; profile-level-id=4D0029
a=control:streamid=0

[tee @ 0x558cae482b80] filename:'rtsp://0.0.0.0:8554/garage' format:rtsp
[tee @ 0x558cae482b80]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x558cae482b80] filename:'/record/garage/garage_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x558cae482b80]     stream:0 codec:h264 type:video bsfs: AVBSFContext
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/garage|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/garage/garage_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 25 fps, 40 tbr, 20 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
frame=    0 fps=0.0 q=-1.0 size=       0kB time=N/A bitrate=N/A speed=N/A    
[segment @ 0x558cae481540] Selected stream id:0 type:video
[segment @ 0x558cae481540] Opening '/record/garage/garage_2023-07-27_01-46-39_UTC.mp4' for writing
[WyzeBridge] ✅ '/garage stream is UP! (3/3)
[h264 @ 0x55ff5b9fe0c0] Reinit context to 1728x1296, pix_fmt: yuv420p
[h264 @ 0x55ff5b9ec7c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x55ff5ba01ec0] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, unknown/bt709/unknown, progressive, left), 1728x1296, 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x55ff5ba02640] Adding streams from explicit maps...
[vost#0:0/h264_qsv @ 0x55ff5ba8d040] Created video stream from input stream 0:0
[AVHWDeviceContext @ 0x55ff5ba0e100] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55ff5ba0e100] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x55ff5ba0e100] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55ff5ba0e100] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55ff5ba0e100] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x55ff5ba0e100] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55ff5ba0e100] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x55ff5ba0e100] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x55ff5ba0e100] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55ff5ba0dc00] Use Intel(R) oneVPL to create MFX session, API version is 2.9, the required implementation version is 1.3
[AVHWDeviceContext @ 0x55ff5ba0dc00] Initialize MFX session: implementation version is 1.35
[h264_mp4toannexb @ 0x55ff5bae8e80] The input looks like it is Annex B already
[out#0/tee @ 0x55ff5ba02640] Codec AVOption forced-idr (If forcing keyframes, force them as IDR frames.) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[out#0/tee @ 0x55ff5ba02640] Codec AVOption coder (Coder type) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
[AVHWDeviceContext @ 0x7fb414002600] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x7fb414002600] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55ff5ba11080] Decoder: output is video memory surface
[h264_qsv @ 0x55ff5ba11080] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[AVHWDeviceContext @ 0x7fb414007d40] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x7fb414007d40] Driver not found in known nonstandard list, using standard behaviour.
[h264_qsv @ 0x55ff5ba11080] Decoder: output is video memory surface
[h264_qsv @ 0x55ff5ba11080] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[living-room] ☁️ Camera is connected via RELAY mode!!
[living-room] Stream may consume additional bandwidth!
[wyze-doorbell] ☁️ Camera is connected via RELAY mode!!
[wyze-doorbell] Stream may consume additional bandwidth!
[wyze-doorbell] 📡 Getting 180kb/s HD stream (H264/20fps) via RELAY mode (WiFi: 95%) FW: 4.25.1.314 🔒 (DTLS) (2/3)
[living-room] 📡 Getting 180kb/s HD stream (H264/20fps) via RELAY mode (WiFi: 66%) FW: 4.50.3.4240 🔒 (DTLS) (2/3)
[wyze-doorbell] Re-encoding using h264_qsv [transpose='clock']
[wyze-doorbell] 📹 Will record 1800s mp4 clips to /record/wyze-doorbell/
[wyze-doorbell] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -hwaccel qsv -analyzeduration 50 -probesize 50 -f H264 -i pipe: -flags +global_header -c:v h264_qsv -filter:v vpp_qsv=transpose=clock -b:v 2000k -coder 1 -bufsize 2000k -maxrate 2000k -minrate 2000k -profile:v main -preset fast -forced-idr 1 -force_key_frames expr:gte(t,n_forced*2) -movflags +empty_moov+default_base_moof+frag_keyframe -muxdelay 0 -muxpreload 0 -map 0:v -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/wyze-doorbell|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/wyze-doorbell/wyze-doorbell_%Y-%m-%d_%H-%M-%S_%Z.mp4
[living-room] 📹 Will record 1800s mp4 clips to /record/living-room/
[living-room] [FFMPEG_CMD] ffmpeg -loglevel verbose -fflags +genpts+flush_packets+nobuffer+bitexact -flags +low_delay -thread_queue_size 100 -hwaccel qsv -analyzeduration 50 -probesize 50 -f H264 -i pipe: -flags +global_header -c:v copy -movflags +empty_moov+default_base_moof+frag_keyframe -muxdelay 0 -muxpreload 0 -map 0:v -f tee [f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/living-room|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/living-room/living-room_%Y-%m-%d_%H-%M-%S_%Z.mp4
frame=    0 fps=0.0 q=-1.0 size=       0kB time=N/A bitrate=N/A speed=N/A    
ffmpeg version N-111615-g60244d0bec-20230724 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230724
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
ffmpeg version N-111615-g60244d0bec-20230724 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20230724
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 10.100 /  9. 10.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[wyze-doorbell] WARNING: Skipping smaller frame at start of stream (frame_size=4)
[living-room] WARNING: Skipping smaller frame at start of stream (frame_size=1)
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
[tee @ 0x561fddee44c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x561fdded6ac0] segment:'/record/deck/deck_2023-07-27_01-46-39_UTC.mp4' starts with packet stream:0 pts:0 pts_time:0 frame:0
[h264 @ 0x5597f05c3e40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x560b450b4e40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x5594111d3e40] Reinit context to 1920x1088, pix_fmt: yuv420p
[h264 @ 0x5597f05b22c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x5597f05dbe00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x5597f05d63c0] Adding streams from explicit maps...
[vost#0:0/copy @ 0x5597f0641900] Created video stream from input stream 0:0
[out#0/tee @ 0x5597f05d63c0] Codec AVOption flags () has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[tcp @ 0x5597f063ff40] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x5597f063ff40] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x5597f0640100] SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 60.10.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoMkAAr8gAEHrf/8CgA==,KO48gAA=; profile-level-id=4D0029
a=control:streamid=0

[h264 @ 0x5594111c22c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x5594111eb940] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x5594111eb100] Adding streams from explicit maps...
[vost#0:0/copy @ 0x559411287540] Created video stream from input stream 0:0
[out#0/tee @ 0x5594111eb100] Codec AVOption flags () has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[tcp @ 0x559411259400] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x559411259400] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x559411286ac0] SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 60.10.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoMkAAr8gAEHrf/8CgA==,KO48gAA=; profile-level-id=4D0029
a=control:streamid=0

[h264 @ 0x560b450a32c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x560b450cce00] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (1920x1088), 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x560b450cacc0] Adding streams from explicit maps...
[vost#0:0/copy @ 0x560b4513b300] Created video stream from input stream 0:0
[out#0/tee @ 0x560b450cacc0] Codec AVOption flags () has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[tcp @ 0x560b45168580] Starting connection attempt to 0.0.0.0 port 8554
[tcp @ 0x560b45168580] Successfully connected to 0.0.0.0 port 8554
[rtsp @ 0x560b450cbb00] SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 60.10.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=J00AKedAPAET8s1AQEB8AAADAAQAAAMAoMkAAr8gAEHrf/8CgA==,KO48gAA=; profile-level-id=4D0029
a=control:streamid=0

[tee @ 0x5597f05d5a40] filename:'rtsp://0.0.0.0:8554/shed' format:rtsp
[tee @ 0x5597f05d5a40]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x5597f05d5a40] filename:'/record/shed/shed_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x5597f05d5a40]     stream:0 codec:h264 type:video bsfs: AVBSFContext
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/shed|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/shed/shed_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 25 fps, 40 tbr, 20 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[segment @ 0x5597f05d8500] Selected stream id:0 type:video
[segment @ 0x5597f05d8500] Opening '/record/shed/shed_2023-07-27_01-46-40_UTC.mp4' for writing
[WyzeBridge] ✅ '/shed stream is UP! (3/3)
[tee @ 0x5594111eab00] filename:'rtsp://0.0.0.0:8554/kitchen' format:rtsp
[tee @ 0x5594111eab00]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x5594111eab00] filename:'/record/kitchen/kitchen_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x5594111eab00]     stream:0 codec:h264 type:video bsfs: AVBSFContext
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/kitchen|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/kitchen/kitchen_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 25 fps, 40 tbr, 20 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[segment @ 0x5594111e5e80] Selected stream id:0 type:video
[segment @ 0x5594111e5e80] Opening '/record/kitchen/kitchen_2023-07-27_01-46-40_UTC.mp4' for writing
[WyzeBridge] ✅ '/kitchen stream is UP! (3/3)
[tee @ 0x560b450cae00] filename:'rtsp://0.0.0.0:8554/dog-cam-2' format:rtsp
[tee @ 0x560b450cae00]     stream:0 codec:h264 type:video bsfs: AVBSFContext
[tee @ 0x560b450cae00] filename:'/record/dog-cam-2/dog-cam-2_%Y-%m-%d_%H-%M-%S_%Z.mp4' format:fifo
[tee @ 0x560b450cae00]     stream:0 codec:h264 type:video bsfs: AVBSFContext
Output #0, tee, to '[f=rtsp:rtsp_transport=tcp:bsfs/v=dump_extra=freq=keyframe]rtsp://0.0.0.0:8554/dog-cam-2|[onfail=ignore:f=segment:bsfs/v=dump_extra=freq=keyframe:segment_time=1800:segment_atclocktime=1:segment_format=mp4:reset_timestamps=1:strftime=1:use_fifo=1]/record/dog-cam-2/dog-cam-2_%Y-%m-%d_%H-%M-%S_%Z.mp4':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1920x1080 (0x0), q=2-31, 25 fps, 40 tbr, 20 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
[WyzeBridge] ✅ '/dog-cam-2 stream is UP! (3/3)
[segment @ 0x560b450c6300] Selected stream id:0 type:video
[segment @ 0x560b450c6300] Opening '/record/dog-cam-2/dog-cam-2_2023-07-27_01-46-40_UTC.mp4' for writing
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
[tee @ 0x560b450cae00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x560b450c6300] segment:'/record/dog-cam-2/dog-cam-2_2023-07-27_01-46-40_UTC.mp4' starts with packet stream:0 pts:0 pts_time:0 frame:0
[h264 @ 0x55a6c49620c0] Reinit context to 1728x1296, pix_fmt: yuv420p
[h264 @ 0x55a6c49507c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[vist#0:0/h264 @ 0x55a6c4965ec0] WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Selecting decoder 'h264_qsv' because of requested hwaccel method qsv
Input #0, h264, from 'pipe:':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (Main), 1 reference frame, yuv420p(tv, unknown/bt709/unknown, progressive, left), 1728x1296, 25 fps, 40 tbr, 1200k tbn
[out#0/tee @ 0x55a6c497ad00] Adding streams from explicit maps...
[vost#0:0/h264_qsv @ 0x55a6c49e98c0] Created video stream from input stream 0:0
[AVHWDeviceContext @ 0x55a6c497a380] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x55a6c497a380] libva: VA-API version 1.17.0
[AVHWDeviceContext @ 0x55a6c497a380] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x55a6c497a380] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x55a6c497a380] libva: Found init function __vaDriverInit_1_17
[AVHWDeviceContext @ 0x55a6c497a380] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55a6c497a380] Initialised VAAPI connection: version 1.17
[AVHWDeviceContext @ 0x55a6c497a380] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x55a6c497a380] Driver not found in known nonstandard list, using standard behaviour.
[AVHWDeviceContext @ 0x55a6c4979f00] Use Intel(R) oneVPL to create MFX session, API version is 2.9, the required implementation version is 1.3
[AVHWDeviceContext @ 0x55a6c4979f00] Initialize MFX session: implementation version is 1.35
[h264_mp4toannexb @ 0x55a6c4a49ec0] The input looks like it is Annex B already
[out#0/tee @ 0x55a6c497ad00] Codec AVOption forced-idr (If forcing keyframes, force them as IDR frames.) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[out#0/tee @ 0x55a6c497ad00] Codec AVOption coder (Coder type) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> h264 (h264_qsv))
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
[tee @ 0x5594111eab00] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x5594111e5e80] segment:'/record/kitchen/kitchen_2023-07-27_01-46-40_UTC.mp4' starts with packet stream:0 pts:0 pts_time:0 frame:0
[graph 0 input from stream 0:0 @ 0x55ff5baecc00] w:1728 h:1296 pixfmt:qsv tb:1/1200000 fr:20/1 sar:0/1
[AVHWDeviceContext @ 0x55ff5baeb2c0] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ().
[AVHWDeviceContext @ 0x55ff5baeb2c0] Driver not found in known nonstandard list, using standard behaviour.
[Parsed_vpp_qsv_0 @ 0x55ff5baec1c0] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[Parsed_vpp_qsv_0 @ 0x55ff5baec1c0] VPP: input is video memory surface
[Parsed_vpp_qsv_0 @ 0x55ff5baec1c0] VPP: output is video memory surface
[h264_qsv @ 0x55ff5ba8b600] Using input frames context (format qsv) with h264_qsv encoder.
[h264_qsv @ 0x55ff5ba8b600] Encoder: input is video memory surface
[h264_qsv @ 0x55ff5ba8b600] Use Intel(R) oneVPL to create MFX session with the specified MFX loader
[h264_qsv @ 0x55ff5ba8b600] Using the constant bitrate (CBR) ratecontrol method
[h264_qsv @ 0x55ff5ba8b600] Selected ratecontrol mode is unsupported
[h264_qsv @ 0x55ff5ba8b600] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
[vost#0:0/h264_qsv @ 0x55ff5ba8d040] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Function not implemented
[vist#0:0/h264 @ 0x55ff5ba01ec0] Decoder thread received EOF packet
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    
[tee @ 0x5597f05d5a40] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x5597f05d8500] segment:'/record/shed/shed_2023-07-27_01-46-40_UTC.mp4' starts with packet stream:0 pts:0 pts_time:0 frame:0
[h264_qsv @ 0x55ff5ba11080] A decode call did not consume any data: expect more data at input (-10)
    Last message repeated 2 times
[vist#0:0/h264 @ 0x55ff5ba01ec0] Decoder returned EOF, finishing
[vist#0:0/h264 @ 0x55ff5ba01ec0] Terminating decoder thread
[out#0/tee @ 0x55ff5ba02640] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=N/A bitrate=N/A speed=N/A    
[in#0/h264 @ 0x55ff5b9ec640] Terminating demuxer thread
[in#0/h264 @ 0x55ff5b9ec640] Input file #0 (pipe:):
[in#0/h264 @ 0x55ff5b9ec640]   Input stream #0:0 (video): 22 packets read (149798 bytes); 20 frames decoded; 0 decode errors; 
[in#0/h264 @ 0x55ff5b9ec640]   Total: 22 packets (149798 bytes) demuxed
[AVIOContext @ 0x55ff5b9fd940] Statistics: 243194 bytes read, 0 seeks
Conversion failed!
frame=    0 fps=0.0 q=-1.0 size=       0kB time=00:00:02.00 bitrate=   0.0kbits/s speed=1.27x    
[tee @ 0x558cae482b80] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[segment @ 0x558cae481540] segment:'/record/garage/garage_2023-07-27_01-46-39_UTC.mp4' starts with packet stream:0 pts:19968 pts_time:1.95 frame:0
[front-door] FFMPEG stopped

@chris001
Copy link

What's the output of vainfo ?

@mitchross
Copy link
Author

mitchross commented Jul 27, 2023

What's the output of vainfo ?

stated earlier/ extra context - I have zero issues with Frigate container . QSV works, GPU acceleration works, etc

no VA info in the container

root@wyze-bridge-59f7d6df66-jmxbz:/app# vainfo
bash: vainfo: command not found
root@wyze-bridge-59f7d6df66-jmxbz:/app#

On the nuc itself

vanillax@k3s-worker-nuc-1:~$ sudo vainfo
[sudo] password for vanillax:
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
PuTTY X11 proxy: Unsupported authorisation protocol

error: can't connect to X server!
libva info: VA-API version 1.17.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.17 (libva 2.12.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.2 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
vanillax@k3s-worker-nuc-1:~$

mrlt8 added a commit that referenced this issue Jul 28, 2023
@mrlt8
Copy link
Owner

mrlt8 commented Jul 28, 2023

Added vainfo and intel-gpu-tools as well as i965-va-driver and i965-va-driver-shaders as an extra step to the dev-qsv image.

Testing would be appreciated.

mrlt8 added a commit that referenced this issue Jul 28, 2023
@mrlt8
Copy link
Owner

mrlt8 commented Jul 28, 2023

new dev-qsv image should be up.

@mitchross
Copy link
Author

root@wyze-bridge-b45bfb685-6vfrp:/app# vainfo
bash: vainfo: command not found
root@wyze-bridge-b45bfb685-6vfrp:/app# intel_gpu_top
bash: intel_gpu_top: command not found
root@wyze-bridge-b45bfb685-6vfrp:/app#

mrlt8 added a commit that referenced this issue Jul 28, 2023
@mrlt8
Copy link
Owner

mrlt8 commented Jul 28, 2023

should be available in the latest dev-qsv

@mitchross
Copy link
Author

Ok now its there ..... ROTATE DOOR still does not work with

  • name: H264_ENC
    value: h264_qsv

vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.1 ()
vainfo: Supported profile and entrypoints
VAProfileNone : VAEntrypointVideoProc
VAProfileNone : VAEntrypointStats
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSliceLP
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSliceLP
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile1 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileVP9Profile3 : VAEntrypointVLD
VAProfileHEVCMain422_10 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointVLD
VAProfileHEVCMain444 : VAEntrypointEncSliceLP
VAProfileHEVCMain444_10 : VAEntrypointVLD
VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP
root@wyze-bridge-55bd658b54-rqbj5:/app#

@392media
Copy link

@mitchross I see you have multiple cameras. Could you test if it works when serving only the doorbell?
I suspect there could be some function limit on different CPU. For me, QSV decode-rotation-encode doesn't work on an i5-6500T but VAAPI works. But QSV works on an i7-7600. My docker system is Unraid.

@392media
Copy link

@mrlt8 It seems the code convert all letters to lower case for the FFMPEG_CMD variable? If so this might break something where a parameter needs capital letters.

mrlt8 added a commit that referenced this issue Jul 28, 2023
@mrlt8
Copy link
Owner

mrlt8 commented Jul 28, 2023

@392media FFMPEG_CMD should be case sensitive now

mrlt8 added a commit that referenced this issue Aug 6, 2023
* PTZ using cover #921

* set min max for rotate button? #921

* only show pan_tilt for pan_cam

* Add extra intel packages #736

* Update Dockerfile.hwaccel

* Revert "Update Dockerfile.hwaccel"

This reverts commit d7de34c.

* Update Dockerfile.qsv

* Update Dockerfile.qsv

* Update Dockerfile.qsv

* Fix typo #736

* copy bins #736

* fix typing warnings

* remove dot from version check

* DEBUG_FFMPEG to FFMPEG_LOGLEVEL

* case sensitive FFMPEG_CMD #736

* Add ffmpeg filter_complex config #919

* Adjust bitrate

* Skip audio buffer check #388

* Revert "Skip audio buffer check #388"

This reverts commit 79ace0c.

* changelog
@carldanley
Copy link

Anything I can do to help bump this? I've been running dev-qsv since I commented on the PR awhile ago; everything seems to work well on my end - not sure that is helpful feedback though?

@lygris
Copy link

lygris commented Sep 27, 2023

Anything I can do to help bump this? I've been running dev-qsv since I commented on the PR awhile ago; everything seems to work well on my end - not sure that is helpful feedback though?

I've been running it for awhile as well and was hoping we would get the rotate video piece working so my doorbell video is normal again. other than rotate, it has worked flawlessly

mrlt8 added a commit that referenced this issue Oct 10, 2023
* audio latency #388

* Motion Events

* Log number of cams from API #974

* Store and reuse s3 thumbnail from events #970

* better error handling

* Increase MTX_WRITEQUEUESIZE #984

* MOTION_START for HA

* limit login attempts

* pass exceptions upstream

* motion images for webhooks/ntfy in header

* REST API motion endpoint

* Additional audio codecs

* keep stream alive if livestream enabled #985

* Catch RuntimeError #994

* assert bitrate value

* refactor av_send_io_ctrl

* Refactor API client and use battery from device_info

* motion_ts endpoint

* use .pipe instead of .wav for audio pipe

* update frame size if not preferred_frame_size

* Exclude battery cams from RTSP snapshots #970

* revert changes

* buffer mtx event data #990

* Match all 11.x or newer firmware #975

* MOTION_WEBHOOKS

* clean

* revert changes

* Media MTX changes

* ffmpeg v6

* Use ffmpeg-for-homebridge in QSV build #736

* remove unneeded packages

* don't return none

* Adjust queue size and compression #388

* Adjust sleep, queue, and fifo for lag

* Catch other HTTPErrors for events

* Revert "Adjust sleep, queue, and fifo for lag"

* Update ffmpeg.py

* Update tutk.py

* adjust thread_queue_size #388

* Add build date time

* Update ffmpeg.py

* Additional queue tweaks and fifo options #388

* Catch RequestException in motion events

* Update MediaMTX version from v1.1.0 to v1.1.1 (#1007) (#1008)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mrlt8 <mrlt8@users.noreply.github.com>

* Fix ETag header for MediaMTX 1.1.1

* Don't use wallclock  #388

* remove asetpts

* audio #388

* Update ffmpeg.py

* allow wallclock flag in FFMPEG_FLAGS #388

* changelog

* Update .env
@mitchross
Copy link
Author

Anything I can do to help bump this? I've been running dev-qsv since I commented on the PR awhile ago; everything seems to work well on my end - not sure that is helpful feedback though?

I've been running it for awhile as well and was hoping we would get the rotate video piece working so my doorbell video is normal again. other than rotate, it has worked flawlessly

Can you share your env configs ?

@lygris
Copy link

lygris commented Nov 29, 2023

Anything I can do to help bump this? I've been running dev-qsv since I commented on the PR awhile ago; everything seems to work well on my end - not sure that is helpful feedback though?

I've been running it for awhile as well and was hoping we would get the rotate video piece working so my doorbell video is normal again. other than rotate, it has worked flawlessly

Can you share your env configs ?

Sorry I missed your reply for so long. Running this on unraid so the format is a little weird but here's the env configs

<Config Name="WYZE_EMAIL" Target="WYZE_EMAIL" Default="" Mode="" Description="" Type="Variable" Display="always" Required="true" Mask="false">******************</Config> <Config Name="WYZE_PASSWORD" Target="WYZE_PASSWORD" Default="" Mode="" Description="" Type="Variable" Display="always" Required="true" Mask="false">**************</Config> <Config Name="Fresh Data" Target="FRESH_DATA" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">True</Config> <Config Name="WebUI" Target="5000" Default="5000" Mode="tcp" Description="" Type="Port" Display="always" Required="false" Mask="false">5000</Config> <Config Name="WB_IP" Target="WB_IP" Default="" Mode="" Description="WB_IP env needs to be set with the IP address of the server running the bridge." Type="Variable" Display="always" Required="false" Mask="false">10.0.6.38</Config> <Config Name="Rotate" Target="ROTATE_DOOR" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">False</Config> <Config Name="QUALITY" Target="QUALITY" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">HD120</Config> <Config Name="Audio" Target="ENABLE_AUDIO" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">True</Config> <Config Name="persistant" Target="ON_DEMAND" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">False</Config> <Config Name="H264_ENC" Target="H264_ENC" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">h264_qsv</Config> <Config Name="WebRTC/ICE" Target="8189" Default="8189" Mode="udp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8189</Config> <Config Name="WebRTC" Target="8889" Default="8889" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8889</Config> <Config Name="HLS Port" Target="8888" Default="8888" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8888</Config> <Config Name="RTMP Port" Target="1935" Default="1935" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">1935</Config> <Config Name="RTSP Port" Target="8554" Default="8554" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8554</Config> <Config Name="Net_Mode" Target="LAN" Default="LAN" Mode="" Description="https://github.com/mrlt8/docker-wyze-bridge#LAN-Mode" Type="Variable" Display="advanced" Required="false" Mask="false">LAN</Config>

@Thatindianbruh
Copy link

Anything I can do to help bump this? I've been running dev-qsv since I commented on the PR awhile ago; everything seems to work well on my end - not sure that is helpful feedback though?

I've been running it for awhile as well and was hoping we would get the rotate video piece working so my doorbell video is normal again. other than rotate, it has worked flawlessly

Can you share your env configs ?

Sorry I missed your reply for so long. Running this on unraid so the format is a little weird but here's the env configs

<Config Name="WYZE_EMAIL" Target="WYZE_EMAIL" Default="" Mode="" Description="" Type="Variable" Display="always" Required="true" Mask="false">******************</Config> <Config Name="WYZE_PASSWORD" Target="WYZE_PASSWORD" Default="" Mode="" Description="" Type="Variable" Display="always" Required="true" Mask="false">**************</Config> <Config Name="Fresh Data" Target="FRESH_DATA" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">True</Config> <Config Name="WebUI" Target="5000" Default="5000" Mode="tcp" Description="" Type="Port" Display="always" Required="false" Mask="false">5000</Config> <Config Name="WB_IP" Target="WB_IP" Default="" Mode="" Description="WB_IP env needs to be set with the IP address of the server running the bridge." Type="Variable" Display="always" Required="false" Mask="false">10.0.6.38</Config> <Config Name="Rotate" Target="ROTATE_DOOR" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">False</Config> <Config Name="QUALITY" Target="QUALITY" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">HD120</Config> <Config Name="Audio" Target="ENABLE_AUDIO" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">True</Config> <Config Name="persistant" Target="ON_DEMAND" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">False</Config> <Config Name="H264_ENC" Target="H264_ENC" Default="" Mode="" Description="" Type="Variable" Display="always" Required="false" Mask="false">h264_qsv</Config> <Config Name="WebRTC/ICE" Target="8189" Default="8189" Mode="udp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8189</Config> <Config Name="WebRTC" Target="8889" Default="8889" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8889</Config> <Config Name="HLS Port" Target="8888" Default="8888" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8888</Config> <Config Name="RTMP Port" Target="1935" Default="1935" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">1935</Config> <Config Name="RTSP Port" Target="8554" Default="8554" Mode="tcp" Description="" Type="Port" Display="advanced" Required="false" Mask="false">8554</Config> <Config Name="Net_Mode" Target="LAN" Default="LAN" Mode="" Description="https://github.com/mrlt8/docker-wyze-bridge#LAN-Mode" Type="Variable" Display="advanced" Required="false" Mask="false">LAN</Config>

Config Name Target Default Mode Value
WYZE_EMAIL WYZE_EMAIL **********
WYZE_PASSWORD WYZE_PASSWORD *********
Fresh Data FRESH_DATA True
WebUI 5000 5000 tcp 5000
WB_IP WB_IP 10.0.6.38
Rotate ROTATE_DOOR False
QUALITY QUALITY HD120
Audio ENABLE_AUDIO True
persistant ON_DEMAND False
H264_ENC H264_ENC h264_qsv
WebRTC/ICE 8189 8189 udp 8189
WebRTC 8889 8889 tcp 8889
HLS Port 8888 8888 tcp 8888
RTMP Port 1935 1935 tcp 1935
RTSP Port 8554 8554 tcp 8554
Net_Mode LAN LAN LAN

converted it to markdown for easier reading and remove irrelevant columns.

I tried your settings and they work as is, but break when rotate door is set to true. I think the goal for quicksync was to rotate the door camera and use less resources.

@mitchross any ideas?

@dnikles
Copy link

dnikles commented Jun 18, 2024

Is there anything beyond pulling latest-qsv, and using environment variable H264_ENC=h264_qsv needed to get this working? I've done this and mapped /dev/dri:/dev/dri but it doesn't seem like it's using qsv. I don't see anything about it in logs and I don't see any activity using intel_gpu_top. I don't have any errors, it's working, but I don't think it's using hardware acceleration.

@mitchross
Copy link
Author

Is there anything beyond pulling latest-qsv, and using environment variable H264_ENC=h264_qsv needed to get this working? I've done this and mapped /dev/dri:/dev/dri but it doesn't seem like it's using qsv. I don't see anything about it in logs and I don't see any activity using intel_gpu_top. I don't have any errors, it's working, but I don't think it's using hardware acceleration.

i haven't worked on it in a while. gave up and bought nest cameras

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants