Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (8)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

Sur d’autres sites (4623)

  • Assembling frames into a video in Node.js using fluent-ffmpeg [closed]

    14 novembre 2024, par Andrei

    I have the original video and it's modified frames in a folder. Now I want to assemble the modified frames into a new video. I also want to take the audio from the original video and add it to the new video.

    


    My latest code is this using fluent-ffmpeg. But it's not working.

    


    await new Promise((resolve, reject) => {
  ffmpeg(path.join(processedFramesDir, "frame-%d.png"))
    .inputOptions(["-framerate 30", "-start_number 1"])
    .input(videoPath)
    .outputOptions([
      "-c:v",
      "libx264",
      "-c:a",
      "copy",
      "-shortest",
      "-r",
      "30",
      "-pix_fmt",
      "yuv420p",
    ])
    .outputOptions(["-map 0:v:0", "-map 1:a:0"])
    .save(outputVideoPath)
    .on("start", (commandLine) => {
      console.log("FFmpeg command: " + commandLine);
    })
    .on("stderr", (stderrLine) => {
      console.log("FFmpeg stderr: " + stderrLine);
    })
    .on("end", resolve)
    .on("error", (err, stdout, stderr) => {
      console.error("Error assembling video:", err);
      console.error("FFmpeg stderr:", stderr);
      reject(err);
    });
});


    


    I get this error even though the frames exist and they are valid pngs :&#xA;FFmpeg command: ffmpeg -framerate 30 -start_number 1 -i /tmp/video-processing-CyULOE/processedFrames/frame-%05d.png -i /tmp/video-processing-CyULOE/input.mp4 -y -c:v libx264 -c:a copy -shortest -r 30 -pix_fmt yuv420p -map 0:v:0 -map 1:a:0 /tmp/video-processing-CyULOE/output.mp4 2024-11-13 23:40:27 FFmpeg stderr: ffmpeg version 4.1.11-0&#x2B;deb10u1 Copyright (c) 2000-2023 the FFmpeg developers 2024-11-13 23:40:27 FFmpeg stderr:   built with gcc 8 (Debian 8.3.0-6) 2024-11-13 23:40:27 FFmpeg stderr:   configuration: --prefix=/usr --extra-version=0&#x2B;deb10u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared 2024-11-13 23:40:27 FFmpeg stderr:   libavutil      56. 22.100 / 56. 22.100 2024-11-13 23:40:27 FFmpeg stderr:   libavcodec     58. 35.100 / 58. 35.100 2024-11-13 23:40:27 FFmpeg stderr:   libavformat    58. 20.100 / 58. 20.100 2024-11-13 23:40:27 FFmpeg stderr:   libavdevice    58.  5.100 / 58.  5.100 2024-11-13 23:40:27 FFmpeg stderr:   libavfilter     7. 40.101 /  7. 40.101 2024-11-13 23:40:27 FFmpeg stderr:   libavresample   4.  0.  0 /  4.  0.  0 2024-11-13 23:40:27 FFmpeg stderr:   libswscale      5.  3.100 /  5.  3.100 2024-11-13 23:40:27 FFmpeg stderr:   libswresample   3.  3.100 /  3.  3.100 2024-11-13 23:40:27 FFmpeg stderr:   libpostproc    55.  3.100 / 55.  3.100 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646F8A20000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646C89F0000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946464EA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464628A40000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946467CA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646BAA10000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646ACA30000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464670A80000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646E8A60000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x524946469AA60000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464672A90000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646B8A50000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646AAA80000. 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:27 FFmpeg stderr:     Last message repeated 1 times 2024-11-13 23:40:27 FFmpeg stderr: [png @ 0x5630fb89a880] Invalid PNG signature 0x5249464646A80000. 2024-11-13 23:40:27 FFmpeg stderr: [image2 @ 0x5630fb898a40] decoding for stream 0 failed 2024-11-13 23:40:27 FFmpeg stderr: [image2 @ 0x5630fb898a40] Could not find codec parameters for stream 0 (Video: png, none(pc)): unspecified size 2024-11-13 23:40:27 FFmpeg stderr: Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options 2024-11-13 23:40:27 FFmpeg stderr: Input #0, image2, from &#x27;/tmp/video-processing-CyULOE/processedFrames/frame-%05d.png&#x27;: 2024-11-13 23:40:27 FFmpeg stderr:   Duration: 00:00:00.60, start: 0.000000, bitrate: N/A 2024-11-13 23:40:27 FFmpeg stderr:     Stream #0:0: Video: png, none(pc), 30 fps, 30 tbr, 30 tbn, 30 tbc 2024-11-13 23:40:28 FFmpeg stderr: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/tmp/video-processing-CyULOE/input.mp4&#x27;: 2024-11-13 23:40:28 FFmpeg stderr:   Metadata: 2024-11-13 23:40:28 FFmpeg stderr:     major_brand     : isom 2024-11-13 23:40:28 FFmpeg stderr:     minor_version   : 512 2024-11-13 23:40:28 FFmpeg stderr:     compatible_brands: isomiso2avc1mp41 2024-11-13 23:40:28 FFmpeg stderr:     encoder         : Lavf60.16.100 2024-11-13 23:40:28 FFmpeg stderr:   Duration: 00:00:00.62, start: 0.000000, bitrate: 4289 kb/s 2024-11-13 23:40:28 FFmpeg stderr:     Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4395 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) 2024-11-13 23:40:28 FFmpeg stderr:     Metadata: 2024-11-13 23:40:28 FFmpeg stderr:       handler_name    : VideoHandler 2024-11-13 23:40:28 FFmpeg stderr:     Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default) 2024-11-13 23:40:28 FFmpeg stderr:     Metadata: 2024-11-13 23:40:28 FFmpeg stderr:       handler_name    : SoundHandler 2024-11-13 23:40:28 FFmpeg stderr: Stream mapping: 2024-11-13 23:40:28 FFmpeg stderr:   Stream #0:0 -> #0:0 (png (native) -> h264 (libx264)) 2024-11-13 23:40:28 FFmpeg stderr:   Stream #1:1 -> #0:1 (copy) 2024-11-13 23:40:28 FFmpeg stderr: Press [q] to stop, [?] for help 2024-11-13 23:40:28 FFmpeg stderr: [image2 @ 0x5630fb898a40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8) 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646F8A20000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646C89F0000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x524946464EA10000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x5249464628A40000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x524946467CA10000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646AAA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x52494646BAA10000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x52494646ACA30000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr:     Last message repeated 1 times 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x5249464670A80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646E8A60000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x524946469AA60000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x5249464672A90000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba40600] Invalid PNG signature 0x52494646B8A50000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb8c7900] Invalid PNG signature 0x52494646AAA80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb9b7700] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fb988dc0] Invalid PNG signature 0x52494646A0A70000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr: [png @ 0x5630fba3edc0] Invalid PNG signature 0x5249464646A80000. 2024-11-13 23:40:28 FFmpeg stderr: Error while decoding stream #0:0: Invalid data found when processing input 2024-11-13 23:40:28 FFmpeg stderr:     Last message repeated 4 times 2024-11-13 23:40:28 FFmpeg stderr: Cannot determine format of input stream 0:0 after EOF 2024-11-13 23:40:28 FFmpeg stderr: Error marking filters as finished 2024-11-13 23:40:28 FFmpeg stderr: Conversion failed! 2024-11-13 23:40:28 FFmpeg stderr:  2024-11-13 23:40:28 Error assembling video: Error: ffmpeg exited with code 1: Cannot determine format of input stream 0:0 after EOF 2024-11-13 23:40:28 Error marking filters as finished 2024-11-13 23:40:28 Conversion failed! 2024-11-13 23:40:28  2024-11-13 23:40:28     at ChildProcess.<anonymous> (/usr/src/app/node_modules/fluent-ffmpeg/lib/processor.js:180:22) 2024-11-13 23:40:28     at ChildProcess.emit (node:events:519:28) 2024-11-13 23:40:28     at ChildProcess._handle.onexit (node:internal/child_process:294:12)</anonymous>

    &#xA;

    The code used to

    &#xA;

    ffmpeg(videoPath) .screenshots({ folder: framesDir, filename: "frame-%i.png", size: "?x1080", count: 10, }) .on("end", resolve) .on("error", reject);&#xA;

    &#xA;

    The pngs are valid and displaying in windows photos viewer enter image description here

    &#xA;

  • Screen recording with ffmpeg has stuttering [closed]

    7 novembre 2024, par Adam Labuš

    I am recording with ffmpeg like so : ffmpeg -f x11grab -probesize 18M -framerate 30 -video_size 1920x1080 -i :0.0&#x2B;0,0 -f pulse -i  -c:v libx264 -preset ultrafast -c:a aac .mkv

    &#xA;

    Problem :

    &#xA;

    Usually at the start the video starts to stutter, sometimes stuttering up to 20 seconds, each frame during this stuttering is shown for 1-5 seconds. Example video : https://drive.google.com/file/d/1uwdaFboCO2qNALgaPC8JD15W64BE3VyY/view?usp=sharing

    &#xA;

    Diagnostics :

    &#xA;

    Machine details :

    &#xA;

    OS: Fedora Linux 41 (Server Edition) x86_64&#xA;Host: HP ProDesk 600 G2 DM&#xA;Kernel: Linux 6.11.5-300.fc41.x86_64&#xA;WM: Openbox (X11)&#xA;CPU: Intel(R) Core(TM) i5-6500T (4) @ 3.10 GHz&#xA;GPU: Intel HD Graphics 530 @ 1.10 GHz [Integrated]&#xA;Memory: 884.62 MiB / 15.49 GiB (6%)&#xA;Swap: 0 B / 8.00 GiB (0%)&#xA;Disk (/): 5.45 GiB / 14.94 GiB (37%) - xfs&#xA;

    &#xA;

    My gpu(20%), cpu (50%), disk utilisation is always in well perfect range - I tried stress testing gpu, ram, cpu and disk while recording and it had no effect on the recording. I tried recording to ramdisk. I always have 10gb ram available. I ran the same command on my laptop (hp 850 g5) and computer and encountered no stuttering at all.

    &#xA;

    If it matters the machine is running bare Xorg and openbox display manager

    &#xA;

    I have tried :

    &#xA;

      &#xA;
    • setting fps_mode to cfr - because the frame rate does fluctuate around 29-30 at the start
    • &#xA;

    • setting fps_mode to vfr
    • &#xA;

    • setting fps_mode to passthrough
    • &#xA;

    • setting cfr all the way to 40
    • &#xA;

    • presets veryfast, faster
    • &#xA;

    • increasing thread_queue_size
    • &#xA;

    • async=1
    • &#xA;

    &#xA;

    Ffmpeg Log :

    &#xA;

    ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers                                                                                                                                                                                                              &#xA;  built with gcc 14 (GCC)                                                                                                                                                                                                                                                       &#xA;  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags=&#x27;-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-swi&#xA;tches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 &#xA;-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer&#x27; --extra-ldflags=&#x27;-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/re&#xA;dhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 &#x27; --extra-cflags=&#x27; -I/usr/include/rav1e&#x27; --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --enable-fontcon&#xA;fig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcodec2 --enable-libcdio --enable-libdrm --enabl&#xA;e-libjack --enable-libjxl --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenh264 --enable-libopenjpeg --enabl&#xA;e-libopenmpt --enable-libopus --enable-libpulse --enable-libplacebo --enable-librsvg --enable-librav1e --enable-librubberband --enable-libqrencode --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh&#xA; --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libshaderc --enable-libwebp --enable-l&#xA;ibx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-strip&#xA;ping --shlibdir=/usr/lib64 --enable-lto --enable-libvpl --enable-runtime-cpudetect                                                                                                                                                                                              &#xA;  libavutil      59.  8.100 / 59.  8.100                                                                                                                                                                                                                                        &#xA;  libavcodec     61.  3.100 / 61.  3.100                                                                                                                                                                                                                                        &#xA;  libavformat    61.  1.100 / 61.  1.100                                                                                                                                                                                                                                        &#xA;  libavdevice    61.  1.100 / 61.  1.100                                                                                                                                                                                                                                        &#xA;  libavfilter    10.  1.100 / 10.  1.100                                                                                                                                                                                                                                        &#xA;  libswscale      8.  1.100 /  8.  1.100                                                                                                                                                                                                                                        &#xA;  libswresample   5.  1.100 /  5.  1.100                                                                                                                                                                                                                                        &#xA;  libpostproc    58.  1.100 / 58.  1.100                                                                                                                                                                                                                                        &#xA;Input #0, x11grab, from &#x27;:0.0&#x2B;0,0&#x27;:                                                                                                                                                                                                                                             &#xA;  Duration: N/A, start: 1730923728.417205, bitrate: 1990656 kb/s                                                                                                                                                                                                                &#xA;  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1990656 kb/s, 30 fps, 29.92 tbr, 1000k tbn                                                                                                                                                                 &#xA;[aist#1:0/pcm_s16le @ 0x55a29c634a40] Guessed Channel Layout: stereo                                                                                                                                                                                                            &#xA;Input #1, pulse, from &#x27;auto_null.monitor&#x27;:                                                                                                                                                                                                                                      &#xA;  Duration: N/A, start: 1730923728.521148, bitrate: 1536 kb/s                                                                                                                                                                                                                   &#xA;  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s                                                                                                                                                                                                               &#xA;Stream mapping:                                                                                                                                                                                                                                                                 &#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))                                                                                                                                                                                                                     &#xA;  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))                                                                                                                                                                                                                      &#xA;Press [q] to stop, [?] for help                                                                                                                                                                                                                                                 &#xA;[libx264 @ 0x55a29c627f00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2                                                                                                                                                                                &#xA;[libx264 @ 0x55a29c627f00] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit                                                                                                                                                                                               &#xA;[libx264 @ 0x55a29c627f00] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 tre&#xA;llis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250&#xA; keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00                                                                                                                                &#xA;Output #0, matroska, to &#x27;/tmp/tmp38n41uwz.mkv&#x27;:                                                                                                                                                                                                                                 &#xA;  Metadata:                                                                                                                                                                                                                                                                     &#xA;    encoder         : Lavf61.1.100                                                                                                                                                                                                                                              &#xA;  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv444p(progressive), 1920x1080, q=2-31, 29.92 fps, 1k tbn                                                                                                                                                                      &#xA;      Metadata:                                                                                                       &#xA;        encoder         : Lavc61.3.100 libx264                                                                        &#xA;      Side data:                                                                                                      &#xA;        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A                                                 &#xA;  Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 128 kb/s                            &#xA;      Metadata:                                                                                                       &#xA;        encoder         : Lavc61.3.100 aac                                                                            &#xA;frame=  915 fps= 24 q=29.0 size=    7936KiB time=00:00:35.79 bitrate=1816.0kbits/s dup=0 drop=167 speed=0.929x        &#xA;                                                                                                                      &#xA;[q] command received. Exiting.&#xA;

    &#xA;

  • Error Opening RTMP Stream through FFmpeg command when executed through exec package [closed]

    3 octobre 2024, par Akhil

    I have been trying to transcode the live stream from RTMP server running on rtmp://localhost:1936/live/test with FFmpeg in a Go application using os/exec package, But seems to not work and gives the input/output error (I have attached below). The same exact ffmpeg command when I execute on terminal, works as its supposed to. Not Sure why that is, here is my code for reproducing and analyzing the mistakes.

    &#xA;

    ffmpegCmd := fmt.Sprintf("ffmpeg -nostdin -i rtmp://localhost:1936/live/%s -c:v libx264 -s %s -f %s %s/stream.mpd",&#xA;        streamKey, resolution, sp.OutputFormat, outputPath)&#xA;    log.Printf("Executing FFmpeg command: %s", ffmpegCmd)&#xA;&#xA;    // Prepare the command execution with a timeout context&#xA;    ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) // Set a 60-second timeout&#xA;    defer cancel()&#xA;&#xA;    cmd := exec.CommandContext(ctx, "bash", "-c", ffmpegCmd)&#xA;

    &#xA;

    the ffmpeg command looks like this :
    &#xA;ffmpeg -nostdin -i rtmp://localhost:1936/live/test -c:v libx264 -s 1920x1080 -f dash output/test/1080p/stream.mpd

    &#xA;

    I get the following error :

    &#xA;

    Error opening input: Input/output error&#xA;&#xA;Error opening input file rtmp://localhost:1936/live/test.&#xA;&#xA;Error opening input files: Input/output error&#xA;&#xA;Exiting normally, received signal 2.&#xA;&#xA;signal: interrupt&#xA;

    &#xA;

    I have already tried to break the command, and then execute it. Something like :

    &#xA;

    cmd := exec.CommandContext(ctx,&#xA;        "ffmpeg",&#xA;        "-nostdin",&#xA;        "-i", "rtmp://localhost:1936/live/"&#x2B;streamKey,&#xA;        "-c:v", "libx264",&#xA;        "-s", resolution,&#xA;        "-f", sp.OutputFormat,&#xA;        outputPath&#x2B;"/stream.mpd")&#xA;

    &#xA;

    After running the ffmpeg command with -loglevel debug and -report :

    &#xA;

    Here is the logs and errors I get :

    &#xA;

    When I run it within the go application :

    &#xA;

    ffmpeg started on 2024-10-02 at 12:00:06&#xA;Report written to "ffmpeg-20241002-120006.log"&#xA;Log level: 48&#xA;Command line:&#xA;ffmpeg -loglevel debug -report -i rtmp://localhost:1936/live/test -c:v libx264 -s 1920x1080 -f dash ./output/test/1080p/stream.mpd&#xA;ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers&#xA;  built with Apple clang version 15.0.0 (clang-1500.3.9.4)&#xA;  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.2_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags=&#x27;-Wl,-ld_classic&#x27; --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon&#xA;  libavutil      59.  8.100 / 59.  8.100&#xA;  libavcodec     61.  3.100 / 61.  3.100&#xA;  libavformat    61.  1.100 / 61.  1.100&#xA;  libavdevice    61.  1.100 / 61.  1.100&#xA;  libavfilter    10.  1.100 / 10.  1.100&#xA;  libswscale      8.  1.100 /  8.  1.100&#xA;  libswresample   5.  1.100 /  5.  1.100&#xA;  libpostproc    58.  1.100 / 58.  1.100&#xA;Splitting the commandline.&#xA;Reading option &#x27;-loglevel&#x27; ... matched as option &#x27;loglevel&#x27; (set logging level) with argument &#x27;debug&#x27;.&#xA;Reading option &#x27;-report&#x27; ... matched as option &#x27;report&#x27; (generate a report) with argument &#x27;1&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;rtmp://localhost:1936/live/test&#x27;.&#xA;Reading option &#x27;-c:v&#x27; ... matched as option &#x27;c&#x27; (select encoder/decoder (&#x27;copy&#x27; to copy stream without reencoding)) with argument &#x27;libx264&#x27;.&#xA;Reading option &#x27;-s&#x27; ... matched as option &#x27;s&#x27; (set frame size (WxH or abbreviation)) with argument &#x27;1920x1080&#x27;.&#xA;Reading option &#x27;-f&#x27; ... matched as option &#x27;f&#x27; (force container format (auto-detected otherwise)) with argument &#x27;dash&#x27;.&#xA;Reading option &#x27;./output/test/1080p/stream.mpd&#x27; ... matched as output url.&#xA;Finished splitting the commandline.&#xA;Parsing a group of options: global .&#xA;Applying option loglevel (set logging level) with argument debug.&#xA;Applying option report (generate a report) with argument 1.&#xA;Successfully parsed a group of options.&#xA;Parsing a group of options: input url rtmp://localhost:1936/live/test.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: rtmp://localhost:1936/live/test.&#xA;[AVFormatContext @ 0x13f721f90] Opening &#x27;rtmp://localhost:1936/live/test&#x27; for reading&#xA;[rtmp @ 0x13f6040e0] No default whitelist set&#xA;[tcp @ 0x13f7223d0] No default whitelist set&#xA;[tcp @ 0x13f7223d0] Original list of addresses:&#xA;[tcp @ 0x13f7223d0] Address ::1 port 1936&#xA;[tcp @ 0x13f7223d0] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x13f7223d0] Interleaved list of addresses:&#xA;[tcp @ 0x13f7223d0] Address ::1 port 1936&#xA;[tcp @ 0x13f7223d0] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x13f7223d0] Starting connection attempt to ::1 port 1936&#xA;[tcp @ 0x13f7223d0] Connection attempt to ::1 port 1936 failed: Connection refused&#xA;[tcp @ 0x13f7223d0] Starting connection attempt to 127.0.0.1 port 1936&#xA;[tcp @ 0x13f7223d0] Successfully connected to 127.0.0.1 port 1936&#xA;[rtmp @ 0x13f6040e0] Handshaking...&#xA;[rtmp @ 0x13f6040e0] Type answer 3&#xA;[rtmp @ 0x13f6040e0] Server version 13.14.10.13&#xA;[rtmp @ 0x13f6040e0] Proto = rtmp, path = /live/test, app = live, fname = test&#xA;[rtmp @ 0x13f6040e0] Window acknowledgement size = 5000000&#xA;[rtmp @ 0x13f6040e0] Max sent, unacked = 5000000&#xA;[rtmp @ 0x13f6040e0] New incoming chunk size = 4096&#xA;[rtmp @ 0x13f6040e0] Creating stream...&#xA;[rtmp @ 0x13f6040e0] Sending play command for &#x27;test&#x27;&#xA;[rtmp @ 0x13f6040e0] Deleting stream...&#xA;[in#0 @ 0x13f721d40] Error opening input: Input/output error&#xA;Error opening input file rtmp://localhost:1936/live/test.&#xA;Error opening input files: Input/output error&#xA;Exiting normally, received signal 2.&#xA;

    &#xA;

    This is what i get when i run the same command on terminal :

    &#xA;

    <same as="as" but="but" please="please" scroll="scroll" further="further">&#xA;&#xA;[rtmp @ 0x1437144c0] No default whitelist set&#xA;[tcp @ 0x143604f20] No default whitelist set&#xA;[tcp @ 0x143604f20] Original list of addresses:&#xA;[tcp @ 0x143604f20] Address ::1 port 1936&#xA;[tcp @ 0x143604f20] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Interleaved list of addresses:&#xA;[tcp @ 0x143604f20] Address ::1 port 1936&#xA;[tcp @ 0x143604f20] Address 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Starting connection attempt to ::1 port 1936&#xA;[tcp @ 0x143604f20] Connection attempt to ::1 port 1936 failed: Connection refused&#xA;[tcp @ 0x143604f20] Starting connection attempt to 127.0.0.1 port 1936&#xA;[tcp @ 0x143604f20] Successfully connected to 127.0.0.1 port 1936&#xA;[rtmp @ 0x1437144c0] Handshaking...&#xA;[rtmp @ 0x1437144c0] Type answer 3&#xA;[rtmp @ 0x1437144c0] Server version 13.14.10.13&#xA;[rtmp @ 0x1437144c0] Proto = rtmp, path = /live/test, app = live, fname = test&#xA;[rtmp @ 0x1437144c0] Window acknowledgement size = 5000000&#xA;[rtmp @ 0x1437144c0] Max sent, unacked = 5000000&#xA;[rtmp @ 0x1437144c0] New incoming chunk size = 4096&#xA;[rtmp @ 0x1437144c0] Creating stream...&#xA;[rtmp @ 0x1437144c0] Sending play command for &#x27;test&#x27;&#xA;[flv @ 0x143604b30] Format flv probed with size=2048 and score=100&#xA;[flv @ 0x143604b30] Before avformat_find_stream_info() pos: 13 bytes read:2263 seeks:0 nb_streams:0&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 64, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 64, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 120, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft4_fwd_float_neon - type: fft_float, len: 4, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 128, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 64, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 480, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft16_ns_float_neon - type: fft_float, len: 16, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 512, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 256, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_pfa_15xM_inv_float_c - type: mdct_float, len: 960, factors[2]: [15, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft32_ns_float_neon - type: fft_float, len: 32, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: mdct_float, len: 1024, factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 512, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;Transform tree:&#xA;    mdct_fwd_float_c - type: mdct_float, len: 1024, factors[2]: [2, any], flags: [unaligned, out_of_place, fwd_only]&#xA;        fft_sr_ns_float_neon - type: fft_float, len: 512, factor: 2, flags: [aligned, inplace, out_of_place, preshuf]&#xA;[NULL @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[NULL @ 0x144124920] Decoding VUI&#xA;[NULL @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[NULL @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0x144124920] Decoding VUI&#xA;[h264 @ 0x144124920] Format yuv420p chosen by get_format().&#xA;[h264 @ 0x144124920] Reinit context to 1280x720, pix_fmt: yuv420p&#xA;[h264 @ 0x144124920] no picture &#xA;[flv @ 0x143604b30] All info found&#xA;[flv @ 0x143604b30] rfps: 29.666667 0.016552&#xA;[flv @ 0x143604b30] rfps: 29.750000 0.009347&#xA;[flv @ 0x143604b30] rfps: 29.750000 0.009347&#xA;[flv @ 0x143604b30] rfps: 29.833333 0.004197&#xA;[flv @ 0x143604b30] rfps: 29.916667 0.001104&#xA;[flv @ 0x143604b30] rfps: 29.916667 0.001104&#xA;[flv @ 0x143604b30] rfps: 30.000000 0.000067&#xA;[flv @ 0x143604b30] rfps: 30.000000 0.000067&#xA;[flv @ 0x143604b30] rfps: 60.000000 0.000270&#xA;[flv @ 0x143604b30] rfps: 60.000000 0.000270&#xA;[flv @ 0x143604b30] rfps: 120.000000 0.001079&#xA;[flv @ 0x143604b30] rfps: 120.000000 0.001079&#xA;[flv @ 0x143604b30] rfps: 240.000000 0.004316&#xA;[flv @ 0x143604b30] rfps: 240.000000 0.004316&#xA;[flv @ 0x143604b30] rfps: 29.970030 0.000204&#xA;[flv @ 0x143604b30] rfps: 29.970030 0.000204&#xA;[flv @ 0x143604b30] rfps: 59.940060 0.000814&#xA;[flv @ 0x143604b30] rfps: 59.940060 0.000814&#xA;[flv @ 0x143604b30] After avformat_find_stream_info() pos: 496783 bytes read:496783 seeks:0 frames:179&#xA;Input #0, flv, from &#x27;rtmp://localhost:1936/live/test&#x27;:&#xA;  Metadata:&#xA;    |RtmpSampleAccess: true&#xA;    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)&#xA;    displayWidth    : 1280&#xA;    displayHeight   : 720&#xA;    fps             : 30&#xA;    profile         : &#xA;    level           : &#xA;  Duration: 00:00:00.00, start: 6.742000, bitrate: N/A&#xA;  Stream #0:0, 138, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp, 163 kb/s&#xA;  Stream #0:1, 41, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(tv, bt709, progressive, left), 1280x720 [SAR 1:1 DAR 16:9], 0/1, 2560 kb/s, 30 fps, 30 tbr, 1k tbn&#xA;Successfully opened the file.&#xA;Parsing a group of options: output url ./output/test/1080p/stream.mpd.&#xA;Applying option c:v (select encoder/decoder (&#x27;copy&#x27; to copy stream without reencoding)) with argument libx264.&#xA;Applying option s (set frame size (WxH or abbreviation)) with argument 1920x1080.&#xA;Applying option f (force container format (auto-detected otherwise)) with argument dash.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: ./output/test/1080p/stream.mpd.&#xA;[out#0/dash @ 0x123707480] No explicit maps, mapping streams automatically...&#xA;[vost#0:0/libx264 @ 0x123707d60] Created video stream from input stream 0:1&#xA;detected 10 logical cores&#xA;[h264 @ 0x123607b70] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0x123607b70] Decoding VUI&#xA;[h264 @ 0x123607b70] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[aost#0:1/aac @ 0x144028080] Created audio stream from input stream 0:0&#xA;Transform tree:&#xA;    mdct_inv_float_c - type: md&#xA;&#xA;<it simply="simply" starts="starts" working="working">&#xA;</it></same>

    &#xA;

    I am not sure if there is something to do with Permissions.

    &#xA;