Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • ffmpeg failed - 455 Method Not Valid in This State

    3 juin, par paty.r15

    I created a Node.js app that gets an RTSP stream with FFmpeg to analyse it with OpenCV 3. 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).

  • Screen Recording Issues using Python and FFMPEG [closed]

    3 juin, par Kevin McDowell

    I am trying to record a walkthrough of a 3D space contained within a Chrome browser session. The goal is to create deterministic output. If I run this command from a VS Code terminal, it records 30 seconds of video from the window that's about 6MB:

    ffmpeg -f gdigrab -framerate 30 -i "title=My3D - Google Chrome" -t 30 "My3D - Google Chrome_screenRecording_v0.mp4"
    

    However, if I call it from Python like so:

    subprocess.run("ffmpeg -f gdigrab -framerate 30 -i \"title=My3D - Google Chrome\" -t 15 \"My3D - Google Chrome_screenRecording_v0.mp4\"")
    

    The output video is 30 seconds, but while I can see the mouse moving on the screen, the image is all black and the filesize is only 94KB.

    This is on a Windows 11 machine with GPU acceleration disabled in the OS as well as in Chrome. I've also tried it with other web pages and those are also recorded black. Any ideas what is causing this or how to record the screen using Python?

    I've got other alternatives working (using Selenium or PyGet to capture screenshots and then using the VideoWriter class from OpenCV to write them to a video file), but that has a limitation of only about 10 FPS and you can't control the recording time like you can with FFMPEG. If you screen capture for 30 seconds, the actual output may only be 12-18 seconds.

  • How to add a fake microphone to android emulator running on linux headless

    2 juin, par Red

    Trying to add a microphone to the android emulator running on Linux headless. Host as no microphone so I need to create fake one and simulate playing some random music for my android test.

    In emulator command there is a option to use the host audio as input, by passing -allow-host-audio but it is not working on the phone.

    How to create virtual microphone Start the pusleaudio

    pulseaudio -D --exit-idel-time=-1
    

    Create the fake mic

    pactl load-module module-null-sink sink_name=FakeSink
    

    pactl load-module module-remap-source master=FakeSink.monitor source_name=FakeMic

    And set to default

    pactl sets default FakeSink.monitor
    

    Microphone test

    $ffmpeg -f pulse -i default out.wav
    
    
    $ sox out.wav -n stat
    
    Samples read:            579654
    
    Length (seconds):      6.038062
    
    Scaled by:         2147483647.0
    
    Maximum amplitude:     0.533081
    
    Minimum amplitude:    -0.585297
    
    Midline amplitude:    -0.026108
    
    Mean    norm:          0.067096
    
    Mean    amplitude:     0.003363
    
    RMS     amplitude:     0.093545
    
    Maximum delta:         0.603760
    
    Minimum delta:         0.000000
    
    Mean    delta:         0.073738
    
    RMS     delta:         0.105326
    
    Rough   frequency:         8601
    
    Volume adjustment:        1.709
    

    Run the emulator

    emulator -avd and_1 -allow-host-audio -no_window
    

    There was no audio on the phone.

  • Attempting to parse an m3u8 file in FFmpeg with mismatched extensions and formats

    2 juin, par Daniel Melo

    As I attempt to parse an m3u8 file thats being downloaded over the air, it utilizes "html" as an extension to represent the ts video slices. Even with the command being written as follows:

    ffmpeg -allowed_extensions ALL -i https://.../master.m3u8 -codec copy ./out.mkv
    

    It still produces the following error:

    detected format mpegts extension none mismatches allowed extensions in url (...)/page-0.html
    

    Could there be a way to ignore this format and extension mismatch?

  • App Store Submission Fails Due to Unsupported Architectures and Invalid Segment Alignment [closed]

    2 juin, par Ahsanur Rahman

    I’m using ffmpegkit in my iOS app, but when I submit the app to the App Store, I get these errors:

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/ffmpegkit.framework contains unsupported architectures '[x86_64]'. (ID: 3e35bca7-7b8f-4c2b-bfb2-a27c8ad70c45)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libavcodec.framework contains unsupported architectures '[x86_64]'. (ID: fd864260-dae3-4816-bdf3-ca7389374242)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libavdevice.framework contains unsupported architectures '[x86_64]'. (ID: fd743847-5d46-4679-8193-51db9445fde1)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libavfilter.framework contains unsupported architectures '[x86_64]'. (ID: 54492aff-601e-471a-aef7-25f0549a6364)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libavformat.framework contains unsupported architectures '[x86_64]'. (ID: 37bcd80d-7b17-4f95-a20f-577dbb29fc36)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libavutil.framework contains unsupported architectures '[x86_64]'. (ID: ead0bd08-84e6-475e-9ce3-9e1c012bafa5)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libswresample.framework contains unsupported architectures '[x86_64]'. (ID: fe647420-760c-4404-a039-30c102d7d313)

    Validation failed
    Unsupported Architectures. The executable for MyApp.app/Frameworks/libswscale.framework contains unsupported architectures '[x86_64]'. (ID: 7c8946d8-d75f-455c-b6fd-1bd555abb99f)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/ffmpegkit.framework/ffmpegkit' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 8603e3f0-0235-4f3c-a87f-c263945a11d9)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavcodec.framework/libavcodec' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: f10b4561-0a9c-4aa6-969a-9d3a892be9ec)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavdevice.framework/libavdevice' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 2e6d495a-9131-43da-b6a8-8c23b8d10415)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavfilter.framework/libavfilter' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 40016424-045d-470f-b40a-fba391de2c98)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavformat.framework/libavformat' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: f8cc4367-25bb-4932-bd03-af6729fe7587)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libavutil.framework/libavutil' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 495572f9-2dcb-472b-97ea-d16ba6e239a9)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libswresample.framework/libswresample' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 5722d5f0-0f81-422f-8389-e744c73cfd67)

    Validation failed
    Invalid Segment Alignment. The app binary at 'MyApp.app/Frameworks/libswscale.framework/libswscale' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version. (ID: 1e4bf706-5e56-423d-b600-a8298eff698f)

    Validation failed
    The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker. (ID: 8695bbb6-991f-46cd-9b70-bd86dcef4212)

    I add the below code in a runscript:

    APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
    
    find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
    do
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)"
    
    EXTRACT_ARCHS=$(lipo -info "$FRAMEWORK_EXECUTABLE_PATH" | rev | cut -d ':' -f1 | rev)
    ARCHS_TO_REMOVE=""
    
    for ARCH in $EXTRACT_ARCHS; do
        if [ "$ARCH" != "arm64" ]; then
            ARCHS_TO_REMOVE="$ARCHS_TO_REMOVE -remove $ARCH"
        fi
    done
    
    if [ ! -z "$ARCHS_TO_REMOVE" ]; then
        lipo $ARCHS_TO_REMOVE "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH" || exit 1
    fi
    done
    

    I have already tried some suggestion from online but nothing worked.