Search code examples
opencvffmpegdockerstreamingrtsp

ffmpeg failed - 455 Method Not Valid in This State


I created a nodejs app that gets an rtsp streaming with FFMPEG to analyse it with Opencv3. It is working if I install FFMPEG and opencv in my local.

But now I created a docker image that contains the installation of those libraries and I'm using it as a base to create another image & container where I'm trying to run my app. When I run it inside that container I get this error over and over again when trying to get the rtsp stream with an FFMPEG instruction for "method SETUP failed: 455 Method Not Valid in This State".

This is how I am installing FFMPEG in the image:

# ---------------------- OpenCV ffmpeg ---------------------------#
RUN mkdir -p /opt/src \
 && curl -Lo /opt/src/ffmpeg-${FFMPEG_VERSION}.tar.gz \
    http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 \
  && tar -xvf /opt/src/ffmpeg-${FFMPEG_VERSION}.tar.gz -C /opt/src \
  && cd /opt/src/ffmpeg-${FFMPEG_VERSION} \
  && ./configure --enable-gpl --enable-avresample --enable-libopencore-amrnb \
  --enable-libx264 --enable-libxvid --enable-postproc --enable-version3 \
  --enable-shared --enable-pic --extra-ldexeflags=-pie \
  && make -j $(nproc) \
  && make install \
  && ldconfig -v \
  && rm -rf /opt/src

# ---------------------- OpenCV stuff ---------------------------#
RUN mkdir -p /opt/src/opencv-${OPENCV_VERSION}/build \
  && curl -sLo /opt/src/opencv3.tar.gz \
     https://github.com/Itseez/opencv/archive/${OPENCV_VERSION}.tar.gz \
  && tar -xzvf /opt/src/opencv3.tar.gz -C /opt/src \
  && cd /opt/src/opencv-${OPENCV_VERSION}/build \
  && cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D WITH_TBB=ON \
    -D WITH_OPENMP=ON \
    -D WITH_FFMPEG=ON .. \
  && make -j "$(nproc)" \
  && make install \
  && ldconfig -v \
  && rm -rf /opt/src

Do you have any idea what this error is and how to fix it? I think it might have to do with the initial configuration on the installation of either of them (FFMPEG or OPENCV).

Thanks for your help


Solution

  • It turns out that there is a fix in the new version of OpenCV released recently (Opencv3.1) that takes in consideration tcp transport, so by upgrading to the newest I managed to fix the problem