ngraziano / SharpRTSP

A RTSP handling library
Other
519 stars 181 forks source link

Could not write header for output file #0 (incorrect codec parameters ?): Server returned 400 Bad Request #79

Closed totalitarian closed 3 months ago

totalitarian commented 1 year ago

Any idea what I could be doing wrong here. I'm running this command from docker cli

ffmpeg -re -i "rtsp://admin:admin@192.168.1.149:554/Streaming/Channels/102" -vcodec copy -acodec copy -rtsp_transport udp -f rtsp rtsp://127.0.0.1:8554/test

This is my config

paths:
  all:
  test:

This is the error

root@DockerLXC:/workdir# ffmpeg -re -i "rtsp://admin:admin@192.168.1.149:554/Streaming/Channels/102" -vcodec copy -acodec copy -rtsp_transport udp -f rtsp rtsp://127.0.0.1:8554/test
ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --enable-zlib --enable-libopenjpeg --enable-libwebp --enable-lzma --enable-gmp --enable-iconv --enable-gnutls --enable-libsrt --enable-libvpx --enable-libx264 --enable-libx265 --enable-libaom --enable-libopus --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libmp3lame --enable-libfreetype --enable-libfribidi --enable-libxml2 --enable-libfontconfig --enable-libass --enable-libaribb24 --enable-sdl2 --enable-cuda-llvm --enable-ffnvcodec --enable-cuvid --enable-nvdec --enable-nvenc --enable-libmfx --enable-vaapi --disable-autodetect --disable-debug --disable-doc --enable-gpl --enable-version3 --extra-libs='-lpthread -lstdc++' --pkg-config-flags=--static --prefix=/usr/local
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[rtsp @ 0x55c85c432c80] Missing PPS in sprop-parameter-sets, ignoring
Input #0, rtsp, from 'rtsp://admin:admin@192.168.1.149:554/Streaming/Channels/102':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 768x1024, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Could not write header for output file #0 (incorrect codec parameters ?): Server returned 400 Bad Request
Error initializing output stream 0:1 -- 
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times
RogerHardiman commented 1 year ago

ffmpeg is unable to extract the SPS/PPS data from the RTSP source. "Missing PPS in sprop-parameter-sets, ignoring". So the H264 decoder can probably cope with the lack of PPS in the reply to the rtsp DESCRIBE message (in the SDP data). But the part of ffmpeg that outputs the video and audio (on to a RTSP destination) would need that and so falls over

RogerHardiman commented 1 year ago

What is the video source at 192.168.1.149?

totalitarian commented 1 year ago

What is the video source at 192.168.1.149?

It's a camera feed from an EZviz DB1 doorbell

RogerHardiman commented 1 year ago

Hi. It looks like the feed from your doorbell is not RTSP compliant. You could getting ffmpeg to transcode. It will use CPU resources but should fix the problem

totalitarian commented 1 year ago

Hi. It looks like the feed from your doorbell is not RTSP compliant. You could getting ffmpeg to transcode. It will use CPU resources but should fix the problem

rtsp-simple server & vlc can ready and proxy the original stream file just fine. FFMPEG seems to be having issues. I will be using a video filter so will will need to transcode anyway. Could you help me with the transcode part?

totalitarian commented 1 year ago

Never mind, it was an issue with the version of ffmpeg I was using