Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (20)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (4228)

  • Converting RGB to YUV, + ffmpeg

    10 juillet 2012, par TheSHEEEP

    I am trying the following to record a live video from my Flash/AIR application :

    1. I take a "screenshot" (BitmapData from stage) each frame.
    2. I convert each pixel to yuv format like this (V2) :

         var file :File = new File(_appUrl + "/creation/output.raw");
         var fs :FileStream = new FileStream();
         fs.open(file, FileMode.WRITE);
         var finalY :ByteArray = new ByteArray();
         var finalU :ByteArray = new ByteArray();
         var finalV :ByteArray = new ByteArray();
         var rect :Rectangle = new Rectangle(0, 0, 600, 700);
         var pixels :ByteArray;
         var pixel :uint;
         var r :uint;
         var g :uint;
         var b :uint;
         _screenBuffer = _screenBuffer.reverse();
         while (_screenBuffer.length > 0)
         {
             pixels = BitmapData(_screenBuffer.pop()).getPixels(rect);
             pixels.position = 0;
             // Convert and save each pixel
             for (var x:int = 0; x < 600; x++)
             {
                 for (var y:int = 0; y < 700; y++)
                 {
                     // Convert to yuv
                     pixel = pixels.readUnsignedInt();
                     r = pixel >> 16 & 0xff;
                     g = pixel >> 8 & 0xff;
                     b = pixel & 0xff;
                         // Y' is written for each pixel
                     finalY.writeByte(0.257 * r + 0.504 * g + 0.098 * b + 128);
                         // U and V are written once per 2x2 pixel block
                     if (x % 2 == 0 && y % 2 == 0)
                     {
                         finalU.writeByte(-0.148 * r - 0.291 * g + 0.439 * b + 128);
                         finalV.writeByte(0.439 * r - 0.368 * g - 0.071 * b + 128);
                     }
                 }
             }
         }
         // Write the converted bytes to the file
         finalY.position = 0;
         finalU.position = 0;
         finalV.position = 0;
         fs.writeBytes(finalY, 0, finalY.length);
         fs.writeBytes(finalU, 0, finalU.length);
         fs.writeBytes(finalV, 0, finalV.length);
         fs.close();
    3. I use the following line of ffmpeg to convert the raw file to a video :

      ffmpeg -r 30 -pix_fmt yuv420p -s 600x700 -vcodec rawvideo -f rawvideo -i output.raw -y test.mp4

    A video is created, but it is simply a mess, barely resembling what was recorded. I know that the capturing process works, as I have tried the same BitmapData "screenshots" with the SimpleFlvWriter.

    So, either something is wrong with my conversion or with the ffmpeg line, but I have no idea.

    This is what ffmpeg outputs when creating the video, maybe it can help someone :

    libavutil      51. 39.100 / 51. 39.100
    libavcodec     54.  3.101 / 54.  3.101
    libavformat    54.  1.100 / 54.  1.100
    libavdevice    53.  4.100 / 53.  4.100
    libavfilter     2. 62.101 /  2. 62.101
    libswscale      2.  1.100 /  2.  1.100
    libswresample   0.  7.100 /  0.  7.100
    libpostproc    52.  0.100 / 52.  0.100
    [rawvideo @ 01D39FC0] Estimating duration from bitrate, this may be inaccurate
    Input #0, rawvideo, from 'output.raw':
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 600x700, 30 tbr,
    30 tbn, 30 tbc
    [buffer @ 01D3FEC0] w:600 h:700 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
    [libx264 @ 0375DB80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE 4.2 AVX
    [libx264 @ 0375DB80] profile High, level 3.1
    [libx264 @ 0375DB80] 264 - core 120 r2146 bcd41db - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - 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=12 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=25 scenecut=40 intra_refresh=0rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'test.mp4':
     Metadata:
       encoder         : Lavf54.1.100
       Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 600x700, q=-1--1, 30 tbn, 30 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (rawvideo -> libx264)
    Press [q] to stop, [?] for help
    Truncating packet of size 630000 to 1
    frame=   48 fps=  0 q=-1.0 Lsize=     157kB time=00:00:01.53 bitrate= 837.3kbits/s
    video:156kB audio:0kB global headers:0kB muxing overhead 0.687626%
    [libx264 @ 0375DB80] frame I:3     Avg QP:23.15  size: 23480
    [libx264 @ 0375DB80] frame P:38    Avg QP:28.80  size:  2169
    [libx264 @ 0375DB80] frame B:7     Avg QP:29.61  size:   833
    [libx264 @ 0375DB80] consecutive B-frames: 79.2%  4.2%  0.0% 16.7%
    [libx264 @ 0375DB80] mb I  I16..4: 41.4%  6.2% 52.4%
    [libx264 @ 0375DB80] mb P  I16..4: 10.6%  3.3%  0.9%  P16..4: 68.4%  1.3%  1.2% 0.0%  0.0%    skip:14.2%
    [libx264 @ 0375DB80] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 13.3%  2.2%  0.7% direct: 1.9%  skip:81.9%  L0:51.6% L1:47.4% BI: 1.0%
    [libx264 @ 0375DB80] 8x8 transform intra:16.7% inter:31.2%
    [libx264 @ 0375DB80] coded y,uvDC,uvAC intra: 14.7% 25.5% 22.3% inter: 1.0% 4.1% 3.4%
    [libx264 @ 0375DB80] i16 v,h,dc,p: 87% 11%  2%  0%
    [libx264 @ 0375DB80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  3% 18% 75%  1%  0%  1%  1% 0%  0%
    [libx264 @ 0375DB80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  6% 74% 12%  1%  1%  1%  2% 1%  2%
    [libx264 @ 0375DB80] i8c dc,h,v,p: 51% 45%  4%  1%
    [libx264 @ 0375DB80] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0375DB80] ref P L0:  4.6%  0.4% 94.6%  0.3%
    [libx264 @ 0375DB80] ref B L0: 96.0%  4.0%
    [libx264 @ 0375DB80] ref B L1: 96.5%  3.5%
    [libx264 @ 0375DB80] kb/s:793.39

    I'm not really a codec expert (just starting ;)), so I don't know what to make of most of that.

    Here is a zip that contains one of the frames and the video output. What should be visible is a green smiling pear, without any artifacts. Remember the size is 600x700 and the format yuv420. Best to view such raw image files with irfanview, IMO. Don't mind the noise, its from pushing against my microphone ;)

  • Encode videos to send with WhatsApp

    28 avril 2017, par piegames

    I have a series of PNG images of a video I rendered and now I want so send it via WhatsApp. I used to encode my videos with the command from this answer, but apparently the videos can only be played from WhatsApp web ; on the phone I still get an error message. How do I convert them so that they can also be played on phone ?

    Command used :

    %PATH_TO_FFMPEG%\ffmpeg.exe -i paint\out%04d.png -c:v libx264 -c:a aac ./videos/out7.mp4

    Log :

    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 6.3.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, image2, from 'paint2\out%04d.png':
     Duration: 00:00:45.00, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: png, rgba(pc), 384x240 [SAR 2835:2835 DAR 8:5], 25 fps, 25 tbr, 25 tbn, 25 tbc
    No pixel format specified, yuv444p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 000000000061a660] using SAR=1/1
    [libx264 @ 000000000061a660] using cpu capabilities: MMX2 SSE2Fast LZCNT
    [libx264 @ 000000000061a660] profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit
    [libx264 @ 000000000061a660] 264 - core 148 r2762 90a61ec - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=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 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
    Output #0, mp4, to './videos/out6.mp4':
     Metadata:
       encoder         : Lavf57.56.101
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 384x240 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc
       Metadata:
         encoder         : Lavc57.64.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
     Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   79 fps=0.0 q=28.0 size=      19kB time=00:00:01.04 bitrate= 152.5kbits/frame=  171 fps=168 q=28.0 size=      21kB time=00:00:04.72 bitrate=  36.4kbits/frame=  255 fps=168 q=28.0 size=      24kB time=00:00:08.08 bitrate=  24.1kbits/frame=  309 fps=153 q=28.0 size=      48kB time=00:00:10.24 bitrate=  38.6kbits/frame=  383 fps=151 q=28.0 size=      51kB time=00:00:13.20 bitrate=  31.7kbits/frame=  452 fps=148 q=28.0 size=      54kB time=00:00:15.96 bitrate=  27.7kbits/frame=  534 fps=151 q=28.0 size=      59kB time=00:00:19.24 bitrate=  25.1kbits/frame=  622 fps=154 q=28.0 size=      85kB time=00:00:22.76 bitrate=  30.7kbits/frame=  706 fps=155 q=28.0 size=      90kB time=00:00:26.12 bitrate=  28.1kbits/frame=  795 fps=157 q=28.0 size=      94kB time=00:00:29.68 bitrate=  25.9kbits/frame=  893 fps=161 q=28.0 size=     121kB time=00:00:33.60 bitrate=  29.5kbits/frame=  985 fps=162 q=28.0 size=     126kB time=00:00:37.28 bitrate=  27.6kbits/frame= 1084 fps=165 q=28.0 size=     153kB time=00:00:41.24 bitrate=  30.3kbits/frame= 1125 fps=163 q=-1.0 Lsize=     168kB time=00:00:44.88 bitrate=  30.6kbits/s speed=6.52x
    video:154kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.859178%
    [libx264 @ 000000000061a660] frame I:5     Avg QP:14.73  size: 22873
    [libx264 @ 000000000061a660] frame P:384   Avg QP:14.24  size:    65
    [libx264 @ 000000000061a660] frame B:736   Avg QP:16.11  size:    24
    [libx264 @ 000000000061a660] consecutive B-frames:  7.3% 13.7%  8.3% 70.8%
    [libx264 @ 000000000061a660] mb I  I16..4: 35.6% 47.1% 17.3%
    [libx264 @ 000000000061a660] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  1.2%  0.1%  0.0%  0.0%  0.0%    skip:98.6%
    [libx264 @ 000000000061a660] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.4%  0.0%  0.0%  direct: 0.0%  skip:99.6%  L0:53.1% L1:46.0% BI: 0.9%
    [libx264 @ 000000000061a660] 8x8 transform intra:47.2% inter:15.9%
    [libx264 @ 000000000061a660] coded y,u,v intra: 80.7% 29.5% 0.9% inter: 0.1% 0.0% 0.0%
    [libx264 @ 000000000061a660] i16 v,h,dc,p: 24% 15% 55%  6%
    [libx264 @ 000000000061a660] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5%  7% 62% 14%  6%  1%  2%  1%  2%
    [libx264 @ 000000000061a660] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10%  9% 29% 11%  8%  5% 14%  5%  9%
    [libx264 @ 000000000061a660] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 000000000061a660] ref P L0: 27.3%  0.7% 36.5% 35.6%
    [libx264 @ 000000000061a660] ref B L0: 59.9% 29.7% 10.4%
    [libx264 @ 000000000061a660] ref B L1: 96.7%  3.3%
    [libx264 @ 000000000061a660] kb/s:27.91

    Error on my Phone : "Dieses Video kann leider nicht wiedergegeben werden"

  • Problem recording camera stream through ffmpeg - Inappropriate ioctl for device

    16 septembre 2021, par Otter_warrior

    I'm trying to record a camera stream through ffmpeg, but I'm struggling to understand how to write a correct recording command.

    


    This is the camera format according to v4l2

    


    $ v4l2-ctl -d 1 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'RG12'
    Name        : 12-bit Bayer RGRG/GBGB
        Size: Discrete 1920x1080
            Interval: Discrete 0.033s (30.000 fps)


    


    And this is what I tried so far

    


    ffmpeg -framerate 30 -video_size 1920x1080 -i /dev/video0 output.mkv


    


    which would return this and an empty output file

    


    $ ffmpeg -f v4l2 -framerate 30 -video_size 1920x1080 -i /dev/video0 output.mkv
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[video4linux2,v4l2 @ 0x557fbba630] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0x557fbba630] Time per frame unknown
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Finishing stream 0:0 without any data written to it.
[libx264 @ 0x557fbbd6d0] MB rate (8160000000) > level limit (16711680)
[libx264 @ 0x557fbbd6d0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x557fbbd6d0] profile High 4:2:2, level 6.2, 4:2:2 8-bit
[libx264 @ 0x557fbbd6d0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=12 lookahead_threads=2 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=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
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 1000k fps, 1k tbn, 1000k tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.


    


    I'm new to ffmpeg so I can't determine which settings or properties could help me with this format, or if this format is even supported at all. Any help would be greatly appreciated.

    


    Note : I am working on a Jetson board, but gstreamer or nvgstcapture are not an option