Recherche avancée

Médias (91)

Autres articles (27)

  • 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 (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (3565)

  • ffmpeg video won't play in certain players

    25 janvier 2021, par Thomas Tiotto

    I'm generating a video in /folder/ from a stack of images in /folder/tmp/ using the following command :

    


     ffmpeg -pattern_type glob -i 'folder/tmp/*.png' -c:v libx264 -preset veryslow -crf 17 -tune stillimage -y -pix_fmt yuv420p folder/weight_evolution.mp4


    


    but my video won't play in, for example, QuickTime ("The file isn’t compatible with QuickTime Player.") and even sending it in Telegram gives really strange results. The video plays fine in IINA and VLC.

    


    As you can see, this is what is encoded by Telegram :

    


    Telegram encoding

    


    and this is what the video should look like :

    


    Original video

    


    The output of the command is :

    


    ffmpeg -pattern_type glob -i 'tmp/*.png' -c:v libx264 -preset veryslow -crf 17 -tune stillimage -y -pix_fmt yuv420p weight_evolution.mp4
    ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
      built with Apple clang version 12.0.0 (clang-1200.0.32.28)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_7 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --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-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
      libavutil      56. 51.100 / 56. 51.100
      libavcodec     58. 91.100 / 58. 91.100
      libavformat    58. 45.100 / 58. 45.100
      libavdevice    58. 10.100 / 58. 10.100
      libavfilter     7. 85.100 /  7. 85.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  7.100 /  5.  7.100
      libswresample   3.  7.100 /  3.  7.100
      libpostproc    55.  7.100 / 55.  7.100
    Input #0, image2, from 'tmp/*.png':
      Duration: 00:00:10.28, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: png, rgba(pc), 1280x720 [SAR 3937:3937 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x7f804c009400] using SAR=1/1
    [libx264 @ 0x7f804c009400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7f804c009400] profile High, level 5.0, 4:2:0, 8-bit
    [libx264 @ 0x7f804c009400] 264 - core 161 r3027 4121277 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:-3:-3 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=2.00:0.70 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.20
    Output #0, mp4, to 'weight_evolution.mp4':
      Metadata:
        encoder         : Lavf58.45.100
        Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
        Metadata:
          encoder         : Lavc58.91.100 libx264
        Side data:
          cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    frame=   72 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=  126 fps=110 q=22.0 size=       0kB time=00:00:01.68 bitrate=   0.2kbits/frame=  185 fps=112 q=22.0 size=       0kB time=00:00:04.04 bitrate=   0.1kbits/frame=  245 fps=113 q=22.0 size=       0kB time=00:00:06.44 bitrate=   0.1kbits/frame=  257 fps= 97 q=-1.0 Lsize=     209kB time=00:00:10.16 bitrate= 168.7kbits/s speed=3.83x
    video:206kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.448294%
    [libx264 @ 0x7f804c009400] frame I:2     Avg QP: 4.16  size: 92234
    [libx264 @ 0x7f804c009400] frame P:36    Avg QP:24.07  size:   156
    [libx264 @ 0x7f804c009400] frame B:219   Avg QP:26.50  size:    93
    [libx264 @ 0x7f804c009400] consecutive B-frames:  0.8%  0.0%  0.0%  1.6%  9.7% 23.3% 10.9% 18.7% 35.0%
    [libx264 @ 0x7f804c009400] mb I  I16..4: 87.5%  4.4%  8.2%
    [libx264 @ 0x7f804c009400] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.8%  0.0%  0.0%  0.0%  0.0%    skip:99.1%
    [libx264 @ 0x7f804c009400] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.0%  0.0%  direct: 0.0%  skip:99.7%  L0:71.2% L1:28.4% BI: 0.4%
    [libx264 @ 0x7f804c009400] 8x8 transform intra:4.7% inter:22.5%
    [libx264 @ 0x7f804c009400] direct mvs  spatial:96.8% temporal:3.2%
    [libx264 @ 0x7f804c009400] coded y,uvDC,uvAC intra: 14.7% 14.6% 14.6% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x7f804c009400] i16 v,h,dc,p: 89%  2%  9%  0%
    [libx264 @ 0x7f804c009400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 40% 31%  1%  1%  1%  1%  1%  2%
    [libx264 @ 0x7f804c009400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 27% 22%  2%  2%  2%  1%  2%  2%
    [libx264 @ 0x7f804c009400] i8c dc,h,v,p: 91%  4%  3%  2%
    [libx264 @ 0x7f804c009400] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x7f804c009400] ref P L0: 89.1%  0.5%  4.8%  1.1%  1.5%  0.7%  0.2%  0.9%  0.2%  0.1%  0.1%  0.3%  0.1%  0.2%  0.1%  0.1%
    [libx264 @ 0x7f804c009400] ref B L0: 37.4% 17.9% 11.7%  7.0%  5.5%  5.5%  4.4%  2.0%  1.5%  1.6%  1.2%  1.9%  1.5%  0.7%  0.1%
    [libx264 @ 0x7f804c009400] ref B L1: 92.0%  8.0%
    [libx264 @ 0x7f804c009400] kb/s:163.83


    


  • Combining three or more videos with ffmpeg and the xfade filter

    25 février 2021, par sil

    As of 2020 ffmpeg has the xfade filter which can combine videos with a transition. Combining two videos is easy enough :

    


    ffmpeg -i vid1.mp4 -i vid2.mp4 \
  -filter_complex [0][1]xfade=transition=pixelize:duration=1:offset=4,format=yuv420p" \
  out.mp4


    


    But I don't understand how to combine three videos (so that v1 fades into v2 and v2 then fades into v3. I tried something like this :

    


    ffmpeg -i vid1.mp4 -i vid2.mp4 -i vid3.mp4 \
  -filter_complex [0][1]xfade=transition=pixelize:duration=1:offset=4,format=yuv420p[0n1];[0n1][2]xfade=transition=pixelize:duration=1:offset=9,format=yuv420p" \
  out.mp4


    


    but that doesn't work. My idea was that 0 and 1, or vid1 and vid2, would be combined into a [0n1] stream with a transition by xfade, and then that 0n1 stream could be combined with vid3 with another filter. As far as I can tell, this includes the first two videos but not the third. What this of course means is that I don't understand how to specify a filtergraph correctly !

    


    How should I use xfade to combine 3 or more videos with transitions between them ?

    


    A full example is as follows. Here I'll use three images (because then issues with combining videos at different frame rates are avoided), and smash them all to 500x500 for ease (in the final version they would be letterboxed to keep resolution and so on).

    


    ffmpeg \
  -loop 1 -t 5 -i tests/p1.jpg \
  -loop 1 -t 5 -i tests/p2.jpg \
  -loop 1 -t 5 -i tests/p3.jpg \
  -filter_complex "[0]scale=500:500[s0];[1]scale=500:500[s1];[2]scale=500:500[s2];[s0][s1]xfade=transition=pixelize:duration=1:offset=4,format=yuv420p[s01];[s01][s2]xfade=transition=pixelize:duration=1:offset=9,format=yuv420p" out.mp4


    


    I would expect this to create a video which was :

    


      

    • 4 seconds of p1.jpg
    • 


    • a pixelise transition into p2.jpg lasting 1 second
    • 


    • 4 seconds of p2.jpg
    • 


    • a pixelise transition into p3.jpg lasting 1 second
    • 


    • 4 seconds of p3.jpg
    • 


    


    but what I actually get is

    


      

    • 4 seconds of p1.jpg
    • 


    • a pixelise transition into p2.jpg lasting 1 second
    • 


    • 4 seconds of p2.jpg
    • 


    


    and then the video ends. p3 is not included at all.

    


    The output is as follows :

    


    ffmpeg version N-53546-g5eb4405fc5-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 56.100 / 56. 56.100
  libavcodec     58. 97.100 / 58. 97.100
  libavformat    58. 49.100 / 58. 49.100
  libavdevice    58. 11.101 / 58. 11.101
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, image2, from 'tests/p1.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 44845 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 820x1270 [SAR 150:150 DAR 82:127], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from 'tests/p2.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 22325 kb/s
    Stream #1:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 960x600 [SAR 1:1 DAR 8:5], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from 'tests/p3.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 15266 kb/s
    Stream #2:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 728x669 [SAR 96:96 DAR 728:669], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'out.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 (mjpeg) -> scale
  Stream #1:0 (mjpeg) -> scale
  Stream #2:0 (mjpeg) -> scale
  format -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 0x8228040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x8258640] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x827df40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x829f800] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x82c13c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x82e8340] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x77b7600] using SAR=82/127
