Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Flutter ffmpeg_kit_flutter_full_gpl-6.0.3 PluginRegistry.Registrar flutter version 3.29

    30 avril, par Lisa

    I am using ffmpeg_kit_flutter_full_gpl-6.0.3 for flutter version 3.27 but when upgrading to flutter 3.29, with android, there is an error PluginRegistry.Registrar registrar. Is there any solution to replace the current ffmpeg_kit_flutter_full_gpl because I see this library was updated 17 months ago

    /Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:157: error: cannot find symbol
        public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
                                                                                     ^
      symbol:   class Registrar
      location: interface PluginRegistry
    /Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:651: error: cannot find symbol
        protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final io.flutter.plugin.common.PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) {
                                                                                                                                                    ^
      symbol:   class Registrar
      location: interface PluginRegistry
    2 errors
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':ffmpeg_kit_flutter_full_gpl:compileReleaseJavaWithJavac'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    > Run with --info option to get more log output.
    > Run with --scan to get full insights.
    

    Is there any alternative?

  • Could not find com.arthenica:ffmpeg-kit-full:6.0-2

    30 avril, par gabocalero

    I started receiving this message when I build my project

    > Could not find com.arthenica:ffmpeg-kit-full:6.0-2.
      Searched in the following locations:
        - https://dl.google.com/dl/android/maven2/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
        - https://repo.maven.apache.org/maven2/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
        - https://jcenter.bintray.com/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
        - https://jitpack.io/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
        - https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
        - https://oss.sonatype.org/content/repositories/snapshots/com/arthenica/ffmpeg-kit-full/6.0-2/ffmpeg-kit-full-6.0-2.pom
      Required by:
          project :presentation > project :domain
    

    These are the project's repositories

    allprojects {     
       repositories {
          google()
          mavenCentral()
          jcenter()
          maven { url 'https://jitpack.io' }
          maven { url "https://oss.sonatype.org/content/repositories/snapshots" }     
       } 
    }
    

    And this is the dependency I'm adding

        implementation(libs.arthenica.ffmpeg.full)
    

    This is my libs.version.toml

    ffmpeg = "6.0-2"
    arthenica-ffmpeg-full = {  group = "com.arthenica", name = "ffmpeg-kit-full", version.ref = "ffmpeg" }
    

    AFAICS in the project's github page, it will not be maintained anymore ffmpeg-kit is archived on April 21, 2025

    In the short term, do you know any other repository that still servers this dependency?

    On the other hand, do you know any other project to replace Arthenica ffmpeg-kit-full dependency?

    Thank you very much

  • Difference behaviour between Ubuntu and Windows for popen, _popen

    30 avril, par Humam Helfawi

    I need to open FFMPEG pipe and write frames data to that pipe. I am using this code:

    #ifdef _WIN32
    #define POPEN _popen
    #define PCLOSE _pclose
    #else
    #define POPEN popen
    #define PCLOSE pclose
    #endif
    
    // FFmpeg command to receive raw BGR24 data and encode with libx264
    std::ostringstream oss;
    oss << "ffmpeg -y -f rawvideo -pixel_format bgr24 "
        << "-video_size " << width << "x" << height << " "
        << "-framerate " << fps << " -i - "
        << "-c:v libx264 -preset ultrafast "
        << "" << video_path << "";
    std::string cmd = oss.str();        
    #ifdef _WIN32
    auto mode = "wb";
    #else
    auto mode = "w";
    #endif
    pipe_ = POPEN(cmd.c_str(), mode);
    if (!pipe_) {
        throw std::runtime_error("[FFmpegWriter::FFmpegWriter] FFmpeg pipe could not be oppnened");
    }
    

    The writing (in loop) looks like:

    size_t written = fwrite(img.data, 1, img.total() * img.elemSize(), pipe_);
    

    This works fine but it is much slower on Ubuntu (while writing frames) than it is on Windows. The wb option does not work on ubuntu and return empty pipe_. What exactly the problem here:

    1. Why wb does not work on Ubuntu?
    2. if w is the way to go on Ubuntu, why it is much slower than windows (2-3X)?
  • FFmpeg webcam image capture from default Windows webcam

    29 avril, par Mark Ryan

    I want to capture a webcam image from my default Windows webcam without specifying the webcam name and save it as a JPG. I also want to scale and crop it to 640x480. I have come up with -

    ffmpeg -f dshow -i "video=EasyCamera" -vf scale=-1:480,crop=640:480 -frames:v 1 test.jpg -y

    And it works fine, but I want to be able to be able to capture the image without having to specify the camera name. Is this possible?

    I have been able to do it with the following -

    ffmpeg.exe -f vfwcap -i 0 -vf scale=-1:480,crop=640:480 -frames:v 1 test.jpg -y

    But vfwcap is very old & I shouldn't be using it.

    Sorry if this is a very basic question but I am new to FFmpeg and have spent a long time try to figure this out. Any help would be greatly appreciated

  • Can't set seeker in GSTREAMER cv2, python

    29 avril, par Alperen Ölçer

    I want to skip n seconds forward and backward in gstreamer cv2 capture for recorded videos. But when I use cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second) it resets seeker to beginning of video. How can I solve it? I wrote an example, used recorded clock video.

    import cv2
    
    video_p = '/home/alperenlcr/Videos/clock.mp4'
    
    cap_gstreamer = cv2.VideoCapture(video_p, cv2.CAP_GSTREAMER)
    cap_ffmpeg = cv2.VideoCapture(video_p, cv2.CAP_FFMPEG)
    
    fps = cap_gstreamer.get(cv2.CAP_PROP_FPS)
    skip_second = 100
    
    im1 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
    im1_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))
    
    cap_gstreamer.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)
    cap_ffmpeg.set(cv2.CAP_PROP_POS_FRAMES, fps*skip_second)
    
    im2 = cv2.resize(cap_gstreamer.read()[1], (960, 540))
    im2_ffmpeg = cv2.resize(cap_ffmpeg.read()[1], (960, 540))
    
    merge_gstreamer = cv2.hconcat([im1, im2])
    merge_ffmpeg = cv2.hconcat([im1_ffmpeg, im2_ffmpeg])
    
    cv2.imshow(str(skip_second) + ' gstreamer', merge_gstreamer)
    cv2.imshow(str(skip_second) + ' ffmpeg', merge_ffmpeg)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    
    cap_gstreamer.release()
    cap_ffmpeg.release()
    
    

    Result: enter image description here

    My cv2 build is like:

    >>> print(cv2.getBuildInformation())
    
    General configuration for OpenCV 4.8.1 =====================================
      Version control:               4.8.1-dirty
    
      Extra modules:
        Location (extra):            /home/alperenlcr/SourceInstalls/opencv_contrib/modules
        Version control (extra):     4.8.1
    
      Platform:
        Timestamp:                   2024-12-02T13:44:58Z
        Host:                        Linux 6.8.0-49-generic x86_64
        CMake:                       3.22.1
        CMake generator:             Unix Makefiles
        CMake build tool:            /usr/bin/gmake
        Configuration:               RELEASE
    
      CPU/HW features:
        Baseline:                    SSE SSE2 SSE3
          requested:                 SSE3
        Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
          requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
          SSE4_1 (18 files):         + SSSE3 SSE4_1
          SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
          FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
          AVX (8 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
          AVX2 (37 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
          AVX512_SKX (8 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
    
      C/C++:
        Built as dynamic libs?:      NO
        C++ standard:                11
        C++ Compiler:                /usr/bin/c++  (ver 10.5.0)
        C++ flags (Release):         -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
        C++ flags (Debug):           -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
        C Compiler:                  /usr/bin/cc
        C flags (Release):           -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
        C flags (Debug):             -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
        Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  
        Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a   -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined  
        ccache:                      NO
        Precompiled headers:         NO
        Extra dependencies:          /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so Iconv::Iconv m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/lib/x86_64-linux-gnu -L/usr/lib/cuda/lib64
        3rdparty dependencies:       libprotobuf ade ittnotify libwebp libopenjp2 IlmImf quirc ippiw ippicv
    
      OpenCV modules:
        To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
        Disabled:                    cudacodec world
        Disabled by dependency:      -
        Unavailable:                 alphamat cvv hdf java julia matlab ovis python2 sfm viz
        Applications:                tests perf_tests examples apps
        Documentation:               NO
        Non-free algorithms:         NO
    
      GUI:                           GTK2
        QT:                          NO
        GTK+:                        YES (ver 2.24.33)
          GThread :                  YES (ver 2.72.4)
          GtkGlExt:                  NO
        OpenGL support:              NO
        VTK support:                 NO
    
      Media I/O: 
        ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
        JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
        WEBP:                        build (ver encoder: 0x020f)
        PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
        TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
        JPEG 2000:                   build (ver 2.5.0)
        OpenEXR:                     build (ver 2.3.0)
        HDR:                         YES
        SUNRASTER:                   YES
        PXM:                         YES
        PFM:                         YES
    
      Video I/O:
        DC1394:                      NO
        FFMPEG:                      YES
          avcodec:                   YES (58.134.100)
          avformat:                  YES (58.76.100)
          avutil:                    YES (56.70.100)
          swscale:                   YES (5.9.100)
          swresample:                YES (3.9.100)
        GStreamer:                   YES (1.20.3)
        v4l/v4l2:                    YES (linux/videodev2.h)
    
      Parallel framework:            TBB (ver 2021.5 interface 12050)
    
      Trace:                         YES (with Intel ITT)
    
      Other third-party libraries:
        Intel IPP:                   2021.8 [2021.8.0]
               at:                   /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
        Intel IPP IW:                sources (2021.8.0)
                  at:                /home/alperenlcr/SourceInstalls/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
        VA:                          NO
        Lapack:                      NO
        Eigen:                       NO
        Custom HAL:                  NO
        Protobuf:                    build (3.19.1)
        Flatbuffers:                 builtin/3rdparty (23.5.9)
    
      NVIDIA CUDA:                   YES (ver 11.5, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
        NVIDIA GPU arch:             86
        NVIDIA PTX archs:
    
      cuDNN:                         YES (ver 8.6.0)
    
      OpenCL:                        YES (no extra features)
        Include path:                /home/alperenlcr/SourceInstalls/opencv/3rdparty/include/opencl/1.2
        Link libraries:              Dynamic load
    
      ONNX:                          NO
    
      Python 3:
        Interpreter:                 /usr/bin/python3 (ver 3.10.12)
        Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.10.so (ver 3.10.12)
        numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.21.5)
        install path:                lib/python3.10/dist-packages/cv2/python-3.10
    
      Python (for build):            /usr/bin/python3
    
      Java:                          
        ant:                         NO
        Java:                        NO
        JNI:                         NO
        Java wrappers:               NO
        Java tests:                  NO
    
      Install to:                    /usr/local
    -----------------------------------------------------------------