Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Xvfb records a black screen

    11 mai, par Vivek

    I am trying a record a video by running xvfb inside a docker image. No matter what I do it gives me black screen.

    Screen size same in xvfb and ffmpeg and puppeteer.

    It will would really great if someone can help.

    
    start-xvfb.sh
    ---------------------------------------------------------------------
    # Start Xvfb
    Xvfb :99 -screen 0 1280x720x24 &
    
    # Set the display environment variable
    export DISPLAY=:99
    
    # Run the application (assuming it starts with npm start)
    npm run dev
    

    Dockerfile

    FROM node:lts-alpine3.19
    
    # Install dependencies using apk
    RUN apk update && \
        apk add --no-cache \
        gnupg \
        ffmpeg \
        libx11 \
        libxcomposite \
        libxdamage \
        libxi \
        libxtst \
        nss \
        cups-libs \
        libxrandr \
        alsa-lib \
        pango \
        gtk+3.0 \
        xvfb \
        bash \
        curl \
        udev \
        ttf-freefont \
        chromium \
        chromium-chromedriver
    
    # Set working directory
    WORKDIR /app
    
    # Copy package.json and install dependencies
    COPY package.json .
    RUN npm install --force
    
    # Copy remaining source code
    COPY . .
    
    # Add a script to start Xvfb
    COPY start-xvfb.sh /app/start-xvfb.sh
    RUN chmod +x /app/start-xvfb.sh
    
    # Expose the port
    EXPOSE 4200
    EXPOSE 3000
    
    # Command to start Xvfb and run the application
    CMD ["./start-xvfb.sh"]
    

    Below

    this is code code that launches puppeteer and from a nodejs application and create spawns a process for ffmpeg

    export class UnixBrowserRecorder implements Recorder {
    
      url = 'https://stackoverflow.com/questions/3143698/uncaught-syntaxerror-unexpected-token'; // Replace with your URL
      outputFilePath = `/app/output_video.mp4`; // Output file path within the container
      durationInSeconds = 6; // Duration of the video in seconds
      resolution = '1280x720';
    
      public async capture(): Promise {
        const browser = await puppeteer.launch({
          args: [
            '--no-sandbox', // Required in Docker
            '--disable-setuid-sandbox', // Required in Docker
            '--disable-dev-shm-usage', // Required in Docker
            '--headless', // Run browser in headless mode
            '--disable-gpu', // Disable GPU acceleration
            `--window-size=${this.resolution}` // Set window size
          ],
          executablePath: '/usr/bin/chromium' // Specify the path to Chromium executable
        });
    
        const page = await browser.newPage();
        await page.goto(this.url);
    
        await page.screenshot({
          "type": "png", // can also be "jpeg" or "webp" (recommended)
          "path": `/app/screenshot.png`,  // where to save it
          "fullPage": true,  // will scroll down to capture everything if true
        });
    
        //ffmpeg -video_size `DISPLAY=:5 xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -framerate 30 -f x11grab -i :5.0+0,0 output.mpg
    
        const ffmpegProcess = spawn('ffmpeg', [
          '-video_size', this.resolution,
          '-framerate', '30',
          '-f', 'x11grab',
          '-i', ':99', // Use display :99 (assuming Xvfb is running on this display)
          '-t', this.durationInSeconds.toString(),
          '-c:v', 'libx264',
          '-loglevel', 'debug',
          '-pix_fmt', 'yuv420p',
          this.outputFilePath
        ]);
    
        // Log ffmpeg output
        ffmpegProcess.stdout.on('data', data => {
          console.log(`ffmpegProcess stdout: ${data}`);
        });
    
        ffmpegProcess.stderr.on('data', data => {
          console.error(`ffmpegProcess stderr: ${data}`);
        });
    
        // Handle ffmpegProcess process exit
        ffmpegProcess.on('close', code => {
          console.log(`ffmpeg process exited with code ${code}`);
        });
    
        // Wait for the duration to complete
        await new Promise(resolve => setTimeout(resolve, this.durationInSeconds * 1000));
    
        // Close the FFmpeg stream and process
        ffmpegProcess.stdin.end();
        // Close Puppeteer
        await page.close();
        await browser.close();
    
        return "Video generated successfully";
      }
    }
    

    enter image description here

  • "undefined reference to av···@···"ffmpeg error,when i cross compile opencv4.5.3 which include ffmpeg lib

    11 mai, par caiping Peng

    everyone,It is sorry to bother you,but i need some help. I'm working on an embedded deployment project,doing object detection work to real-time video stream. So I have to port my c++ inference prog to RKNN1808 platform. I compile this program with CMake tool,but I cant finish my work because opencv lib cant be compiled rightly. To FFmpeg,my configure commend is following:

    ./configure --enable-cross-compile --cross-prefix=/home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- --target-os=linux --arch=aarch64 --prefix=/usr/local/ffmpeg  --enable-shared
    

    then I am gonna show you the ffmpeg version:

    libavutil      56. 70.100
    libavcodec     58.134.100
    libavformat    58. 76.100
    libavdevice    58. 13.100
    libavfilter     7.110.100
    libswscale      5.  9.100
    libswresample   3.  9.100
    libpostproc    55.  9.100
    

    next ,I use following commend to build cmake project:

    cmake -D CMAKE_BUILD_TYPE=RELEASE  -D CMAKE_C_COMPILER=/home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -D CMAKE_CXX_COMPILER=/home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ -D BUILD_SHARED_LIBS=ON -D CMAKE_CXX_FLAGS=-fPIC -D CMAKE_C_FLAGS=-fPIC -D CMAKE_EXE_LINKER_FLAGS=-lpthread -ldl -D ENABLE_PIC=ON -D WITH_1394=OFF -D WITH_ARAVIS=OFF -D WITH_ARITH_DEC=ON -D WITH_ARITH_ENC=ON -D WITH_CLP=OFF -D WITH_CUBLAS=OFF -D WITH_CUDA=OFF -D WITH_CUFFT=OFF -D WITH_FFMPEG=ON -D WITH_GSTREAMER=ON -D WITH_GSTREAMER_0_10=OFF -D WITH_HALIDE=OFF -D WITH_HPX=OFF -D WITH_IMGCODEC_HDR=ON -D WITH_IMGCODEC_PXM=ON -D WITH_IMGCODEC_SUNRASTER=ON -D WITH_INF_ENGINE=OFF -D WITH_IPP=OFF -D WITH_ITT=OFF -D WITH_JASPER=ON -D WITH_JPEG=ON -D WITH_LAPACK=ON -D WITH_LIBREALSENSE=OFF -D WITH_NVCUVID=OFF -D WITH_OPENCL=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCL_SVM=OFF -D WITH_OPENEXR=OFF -D WITH_OPENGL=OFF -D WITH_OPENMP=OFF -D WITH_OPENNNI=OFF -D WITH_OPENNNI2=OFF -D WITH_OPENVX=OFF -D WITH_PNG=OFF -D WITH_PROTOBUF=OFF -D WITH_PTHREADS_PF=ON -D WITH_PVAPI=OFF -D WITH_QT=OFF -D WITH_QUIRC=OFF  -D WITH_TBB=OFF -D WITH_TIFF=ON -D WITH_VULKAN=OFF -D WITH_WEBP=ON -D WITH_XIMEA=OFF -D CMAKE_INSTALL_PREFIX=../CrossCompileResult  -D WITH_GTK=OFF  -D BUILD_opencv_dnn=OFF ..
    

    following is the outpt about FFmpeg:

    --   Video I/O:
    --     FFMPEG:                      YES
    --       avcodec:                   YES (58.134.100)
    --       avformat:                  YES (58.76.100)
    --       avutil:                    YES (56.70.100)
    --       swscale:                   YES (5.9.100)
    --       avresample:                NO
    --     GStreamer:                   NO
    --     v4l/v4l2:                    YES (linux/videodev2.h)
    
    

    After building the cmake project,I compiled this project with comment 【make -j16】.After not so long time,I got the Error:

    [ 49%] Linking CXX executable ../../bin/opencv_annotation
    [ 49%] Building CXX object modules/ts/CMakeFiles/opencv_ts.dir/src/ts_tags.cpp.o
    [ 49%] Built target opencv_annotation
    [ 49%] Linking CXX executable ../../bin/opencv_visualisation
    /home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libavcodec.so.58, needed by ../../lib/libopencv_videoio.so.4.5.3, not found (try using -rpath or -rpath-link)
    /home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libavformat.so.58, needed by ../../lib/libopencv_videoio.so.4.5.3, not found (try using -rpath or -rpath-link)
    /home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libavutil.so.56, needed by ../../lib/libopencv_videoio.so.4.5.3, not found (try using -rpath or -rpath-link)
    /home/midsummer/Tool/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/../../../../aarch64-linux-gnu/bin/ld: warning: libswscale.so.5, needed by ../../lib/libopencv_videoio.so.4.5.3, not found (try using -rpath or -rpath-link)
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_init_packet@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_get_riff_video_tags@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_send_packet@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_receive_packet@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_get_mov_video_tags@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_find_decoder@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_find_decoder_by_name@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_frame_alloc@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_get_name@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_transfer_data@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_malloc@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avio_open@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_alloc_context@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_sub_q@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_network_init@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_packet_free@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_flush_buffers@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_find_encoder@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `sws_getContext@LIBSWSCALE_5'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_receive_frame@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_write_frame@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_close_input@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_seek_frame@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `sws_freeContext@LIBSWSCALE_5'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_dict_set@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_descriptor_get_by_name@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `sws_scale@LIBSWSCALE_5'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_packet_unref@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_dict_parse_string@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_frame_get_buffer@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_freep@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_find_stream_info@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_read_frame@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_free_context@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_default_get_format@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_ctx_init@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_register_all@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_free@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_get_buffer@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_guess_sample_aspect_ratio@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_new_stream@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_constraints_free@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwdevice_ctx_create_derived@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_frame_unref@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_buffer_unref@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_write_trailer@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_packet_rescale_ts@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_get_by_name@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_send_frame@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_get_hw_config@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_buffer_ref@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_dict_get@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_free@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_codec_is_decoder@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_open_input@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_lockmgr_register@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_packet_alloc@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_ctx_create_derived@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_send_packet@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_alloc@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_log_set_level@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_image_get_buffer_size@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_open2@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_codec_is_encoder@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_guess_format@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_image_fill_arrays@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_receive_packet@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `sws_getCachedContext@LIBSWSCALE_5'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_codec_get_tag@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwdevice_get_hwframe_constraints@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwdevice_ctx_create@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_codec_iterate@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_log_set_callback@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_opt_set@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_codec_get_id@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avformat_write_header@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_parameters_copy@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_pix_fmt_to_codec_tag@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwframe_ctx_alloc@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_mallocz@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_find_input_format@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_dict_free@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_get_hw_frames_parameters@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwdevice_get_type_name@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avio_close@LIBAVFORMAT_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_frame_free@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_bsf_init@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_close@LIBAVCODEC_58'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `av_hwdevice_find_type_by_name@LIBAVUTIL_56'
    ../../lib/libopencv_videoio.so.4.5.3: undefined reference to `avcodec_get_context_defaults3@LIBAVCODEC_58'
    collect2: error: ld returned 1 exit status
    make[2]: *** [apps/visualisation/CMakeFiles/opencv_visualisation.dir/build.make:89: bin/opencv_visualisation] Error 1
    make[1]: *** [CMakeFiles/Makefile2:3357: apps/visualisation/CMakeFiles/opencv_visualisation.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 49%] Linking CXX shared library ../../lib/libopencv_calib3d.so
    [ 49%] Built target opencv_calib3d
    [ 50%] Linking CXX static library ../../lib/libopencv_ts.a
    [ 50%] Built target opencv_ts
    make: *** [Makefile:163: all] Error 2
    
    

    I dont know what's wrong with it,It has confused me for a few days,I real hope someone can help me solve the prob. I promise the the ffmpeg version match the version of opencv strictly,promising the PKG_CONFIG_PATH is right.

    I have tried many method like changing opencv version or ffmpeg version,recompiling the ffmpeg,changing PKG_CONFIG_PATH,coping ffmpeg pc file from /usr/local/ffmpeg/lib/pkgconfig to /usr/local/lib/pkgconfig. I hope somebody can give some idea about how to solve this problem.

  • Using chunks of MP4 file for thumbnails

    11 mai, par Moritz Mahringer

    I want to extract single frames (as thumbs) from videos, without having to download the full video file. I would like to just read the mp4 header (the info should be in the moov atom) and then download the required byte ranges. Afaik thats what browsers (HTML5 video) do when you skip to an unbuffered part

    I already looked at: How can HTML5 video's byte-range requests (pseudo-streaming) work? but i can't figure out how to use it with ffmpeg for example.

    Thanks a lot!

  • FPS reduction for H264 [closed]

    11 mai, par Александр А

    There is a USB camera that sends H264 frames with a frequency of 30 fps in a resolution of 1920x1080, GOP size 30 or 60 (1 or 2 I frame per second depending on the camera), which requires throughput of about 6 mbit/s. It is necessary to reduce this to no more than 2 mbit/s. All this is done on a weak ARMv7, so the option of transcoding is extremely resource intensive, especially considering that I did not find how to do it as a GPU Mali.

    Given that the basic functionality is performed on the framework ffmpeg, is it possible to reduce the frame rate, ideally to 10 fps, WITHOUT loss of quality and decoding?

  • OpenEncodeSessionEx failed : no encode device (1) : (no details)

    11 mai, par Jayce Li

    I'm testing the ddagrab filter with this command line:

    ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 -v 40 -t 10 -y out.mp4

    FFmpeg exits with this error message: OpenEncodeSessionEx failed: no encode device (1): (no details)

    My laptop has Nvidia Geforce GTX 1050 Ti, Driver version 527.37. Windows 10 Home, Version 22H2, OS build 19045.4291. DirectX version 12.

    This command works without problems: ffmpeg -f gdigrab -i desktop -c:v h264_nvenc -t 10 -y out.mp4

    I test these command on my other laptop with Nvidia Geforce RTX 2060, Driver version 512.78.Windows 10 Home, Version 22H2, OS build 19045.3693. DirectX version 12. They both work fine.

    How to solve the problem. OpenEncodeSessionEx failed: no encode device (1): (no details)