Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (89)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (11304)

  • Piping stream to ffmpeg via forked process stdin

    6 novembre 2019, par Yanick Salzmann

    I am piping data from my raspberry pi camera to ffmpeg to convert them into an mp4 stream. I do so not with libavformat/libavformat but I call ffmpeg directly like this :

           context->ffmpeg_process = utils::launch_subprocess(
                   "ffmpeg",
                   {"-f", "rawvideo", "-pix_fmt", "yuv420p", "-s", "1920x1080", "-r", "30", "-i", "-", "-c", "libx264", "-f", "mp4", "-movflags", "frag_keyframe+empty_moov", "-", "-loglevel", "trace"}
           );

    This is my wrapper around fork and exec like this :

           const auto child = fork();
           if(child == 0) {
               if (dup2(stdin_pipe[PIPE_READ], STDIN_FILENO) == -1) {
                   exit(errno);
               }

               // same for stdout and sterr

               execvp(command.c_str(), proc_args);
               exit(errno);
           } else if(child > 0) {
               // same for stdout and stderr
               ret_process.stdin_pipe = stdin_pipe[PIPE_WRITE];
           }

    Now I have a callback that is called by the raspberry pi camera :

       void CameraHandler::handle_camera_frame(const std::vector &data, std::size_t size) {
           FILE* f = fopen("output.yuv4", "ab");
           fwrite(data.data(), 1, size, f);
           fclose(f);

           std::lock_guard l{_listener_lock};
           for (const auto &listener : _data_listeners) {
               std::size_t written = 0;
               while (written < size) {
                   const auto num_written = write(listener->ffmpeg_process.stdin_pipe, data.data() + written, size - written);
                   written += num_written;
                   if(num_written < 0) {
                       log->error("Broken stdin pipe");
                       break;
                   }
               }
           }
       }

    I deliberately append every frame to a file because I am running the exact same command as above (with cat output.yuv4 | ffmpeg ... > output4.mp4 to cross check).

    Now I can see that I am reading some data from my camera and pushing it to the ffmpeg process. But already after the first read ffmpeg complains, that the input data is invalid :

    [2019-11-06 20:08:04.010] [11872:11932] [carpi::data::CameraHandler] [info] Launched ffmpeg process. PID: 11933, error: 0
    [2019-11-06 20:08:04.014] [11872:11932] [carpi::video::RawCameraStream] [info] Camera dimension: 1920/1080
    ffmpeg version 4.1.4-1+rpt1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 8 (Raspbian 8.3.0-6+rpi1)
     configuration: --prefix=/usr --extra-version='1+rpt1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --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-omx-rpi --enable-mmal --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    Successfully parsed a group of options.
    Parsing a group of options: input url -.
    Applying option pix_fmt (set pixel format) with argument yuv420p.
    Applying option s (set frame size (WxH or abbreviation)) with argument 1920x1080.
    Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 30.
    Successfully parsed a group of options.
    Opening an input file: -.
    [NULL @ 0xcd02d0] Opening 'pipe:' for reading
    [pipe @ 0xcd0b50] Setting default whitelist 'crypto'
    [AVIOContext @ 0xcd8d50] Statistics: 1048576 bytes read, 0 seeks
    pipe:: Invalid data found when processing input

    I am now confused. This is literally the same as I am fwriteing and then piping from the file. Is there something wrong with my write ?

  • How to make my video in landscape mode using ffmpeg

    6 novembre 2019, par Aarwil

    I have four video chats. Somehow I have managed to cut videos into pieces, stored in array then stacked and finally concat the video which is in the youtube link down below. I have used the size in the portrait view is 640*480. But I need to show them in the landscape. Suggest me any ideas.

    Landscape view :
    https://youtu.be/u8tmL2-CdK0
    Portrait view :
    https://youtu.be/lO-Q3I9X8OA

    These are my inputs

    Input #0, matroska,webm, from 'PA473fbf06ed1f952f95c88b9cf22ed0ba_pre.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2019-11-05T06:08:19.000000Z
     Duration: 00:01:05.50, start: 63.041000, bitrate: 30 kb/s
       Stream #0:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         title           : Video
    Input #1, matroska,webm, from 'PA183db0ed986039de3197092103a411eb_pre.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2019-11-05T06:07:20.000000Z
     Duration: 00:03:15.14, start: 4.062000, bitrate: 172 kb/s
       Stream #1:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         title           : Video
    Input #2, matroska,webm, from 'PA62a810038cbcc00be21fac43e98f5ee1_pre.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2019-11-05T06:07:45.000000Z
     Duration: 00:02:21.71, start: 28.803000, bitrate: 92 kb/s
       Stream #2:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         title           : Video
    Input #3, matroska,webm, from 'PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2019-11-05T06:07:48.000000Z
     Duration: 00:01:50.69, start: 32.318000, bitrate: 28 kb/s
       Stream #3:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         title           : Video

    At first, I change all the video resolution to 640:480 because each video may have different resolution (probability). So I am setting a fixed resolution.

    ffmpeg -i PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv -vf scale=640:480 PA8fa44ff1ba37ee510a045198bca6f04a.mkv -hide_banner
    Input #0, matroska,webm, from PA8fa44ff1ba37ee510a045198bca6f04a_pre.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2019-11-05T06:07:48.000000Z
     Duration: 00:01:50.69, start: 32.318000, bitrate: 28 kb/s
       Stream #0:0(eng): Video: h264 (Baseline), yuvj420p(pc, progressive), 360x480, SAR 1:1 DAR 3:4, 15 fps, 15 tbr, 1k tbn, 2k tbc (default)
       Metadata:
         title           : Video
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [swscaler @ 0000021d72eb3f80] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0000021d72b33b40] using SAR=9/16
    [libx264 @ 0000021d72b33b40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0000021d72b33b40] profile High, level 2.2, 4:2:0, 8-bit
    [libx264 @ 0000021d72b33b40] 264 - core 158 r2984 3759fcb - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 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 keyint_min=15 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
    Output #0, matroska, to 'PA8fa44ff1ba37ee510a045198bca6f04a.mkv':
     Metadata:
       encoder         : Lavf58.32.104
       Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuvj420p(pc), 640x480 [SAR 9:16 DAR 3:4], q=-1--1, 15 fps, 1k tbn, 15 tbc (default)
       Metadata:
         title           : Video
         encoder         : Lavc58.56.101 libx264

    Two videos merging command

    ffmpeg
    -i ddb97d85-fc21-4fb4-8062-ca2084a48aeb.mkv
    -i a8665a5f-fb5e-44cb-a072-070fbe07a14f.mkv
    -filter_complex "[0:v][1:v]hstack" 1572934056.mkv

    Three videos merging command

    ffmpeg
    -i 16f90447-c8b6-4077-b3b6-4fb2c07e19b5.mkv
    -i ef501109-0ee9-4924-8de1-65eb796a4a78.mkv
    -i 0b284aa6-4175-472c-aaf6-837412f97f32.mkv
    -filter_complex "[1:v]scale=320:-1[left]; [2:v]scale=320:-1[right]; [left][right]hstack[bottom]; [0:v][bottom]vstack" 1572934058.mkv

    Concat Command

    ffmpeg
    -i 1572934031.mkv -i 1572934056.mkv -i 1572934058.mkv -i 1572934089.mkv -i 1572934155.mkv -i 1572934169.mkv -i 1572934198.mkv -filter_complex "[0]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[0v];[1]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[1v];[2]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[2v];[3]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[3v];[4]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[4v];[5]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[5v];[6]scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,fps=fps=30,setsar=1[6v];[0v][1v][2v][3v][4v][5v][6v]concat=n=7:v=1:a=0[v]" -map "[v]" 4c21f002fa76b148c00cc6fbceaa57ee.mp4
  • How to solve Fatal error : Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException : ffmpeg failed to execute command

    7 novembre 2019, par Ahmed Rashid

    I am trying to encode video using the PHP-FFMpeg library, but there are some errors that are shown to me. The errors :

    Fatal error : Uncaught
    Alchemy\BinaryDriver\Exception\ExecutionFailureException : ffmpeg
    failed to execute command "C :/FFmpeg/bin/ffmpeg.exe" -y -i video1.mp4
    -async 1 -metadata:s:v:0 start_time=0 -threads 12 -vcodec libx264 -acodec libfaac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf "[in]scale=320:240 [out]" -pass 1 -passlogfile "C :\Users\DELL\AppData\Local\Temp\ffmpeg-passes5d9e35f516ce1e66b8/pass-5d9e35f517030"
    export-x264.mp4 : Error Output : ffmpeg version N-95216-ge6625ca41f
    Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9.2.1
    (GCC) 20190918 configuration : —enable-gpl —enable-version3
    —enable-sdl2 —enable-fontconfig —enable-gnutls —enable-iconv —enable-libass —enable-libdav1d —enable-libbluray —enable-libfreetype —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libtheor in C :\xampp\htdocs\AnimeX\s2\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Media\AbstractVideo.php
    on line 106`

    The library is PHP-FFMpeg library.