bluecherrydvr / bluecherry-apps

Bluecherry surveillance system (server application)
http://www.bluecherrydvr.com
GNU General Public License v2.0
199 stars 64 forks source link

Missing codec #521

Open tonywtrd opened 2 years ago

tonywtrd commented 2 years ago

Is FFmpeg updated ? Can't downloads playback as MP4.

MP4 file preparation failed:

ffmpeg version n3.0 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/build/source/stage --disable-static --enable-shared --cc='ccache gcc -std=c99' --enable-pic --disable-stripping --disable-doc --disable-libxcb --disable-xlib --disable-sdl --disable-everything --enable-indev=v4l2 --enable-protocol=file --enable-protocol=pipe --enable-protocol=http --enable-protocol=https --enable-muxer=matroska --enable-muxer=mjpeg --enable-muxer=rtp --enable-muxer=mp4 --enable-muxer=image2 --enable-muxer=rawvideo --enable-demuxer=rtsp --enable-demuxer=matroska --enable-demuxer=mjpeg --enable-demuxer=rawvideo --enable-demuxer=concat --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mjpeg --enable-decoder=rawvideo --enable-decoder=aac --enable-decoder=ac3 --enable-decoder=mp2 --enable-decoder=mp3 --enable-decoder=wav --enable-decoder=pcm_f32le --enable-decoder=pcm_f64le --enable-decoder=pcm_s16le --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mjpeg --enable-encoder=mjpeg --enable-encoder=mpeg4 --enable-encoder=rawvideo --enable-encoder=aac --enable-filter=scale --enable-filter=fps --enable-filter=aresample
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
[matroska,webm @ 0x5555a2802580] Could not find codec parameters for stream 1 (Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, 1 channels, 64 kb/s): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, matroska,webm, from '/recordings/2021/11/09/000001/06-19-28.mkv':
Metadata:
ENCODER : Lavf57.25.100
Duration: 00:15:04.44, start: 0.000000, bitrate: 24 kb/s
Stream #0:0: Video: h264 (Main), yuv420p, 640x352, SAR 1:1 DAR 20:11, 8 fps, 25 tbr, 1k tbn, 16 tbc (default)
Metadata:
DURATION : 00:15:04.440000000
Stream #0:1: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, 1 channels, 64 kb/s (default)
Metadata:
DURATION : 00:00:00.000000000
No decoder for stream #0:1, filtering impossible
Error opening filters!

I used the automatic bash script for installation of version 2 on Debian 9.

tonywtrd commented 2 years ago

Ok i just realized that it still use a 2016 release.

is this normal?

there 's huge list of new codec missing, is there simple way of updating ffmpeg without moving newer binary of ffmpeg to /usr/lib/bluecherry

thanks

alexc20 commented 2 years ago

@tonywtrd I think your camera is encoding audio in pcm-alaw which is not supported by the version of ffmpeg that is used. A quick fix would be to change the audio codec to aac in your camera settings.

tonywtrd commented 2 years ago

@tonywtrd I think your camera is encoding audio in pcm-alaw which is not supported by the version of ffmpeg that is used. A quick fix would be to change the audio codec to aac in your camera settings.

Thanks for your answer.

Is this something done in the device setting itself? Like firmware etc or it should be done in Bluecherry app cuz i don't see any place where codec can be changed. The doc is verry limited 😅

Thanks alot.

alexc20 commented 2 years ago

Thanks for your answer.

Is this something done in the device setting itself? Like firmware etc or it should be done in Bluecherry app cuz i don't see any place where codec can be changed. The doc is verry limited 😅

Thanks alot.

In the bluecherry UI, Devices -> [Your Camera] -> On camera configuration will forward you to the camera admin page. Go to audio settings tab(this may vary depending on camera models but you can find a place for video/audio configuration ), then set the audio codec.

tonywtrd commented 2 years ago

Thanks Alex.

Actually, i ended up updating FFMPEG since i use Chinese cam and look like there's no access to web GUI.

Btw, thanks for point me out the issues and here a bash script i made to updated without all the pain it is (since Bluecherry don't system FFMPEG but FFMPEG binary inside installation folders) since i got a bunch of installation of Bluecherry and FFMPEG in the Bluecherry was kinda old,something like 2016 if i can remember.

https://github.com/tonywtrd/bluecherry2-ffmpeg-update

andrey-utkin commented 1 month ago

Confirming this with Bluecherry 3.1.1.

For now, workarounds are:

For example, Bluecherry server fails to save recordings Tapo С100 wifi camera with audio enabled (which is the default). Streaming works. It's not a matter of old ffmpeg - it's probably just not possible for MP4 container.

May 23 15:36:07 bluecherry bc-server[11351]: D(1/tapo): [libav] error Could not find tag for codec pcm_alaw in stream #1, codec not currently supported in container
May 23 15:36:07 bluecherry bc-server[11351]: E(1/tapo): Failed to init muxer for output file /var/lib/bluecherry/recordings/2024/05/23/000001/15-36-06.mp4: Invalid argument (-22)
May 23 15:36:07 bluecherry bc-server[11351]: D(1/tapo): [libav] verbose Statistics: 0 seeks, 0 writeouts
May 23 15:36:07 bluecherry bc-server[11351]: E(1/tapo): Cannot start recording!

Fedora 39 ffmpeg can't do that in the same way:

 $ ffmpeg   -i rtsp://.../stream1 -c copy -y capture.mp4
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcodec2 --enable-libcdio --enable-libdrm --enable-libjack --enable-libjxl --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-libplacebo --enable-librsvg --enable-librav1e --enable-librubberband --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libshaderc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libvpl --enable-runtime-cpudetect
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, rtsp, from 'rtsp://.../stream1':
  Metadata:
    title           : Session streamed by "TP-LINK RTSP Server"
    comment         : stream1
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
[mp4 @ 0x55e5750f03c0] Could not find tag for codec pcm_alaw in stream #1, codec not currently supported in container
[out#0/mp4 @ 0x55e5750b0840] Could not write header (incorrect codec parameters ?): Invalid argument
Error opening output file direct_rtsp_capture_old.mp4.
Error opening output files: Invalid argument

Matroska as the recordings saving container would work in this case.