[libx264 @ 0x77b7600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x77b7600] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x77b7600] 264 - core 161 r3018 db0d417 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - 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=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 'out.mp4':
  Metadata:
    encoder         : Lavf58.49.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 500x500 [SAR 82:127 DAR 82:127], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.97.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=  101 fps=100 q=28.0 size=       0kB time=00:00:01.92 bitrate=   0.2kbits/s speed=[swscaler @ 0x8291d80] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
[swscaler @ 0x82b3000] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
[swscaler @ 0x82fc200] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
frame=  153 fps=101 q=28.0 size=       0kB time=00:00:04.00 bitrate=   0.1kbits/s speed=[swscaler @ 0x82fc200] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
frame=  225 fps=111 q=28.0 size=     256kB time=00:00:06.88 bitrate= 304.9kbits/s dup=0 frame=  225 fps= 95 q=-1.0 Lsize=     267kB time=00:00:08.88 bitrate= 245.9kbits/s dup=0 drop=125 speed=3.74x    
video:263kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.293847%
[libx264 @ 0x77b7600] frame I:2     Avg QP:21.03  size: 19928
[libx264 @ 0x77b7600] frame P:66    Avg QP:21.18  size:  2453
[libx264 @ 0x77b7600] frame B:157   Avg QP:29.72  size:   427
[libx264 @ 0x77b7600] consecutive B-frames:  5.3%  4.4%  1.3% 88.9%
[libx264 @ 0x77b7600] mb I  I16..4: 29.0% 27.8% 43.2%
[libx264 @ 0x77b7600] mb P  I16..4: 10.8%  3.2%  7.5%  P16..4:  2.6%  0.9%  0.3%  0.0%  0.0%    skip:74.8%
[libx264 @ 0x77b7600] mb B  I16..4:  1.1%  0.5%  1.6%  B16..8:  1.0%  0.5%  0.1%  direct: 0.3%  skip:94.9%  L0:37.4% L1:43.5% BI:19.1%
[libx264 @ 0x77b7600] 8x8 transform intra:16.5% inter:55.3%
[libx264 @ 0x77b7600] coded y,uvDC,uvAC intra: 31.4% 71.7% 31.8% inter: 1.1% 1.4% 0.1%
[libx264 @ 0x77b7600] i16 v,h,dc,p: 45% 46%  9%  1%
[libx264 @ 0x77b7600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 30% 27%  6%  1%  1%  2%  1%  7%
[libx264 @ 0x77b7600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 56% 31%  9%  1%  1%  1%  1%  1%  1%
[libx264 @ 0x77b7600] i8c dc,h,v,p: 46% 27% 23%  4%
[libx264 @ 0x77b7600] Weighted P-Frames: Y:10.6% UV:7.6%
[libx264 @ 0x77b7600] ref P L0: 61.9% 17.1% 13.9%  6.8%  0.3%
[libx264 @ 0x77b7600] ref B L0: 76.3% 22.8%  0.9%
[libx264 @ 0x77b7600] ref B L1: 97.6%  2.4%
[libx264 @ 0x77b7600] kb/s:238.88


    


  • How to fix grainy recoding with ffmpeg mp4 x264 ?

    21 mars 2020, par teenserie

    I recorded the audio and video stream from a streaming with ffmpeg. when I go to re-encode the file using libx264, the video in the movements looks bad and grainy as in the image.
    Where did I go wrong ?

    Sample

    this is the code I used

    ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4

    and these are mediainfo of original file

       Metadata:
       major_brand     : isom
       minor_version   : 1
       compatible_brands: isom
       creation_time   : 2020-03-19T22:43:32.000000Z
     Duration: 00:39:51.99, start: 0.000000, bitrate: 1300 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x1080 [SAR 3:2 DAR 16:9], Closed Captions, 1268 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(spa): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 22 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    mediainfo of the file recoded

    Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.29.100
     Duration: 00:39:51.99, start: 0.000000, bitrate: 7924 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 7892 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(spa): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 22 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    How can I recode the file without loss of quality ? (sorry for my poor english)