Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (40)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (7624)

  • Compile Shotdetect on CentOS 7

    14 septembre 2015, par BitLegacy01

    I’m migrating a service from a Debian server to a CentOS 7 one.

    The service needs the Shotdetect command (github , official site).

    I could not make it work on CentOS though I followed all steps :

    1. Compile ffmpeg compilation guide

      # ffmpeg
      ffmpeg version git-2015-08-21-7a806c6 Copyright (c) 2000-2015 the FFmpeg developers
       built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
       configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --disable-libmp3lame --disable-libopus --disable-libvorbis --disable-libvpx --enable-libx264 --disable-libx265 --disable-lzma
       libavutil      54. 31.100 / 54. 31.100
       libavcodec     56. 58.100 / 56. 58.100
       libavformat    56. 40.101 / 56. 40.101
       libavdevice    56.  4.100 / 56.  4.100
       libavfilter     5. 36.100 /  5. 36.100
       libswscale      3.  1.101 /  3.  1.101
       libswresample   1.  2.101 /  1.  2.101
       libpostproc    53.  3.100 / 53.  3.100
      Hyper fast Audio and Video encoder
      usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
      1. Install needed packages

        # yum install gd-devel libxml2-devel libxslt-devel clang libvpx libvorbis
      2. Add pthread in the CMakeList file, in TARGET_LINK_LIBRARIES, because it throws an lpthread missing in linker error

      3. Compile Shotdetect

        # FFMPEG_DIR="/root/ffmpeg_build"  ./compile.sh cmd

    5.Lost in contemplation

    -- avformat library found: /root/ffmpeg_build/lib/libavformat.a
    -- avcodec library found: /root/ffmpeg_build/lib/libavcodec.a
    -- avutil library found: /root/ffmpeg_build/lib/libavutil.a
    -- swscale library found: /root/ffmpeg_build/lib/libswscale.a
    Found all FFmpeg libraries in /root/ffmpeg_build/lib/libavformat.a;/root/ffmpeg_build/lib/libavdevice.a;/root/ffmpeg_build/lib/libavcodec.a;/root/ffmpeg_build/lib/libavutil.a;/root/ffmpeg_build/lib/libswscale.a.
    -- Found GD: /usr/lib64/libgd.so
    Found libgd: /usr/lib64/libgd.so;/usr/lib64/libpng.so;/usr/lib64/libz.so;/usr/lib64/libjpeg.so in /usr/include
    Found libxml2: /usr/lib64/libxml2.so in /usr/include/libxml2
    Found libxslt: /usr/lib64/libxslt.so in /usr/include
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /root/Shotdetect-master/build
    [ 71%] Built target shotdetect
    Linking CXX executable shotdetect-cmd
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:323: undefined reference to « aacDecoder_Fill »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:329: undefined reference to « aacDecoder_DecodeFrame »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « get_stream_info »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:88: undefined reference to « aacDecoder_GetStreamInfo »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:201: undefined reference to « aacDecoder_Close »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:214: undefined reference to « aacDecoder_Open »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:221: undefined reference to « aacDecoder_ConfigRaw »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:228: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:252: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:270: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:277: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:284: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:291: encore plus de références indéfinies suivent vers « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:261: undefined reference to « aacDecoder_AncDataInit »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_flush »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:367: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:97: undefined reference to « aacEncClose »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:357: undefined reference to « aacEncEncode »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:114: undefined reference to « aacEncOpen »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:123: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:130: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:138: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:172: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:179: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:197: encore plus de références indéfinies suivent vers « aacEncoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:276: undefined reference to « aacEncEncode »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:282: undefined reference to « aacEncInfo »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:260: undefined reference to « x264_picture_init »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:262: undefined reference to « x264_bit_depth »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:246: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:289: undefined reference to « x264_encoder_delayed_frames »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:173: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:178: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:185: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:205: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:211: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:191: encore plus de références indéfinies suivent vers « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init_static »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:806: undefined reference to « x264_bit_depth »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:339: undefined reference to « x264_encoder_close »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:413: undefined reference to « x264_param_default »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:418: undefined reference to « x264_param_default_preset »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:440: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:470: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:514: undefined reference to « x264_levels »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:516: undefined reference to « x264_levels »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:540: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:541: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:542: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:543: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:601: undefined reference to « x264_param_apply_fastfirstpass »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:651: undefined reference to « x264_param_apply_profile »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:703: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:705: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:717: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:735: undefined reference to « x264_encoder_open_148 »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:744: undefined reference to « x264_encoder_headers »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:379: undefined reference to « swr_is_initialized »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:220: undefined reference to « swr_is_initialized »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_init_resample »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:161: undefined reference to « swr_init »
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:167: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:234: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_flush_resample »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:115: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:411: undefined reference to « swr_close »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_flush »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:614: undefined reference to « swr_close »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:638: undefined reference to « swr_free »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:705: undefined reference to « swr_alloc »
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [shotdetect-cmd] Error 1
    make[1]: *** [CMakeFiles/shotdetect-cmd.dir/all] Error 2
    make: *** [all] Error 2

    I’ve done a lot of research about the above errors but I didn’t find any clue.

    How to compile successfully Shotdetect on CentOS7 ?

    Thanks to tryp here is a working CMakelist file :

    # CMake integration by Christian Frisson
    cmake_minimum_required(VERSION 2.8)
    PROJECT(shotdetect)

    SET(CMAKE_C_COMPILER "/usr/bin/clang")
    SET(CMAKE_CXX_COMPILER "/usr/bin/clang++")
    SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")


    # Get git version information for automatic embedding in version string:

    include(GetGitRevisionDescription)
    get_git_head_revision(GIT_REFSPEC GIT_SHA1)
    # Take the first 12 characters of the SHA1 as short identifier:
    STRING(SUBSTRING ${GIT_SHA1} 0 11 GIT_SHA1_SHORT)
    configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/version.cc.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cc" @ONLY)
    list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/version.cc" src/version.h)

    # Miscellaneous compilation options:

    OPTION(USE_WXWIDGETS "Compile GUI app with wxWidgets, otherwise commandline app" ON)
    OPTION(USE_POSTGRESQL "Compile with PostgreSQL support" OFF)

    # Dependency: pkg-config (required if cross-compiling with MXE)

    IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
       FIND_PACKAGE (PkgConfig)
       IF(NOT PKG_CONFIG_FOUND)
           MESSAGE(FATAL_ERROR "pkgconfig required for cross-compiling with MXE for windows")
       ENDIF()
       SET(PKG_CONFIG_EXECUTABLE ${PKG_CONFIG_EXECUTABLE} CACHE STRING "pkg-config")
    ENDIF()

    # Dependency: FFmpeg (required)

    FIND_PACKAGE( FFmpeg )
    IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
       PKG_CHECK_MODULES (FFMPEG_PKG REQUIRED libavcodec libavfilter libavutil libavdevice libavformat libavformat libswscale)
       IF (FFMPEG_PKG_FOUND)
           MESSAGE( "FFmpeg cflags found through pkg-config: ${FFMPEG_PKG_CFLAGS}" )
           MESSAGE( "FFmpeg ldflags found through pkg-config: ${FFMPEG_PKG_LDFLAGS}" )
           STRING(REGEX REPLACE ";" " " FFMPEG_PKG_CFLAGS "${FFMPEG_PKG_CFLAGS}")
           SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FFMPEG_PKG_CFLAGS}")
           SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FFMPEG_PKG_CFLAGS}")
           SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARY} ${FFMPEG_PKG_LDFLAGS})
           MESSAGE("FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES}")
       ELSE (FFMPEG_PKG_FOUND)
           MESSAGE( FATAL_ERROR "FFmpeg cflags/ldflags not found through pkg-config." )
       ENDIF (FFMPEG_PKG_FOUND)
    ENDIF()
    IF(FFMPEG_LIBAVFORMAT_FOUND)
       MESSAGE(STATUS "avformat library found: ${FFMPEG_LIBAVFORMAT_LIBRARIES}")
    ELSE()
       MESSAGE(STATUS "avformat library not found.")
    ENDIF()
    IF(FFMPEG_LIBAVCODEC_FOUND)
       MESSAGE(STATUS "avcodec library found: ${FFMPEG_LIBAVCODEC_LIBRARIES}")
    ELSE()
       MESSAGE(STATUS "avcodec library not found.")
    ENDIF()
    IF(FFMPEG_LIBAVUTIL_FOUND)
       MESSAGE(STATUS "avutil library found: ${FFMPEG_LIBAVUTIL_LIBRARIES}")
    ELSE()
       MESSAGE(STATUS "avutil library not found.")
    ENDIF()
    IF(FFMPEG_LIBSWSCALE_FOUND)
       MESSAGE(STATUS "swscale library found: ${FFMPEG_LIBSWSCALE_LIBRARIES}")
    ELSE()
       MESSAGE(STATUS "swscale library not found.")
    ENDIF()
    IF(FFMPEG_FOUND)
       INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
       SET(FFMPEG_LIBRARIES "${FFMPEG_LIBRARIES};/root/ffmpeg_build/lib/libswresample.a;/root/ffmpeg_build/lib/libx264.a;/lib64/libdl.so.2;/root/ffmpeg_build/lib/libfdk-aac.a;/root/ffmpeg_build/lib/libswresample.a")
       MESSAGE("Found all FFmpeg libraries in ${FFMPEG_LIBRARIES}.")
    ELSE()
       MESSAGE(FATAL_ERROR "Some FFmpeg libraries are missing.")
    ENDIF()

    # Dependency: GD (required)

    FIND_PACKAGE(GD REQUIRED)
    IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
       EXEC_PROGRAM(${CMAKE_FIND_ROOT_PATH}/bin/gdlib-config ARGS "--cflags" OUTPUT_VARIABLE GD_PKG_CFLAGS)
       EXEC_PROGRAM(${CMAKE_FIND_ROOT_PATH}/bin/gdlib-config ARGS "--libs" OUTPUT_VARIABLE GD_PKG_LDFLAGS)
       MESSAGE( "gd cflags found through gdlib-config: ${GD_PKG_CFLAGS}" )
       MESSAGE( "gd ldflags found through gdlib-config: ${GD_PKG_LDFLAGS}" )
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GD_PKG_CFLAGS}")
       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GD_PKG_CFLAGS}")
       SET(GD_LIBRARIES ${GD_LIBRARY} ${GD_PKG_LDFLAGS})
       MESSAGE("GD_LIBRARIES ${GD_LIBRARIES}")
    ENDIF()
    IF(GD_FOUND)
       INCLUDE_DIRECTORIES(${GD_INCLUDE_DIR})
       MESSAGE("Found libgd: ${GD_LIBRARIES} in ${GD_INCLUDE_DIR}")
    ELSE()
       MESSAGE(FATAL_ERROR "Couldn't find libgd")
    ENDIF()

    # Dependency: libxml2 (required)

    FIND_PACKAGE(LibXml2 2.7 REQUIRED)
    IF ( MINGW AND CMAKE_TOOLCHAIN_FILE)
       PKG_CHECK_MODULES (LIBXML2_PKG REQUIRED libxml-2.0)
       IF (LIBXML2_PKG_FOUND)
           MESSAGE( "LibXml2 cflags found through pkg-config: ${LIBXML2_PKG_CFLAGS}" )
           MESSAGE( "LibXml2 ldflags found through pkg-config: ${LIBXML2_PKG_LDFLAGS}" )
           STRING(REGEX REPLACE ";" " " LIBXML2_PKG_CFLAGS "${LIBXML2_PKG_CFLAGS}")
           SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBXML2_PKG_CFLAGS}")
           SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBXML2_PKG_CFLAGS}")
           SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} ${LIBXML2_PKG_LDFLAGS})
           MESSAGE("LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES}")
       ELSE (LIBXML2_PKG_FOUND)
           MESSAGE( FATAL_ERROR "LibXml2 cflags/ldflags not found through pkg-config." )
       ENDIF (LIBXML2_PKG_FOUND)
    ENDIF()
    IF(LIBXML2_FOUND)
       MESSAGE("Found libxml2: ${LIBXML2_LIBRARIES} in ${LIBXML2_INCLUDE_DIR}")
       INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
    ELSE()
       MESSAGE(FATAL_ERROR "Couldn't find libxml2")
    ENDIF()

    # Dependency: libxslt (required)

    FIND_PACKAGE(LibXslt REQUIRED)
    IF(LIBXSLT_FOUND)
       MESSAGE("Found libxslt: ${LIBXSLT_LIBRARIES} in ${LIBXSLT_INCLUDE_DIR}")
       INCLUDE_DIRECTORIES(${LIBXSLT_INCLUDE_DIR})
    ELSE()
       MESSAGE(FATAL_ERROR "Couldn't find libxslt")
    ENDIF()

    # Dependency: wxWidgets (optional)
    IF(USE_WXWIDGETS)
       FIND_PACKAGE(wxWidgets)# COMPONENTS core base)
       IF(wxWidgets_FOUND)
           MESSAGE("Found wxWidgets: ${wxWidgets_LIBRARIES} in ${wxWidgets_INCLUDE_DIRS}")
           INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
           ADD_DEFINITIONS(-DWXWIDGETS)
           INCLUDE("${wxWidgets_USE_FILE}")
       ELSE()
           MESSAGE(FATAL_ERROR "Couldn't find wxWidgets. Set USE_WXWIDGETS to OFF or install wxWidgets.")
       ENDIF()
    ENDIF()

    # Dependency: PostgreSQL (optional)
    IF(USE_POSTGRESQL)
       FIND_PACKAGE(PostgreSQL)
       IF(PostgreSQL_FOUND)
           MESSAGE("Found PostgreSQL: ${PostgreSQL_LIBRARIES} in ${PostgreSQL_INCLUDE_DIR}")
           INCLUDE_DIRECTORIES(${PostgreSQL_INCLUDE_DIR})
       ELSE()
           MESSAGE(FATAL_ERROR "Couldn't find PostgreSQL. Set USE_POSTGRESQL to OFF or install PostgreSQL.")
       ENDIF()
    ENDIF()

    # shotdetect

    SET(TARGET_NAME "shotdetect")
    INCLUDE_DIRECTORIES(.)

    # shotdetect library

    SET(${TARGET_NAME}_LIBRARY_SRCS src/film.cc src/graph.cc src/image.cc src/shot.cc src/xml.cc)
    SET(${TARGET_NAME}_LIBRARY_HDRS  src/film.h src/graph.h src/image.h src/shot.h src/xml.h)
    IF(USE_POSTGRESQL)
       SET(${TARGET_NAME}_LIBRARY_SRCS ${${TARGET_NAME}_LIBRARY_SRCS} src/bdd.cc)
       SET(${TARGET_NAME}_LIBRARY_HDRS ${${TARGET_NAME}_LIBRARY_HDRS} src/bdd.h)
    ENDIF()
    ADD_LIBRARY(${TARGET_NAME} ${${TARGET_NAME}_LIBRARY_SRCS} ${${TARGET_NAME}_LIBRARY_HDRS})
    TARGET_LINK_LIBRARIES(${TARGET_NAME} ${FFMPEG_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${GD_LIBRARIES} "pthread" "m" "z")
    IF(USE_WXWIDGETS AND wxWidgets_FOUND)
       TARGET_LINK_LIBRARIES(${TARGET_NAME} ${wxWidgets_LIBRARIES})
    ENDIF()
    IF(USE_POSTGRESQL AND PostgreSQL_FOUND)
       TARGET_LINK_LIBRARIES(${TARGET_NAME} ${PostgreSQL_LIBRARY})
    ENDIF()

    # shotdetect application: gui or commandline

    IF(APPLE)
       SET(APP_TYPE "MACOSX_BUNDLE")
    ELSEIF(WIN32)
       SET(APP_TYPE "WIN32")
    ENDIF()

    IF(USE_WXWIDGETS AND wxWidgets_FOUND)
       LIST(APPEND ${TARGET_NAME}_GUI_SRCS src/main.cc src/ui/dialog_help.cc src/ui/dialog_shotdetect.cc src/ui/process_video_thread.cc)
       LIST(APPEND ${TARGET_NAME}_GUI_HDRS src/ui/dialog_help.h src/ui/dialog_shotdetect.h src/ui/process_video_thread.h)
       ADD_EXECUTABLE(${TARGET_NAME}-gui ${APP_TYPE} ${SOURCES} ${${TARGET_NAME}_GUI_SRCS} ${${TARGET_NAME}_GUI_HDRS})
       TARGET_LINK_LIBRARIES(${TARGET_NAME}-gui ${TARGET_NAME})
       # Make this target optional to install:
       SET(TARGETS_TO_INSTALL ${TARGET_NAME}-gui)
    ELSE()
       LIST(APPEND ${TARGET_NAME}_COMMANDLINE_SRCS src/commandline.cc)
       ADD_EXECUTABLE(${TARGET_NAME}-cmd ${SOURCES} ${${TARGET_NAME}_COMMANDLINE_SRCS})
       TARGET_LINK_LIBRARIES(${TARGET_NAME}-cmd ${TARGET_NAME})
       # Make this target optional to install:
       SET(TARGETS_TO_INSTALL ${TARGET_NAME}-cmd)
    ENDIF()


    # Routines for installing shotdetect.
    # Taken from official documentation (http://www.cmake.org/cmake/help/cmake2.6docs.html#command:install)
    install(
       TARGETS ${TARGETS_TO_INSTALL}
       RUNTIME DESTINATION bin
       LIBRARY DESTINATION lib
       ARCHIVE DESTINATION lib/static
    )

    the built binary will be in the built directory, you can move there and execute

    make install

    to make the binary system wide.

  • ffmpeg Command in Docker with Rust Tokio Closes Warp Server Connection (curl 52 Error)

    3 juin 2024, par user762345

    I’m encountering an issue where executing an ffmpeg concatenation command through Rust’s Tokio process in a Docker container causes subsequent HTTP requests to fail. The error occurs exclusively after running the ffmpeg command and making immediate requests, resulting in a “curl 52 empty response from server” error with the connection being closed. Notably, this issue does not occur when running the same setup outside of Docker. Additionally, if no HTTP requests are made after the ffmpeg command, the curl 52 error does not occur.

    


    Here is the verbose curl output of my minimum reproducible example (see below).

    


    curl -v "http://localhost:3030"
*   Trying 127.0.0.1:3030...
* Connected to localhost (127.0.0.1) port 3030 (#0)
> GET / HTTP/1.1
> Host: localhost:3030
> User-Agent: curl/8.1.2
> Accept: */*
> 
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server


    


    Here are Docker logs from my minimum reproducible example (see below). The wav files are concatenated successfully, then the container appears to rebuild.

    


    [2024-06-03T05:26:58Z INFO  minimal_docker_webserver_post_error] Starting server on 0.0.0.0:3030
[2024-06-03T05:26:58Z INFO  warp::server] Server::run; addr=0.0.0.0:3030
[2024-06-03T05:26:58Z INFO  warp::server] listening on http://0.0.0.0:3030
[2024-06-03T05:27:07Z INFO  minimal_docker_webserver_post_error] WAV files concatenated successfully
[Running 'cargo run']
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s
     Running `target/debug/minimal_docker_webserver_post_error`
[2024-06-03T05:27:08Z INFO  minimal_docker_webserver_post_error] Starting server on 0.0.0.0:3030
[2024-06-03T05:27:08Z INFO  warp::server] Server::run; addr=0.0.0.0:3030
[2024-06-03T05:27:08Z INFO  warp::server] listening on http://0.0.0.0:3030


    


    What I have tried :
I tried using different web frameworks (Warp, Actix-web) and request crates (reqwest, ureq). I also tried running the setup outside of Docker, which worked as expected without any issues. Additionally, I tried running the setup in Docker without making any HTTP requests after the ffmpeg command, and the connection closed successfully without errors. I also tried posting to httpbin with a minimal request, but the issue persisted.

    


    Minimum reproducible example :

    


    main.rs

    


    use warp::Filter;&#xA;use reqwest::Client;&#xA;use std::convert::Infallible;&#xA;use log::{info, error};&#xA;use env_logger;&#xA;use tokio::process::Command;&#xA;&#xA;#[tokio::main]&#xA;async fn main() {&#xA;    std::env::set_var("RUST_LOG", "debug");&#xA;    env_logger::init();&#xA;&#xA;    let route = warp::path::end()&#xA;        .and_then(handle_request);&#xA;&#xA;    info!("Starting server on 0.0.0.0:3030");&#xA;    warp::serve(route)&#xA;        .run(([0, 0, 0, 0], 3030))&#xA;        .await;&#xA;}&#xA;&#xA;async fn handle_request() -> Result<impl infallible="infallible"> {&#xA;    let client = Client::new();&#xA;&#xA;    let output = Command::new("ffmpeg")&#xA;        .args(&amp;[&#xA;            "y",&#xA;            "-i", "concat:/usr/src/minimal_docker_webserver_post_error/file1.wav|/usr/src/minimal_docker_webserver_post_error/file2.wav",&#xA;            "-c", "copy",&#xA;            "/usr/src/minimal_docker_webserver_post_error/combined.wav"&#xA;        ])&#xA;        .output()&#xA;        .await;&#xA;&#xA;    match output {&#xA;        Ok(output) => {&#xA;            if output.status.success() {&#xA;                info!("WAV files concatenated successfully");&#xA;            } else {&#xA;                error!("Failed to concatenate WAV files: {:?}", output);&#xA;                return Ok(warp::reply::with_status("Failed to concatenate WAV files", warp::http::StatusCode::INTERNAL_SERVER_ERROR));&#xA;            }&#xA;        },&#xA;        Err(e) => {&#xA;            error!("Failed to execute ffmpeg: {:?}", e);&#xA;            return Ok(warp::reply::with_status("Failed to execute ffmpeg", warp::http::StatusCode::INTERNAL_SERVER_ERROR));&#xA;        }&#xA;    }&#xA;&#xA;    // ISSUE: Connection closes with curl: (52) Empty reply from server&#xA;    match client.get("https://httpbin.org/get").send().await {&#xA;        Ok(response) => info!("GET request successful: {:?}", response),&#xA;        Err(e) => error!("GET request failed: {:?}", e),&#xA;    }&#xA;&#xA;    match client.post("https://httpbin.org/post")&#xA;        .body("field1=value1&amp;field2=value2")&#xA;        .send().await {&#xA;        Ok(response) => info!("POST request successful: {:?}", response),&#xA;        Err(e) => error!("POST request failed: {:?}", e),&#xA;    }&#xA;&#xA;    Ok(warp::reply::with_status("Request handled", warp::http::StatusCode::OK))&#xA;}&#xA;</impl>

    &#xA;

    FFMPEG command to generate the two wav files for concatenation

    &#xA;

    ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" file1.wav &amp;&amp; ffmpeg -f lavfi -i "sine=frequency=500:duration=5" file2.wav&#xA;

    &#xA;

    Dockerfile

    &#xA;

    # Use the official Rust image as the base image&#xA;FROM rust:latest&#xA;&#xA;# Install cargo-watch&#xA;RUN cargo install cargo-watch&#xA;&#xA;# Install ffmpeg&#xA;RUN apt-get update &amp;&amp; apt-get install -y ffmpeg&#xA;&#xA;# Set the working directory inside the container&#xA;WORKDIR /usr/src/minimal_docker_webserver_post_error&#xA;&#xA;# Copy the Cargo.toml and Cargo.lock files&#xA;COPY Cargo.toml Cargo.lock ./&#xA;&#xA;# Copy the source code&#xA;COPY src ./src&#xA;&#xA;# Copy wav files&#xA;COPY file1.wav /usr/src/minimal_docker_webserver_post_error/file1.wav&#xA;COPY file2.wav /usr/src/minimal_docker_webserver_post_error/file2.wav&#xA;&#xA;# Install dependencies&#xA;RUN cargo build --release&#xA;&#xA;# Expose the port that the application will run on&#xA;EXPOSE 3030&#xA;&#xA;# Set the entry point to use cargo-watch&#xA;CMD ["cargo", "watch", "-x", "run"]&#xA;

    &#xA;

    Cargo.toml

    &#xA;

    [package]&#xA;name = "minimal_docker_webserver_post_error"&#xA;version = "0.1.0"&#xA;edition = "2021"&#xA;&#xA;# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html&#xA;&#xA;[dependencies]&#xA;warp = "0.3"&#xA;reqwest = { version = "0.12.4", features = ["json"] }&#xA;tokio = { version = "1", features = ["full"] }&#xA;log = "0.4"&#xA;env_logger = "0.11.3"&#xA;

    &#xA;

    Making the request to the warp server

    &#xA;

    curl -v "http://localhost:3030"&#xA;

    &#xA;

  • Android ffmpeg. Linker command failed with exit code 1

    8 juin 2017, par Wilsom Sanders

    I’m trying to build ffmpeg static libraries and link them to an android project in order to implement a video player. Goal is to make a player capable of receiving video file from various sources similar to p2p file sharing networks. (target api is 21 level which is 1 level short from supposed official solution with MediaSource)

    I managed to compile ffmpeg from this repo (all the code used as-is) but later i got stuck on a linking problem. Whenever I try to compile I get list of ffmpeg methods called in my code and a short eloquent message :

    Linker command failed with exit code 1

    I have no clue how to pass -v flag to the linker in android studio. Would be great if somebody hinted me that.

    I use android studio, build with gradle and cmake.

    There’s my files :
    build.gradle (Project)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {
       repositories {
           jcenter()
       }
       dependencies {
           classpath 'com.android.tools.build:gradle:2.3.1'

           // NOTE: Do not place your application dependencies here; they belong
           // in the individual module build.gradle files
       }
    }

    allprojects {
       repositories {
           jcenter()
       }
    }

    task clean(type: Delete) {
       delete rootProject.buildDir
    }

    build.gradle (Module)

    apply plugin: 'com.android.application'

       android {
           compileSdkVersion 25
           buildToolsVersion "25.0.3"
           productFlavors {
               x86 {
                   ndk {
                       abiFilter "x86"
                   }
               }
               arm {
                   ndk {
                       abiFilters "armeabi-v7a"
                   }
               }
               armv7 {
                   ndk {
                       abiFilters "armeabi-v7a"
                   }
               }
           }
           defaultConfig {
               applicationId "com.example.ledo.ndkapplication"
               minSdkVersion 22
               targetSdkVersion 25
               versionCode 1
               versionName "1.0"
               testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
               externalNativeBuild {
                   cmake {
                       cppFlags "-std=c++11 -frtti -fexceptions"
                       arguments '-DANDROID_PLATFORM=android-16'
                   }
               }
           }
           buildTypes {
               release {
                   minifyEnabled false
                   proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
               }
           }
           externalNativeBuild {
               cmake {
                   path "CMakeLists.txt"
               }
           }
           splits {
               abi {
                   enable true
                   reset()
                   include 'x86', 'armeabi-v7a'
                   universalApk true
               }
           }
       }

       dependencies {
           compile fileTree(dir: 'libs', include: ['*.jar'])
           androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
               exclude group: 'com.android.support', module: 'support-annotations'
           })
           compile 'com.android.support:appcompat-v7:25.3.1'
           compile 'com.android.support.constraint:constraint-layout:1.0.2'
           compile 'com.android.support:design:25.3.1'
           compile 'com.writingminds:FFmpegAndroid:0.3.2'
           testCompile 'junit:junit:4.12'
       }

    CMakeLists.txt

    # For more information about using CMake with Android Studio, read the
    # documentation: https://d.android.com/studio/projects/add-native-code.html

    # Sets the minimum version of CMake required to build the native library.

    cmake_minimum_required(VERSION 2.8)

    # Creates and names a library, sets it as either STATIC
    # or SHARED, and provides the relative paths to its source code.
    # You can define multiple libraries, and CMake builds them for you.
    # Gradle automatically packages shared libraries with your APK.

    add_library( # Sets the name of the library.
                native-lib

                # Sets the library as a shared library.
                SHARED

                # Provides a relative path to your source file(s).
                src/main/cpp/native-lib.cpp
                src/main/cpp/NativePlayer.h
                src/main/cpp/NativePlayer.cpp)

    # Searches for a specified prebuilt library and stores the path as a
    # variable. Because CMake includes system libraries in the search path by
    # default, you only need to specify the name of the public NDK library
    # you want to add. CMake verifies that the library exists before
    # completing its build.

    find_library( # Sets the name of the path variable.
                 log-lib

                 # Specifies the name of the NDK library that
                 # you want CMake to locate.
                 log )
    find_library(png-lib png)

    # Specifies libraries CMake should link to your target library. You
    # can link multiple libraries, such as libraries you define in this
    # build script, prebuilt third-party libraries, or system libraries.

    #avcodec
    #avfilter
    #avformat
    #avutil
    #swresample
    #swscale

    #${ANDROID_ABI}

    message(${ANDROID_ABI})
    set(FFMPEG_ROOT_DIR src/main/libs/ffmpeg/${ANDROID_ABI})

    add_library(avcodec STATIC IMPORTED)
    add_library(avformat STATIC IMPORTED)
    add_library(avfilter STATIC IMPORTED)
    add_library(avutil STATIC IMPORTED)
    add_library(swresample STATIC IMPORTED)
    add_library(swscale STATIC IMPORTED)

    #SET_TARGET_PROPERTIES(avcodec PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(avcodec PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libavcodec.a)
    #SET_TARGET_PROPERTIES(avfilter PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(avfilter PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libavfilter.a)
    #SET_TARGET_PROPERTIES(avformat PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(avformat PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libavformat.a)
    #SET_TARGET_PROPERTIES(avutil PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(avutil PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libavutil.a)
    #SET_TARGET_PROPERTIES(swresample PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(swresample PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libswresample.a)
    #SET_TARGET_PROPERTIES(swscale PROPERTIES LINKER_LANGUAGE C)
    set_target_properties(swscale PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib/libswscale.a)

    include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/include )
    include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/${FFMPEG_ROOT_DIR}/lib )
    target_link_libraries( # Specifies the target library.
                          native-lib

                          # Links the target library to the log library
                          # included in the NDK.
                          ${log-lib}
                          avcodec
                          avformat
                          #avfilter
                          #swresample
                          #swscale
                          #avutil
                          GLESv2)

    I have .a files in following locations :
    %PROJECT_DIR%/app/src/libs/ffmpeg/armeabi-v7a
    %PROJECT_DIR%/app/src/libs/ffmpeg/armeabi-v7a-neon
    %PROJECT_DIR%/app/src/libs/ffmpeg/x86

    It doesn’t look to me that linker misses files themselves. (I get different out put if I misplace them.)