Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (81)

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (4661)

  • ffmpeg piped output producing incorrect metadata frame count with Python

    6 décembre 2024, par Xorgon

    Using Python, I am attempting to use ffmpeg to compress videos and put them in a PowerPoint. This works great, however, the video files themselves have incorrect frame counts which can cause issues when I read from those videos in other code.

    


    Edit for clarification : by "frame count" I mean the metadata frame count. The actual number of frames contained in the video is correct, but querying the metadata gives an incorrect frame count.

    


    Having eliminated the PowerPoint aspect of the code, I've narrowed this down to the following minimal reproducing example of saving an output from an ffmpeg pipe :

    


    from subprocess import Popen, PIPE

video_path = 'test_mp4.mp4'

ffmpeg_pipe = Popen(['ffmpeg',
                     '-y',  # Overwrite files
                     '-i', f'{video_path}',  # Input from file
                     '-f', 'avi',  # Output format
                     '-c:v', 'libx264',  # Codec
                     '-'],  # Output to pipe
                    stdout=PIPE)

new_path = "piped_video.avi"
vid_file = open(new_path, "wb")
vid_file.write(ffmpeg_pipe.stdout.read())
vid_file.close()


    


    I've tested several different videos. One small example video that I've tested can be found here.

    


    I've tried a few different codecs with avi format and tried libvpx with webm format. For the avi outputs, the frame count usually reads as 1073741824 (2^30). Weirdly, for the webm format, the frame count read as -276701161105643264.

    


    This is a snippet I used to read the frame count, but one could also see the error by opening the video details in Windows Explorer and seeing the total time as something like 9942 hours, 3 minutes, and 14 seconds.

    


    import cv2

video_path = 'test_mp4.mp4'
new_path = "piped_video.webm"

cap = cv2.VideoCapture(video_path)
print(f"Original video frame count: = {int(cap.get(cv2.CAP_PROP_FRAME_COUNT)):d}")
cap.release()

cap = cv2.VideoCapture(new_path)
print(f"Piped video frame count: = {int(cap.get(cv2.CAP_PROP_FRAME_COUNT)):d}")
cap.release()


    


    For completeness, here is the ffmpeg output :

    


    ffmpeg version 2023-06-11-git-09621fd7d9-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 13.100 / 58. 13.100
  libavcodec     60. 17.100 / 60. 17.100
  libavformat    60.  6.100 / 60.  6.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.101 /  9.  8.101
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_mp4.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2022-08-10T12:54:09.000000Z
  Duration: 00:00:06.67, start: 0.000000, bitrate: 567 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 384x264 [SAR 1:1 DAR 16:11], 563 kb/s, 30 fps, 30 tbr, 30k tbn (default)
    Metadata:
      creation_time   : 2022-08-10T12:54:09.000000Z
      handler_name    : Mainconcept MP4 Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000018c68c8b9c0] using SAR=1/1
[libx264 @ 0000018c68c8b9c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000018c68c8b9c0] profile High, level 2.1, 4:2:0, 8-bit
Output #0, avi, to 'pipe:':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    ISFT            : Lavf60.6.100
  Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p(progressive), 384x264 [SAR 1:1 DAR 16:11], q=2-31, 30 fps, 30 tbn (default)
    Metadata:
      creation_time   : 2022-08-10T12:54:09.000000Z
      handler_name    : Mainconcept MP4 Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.17.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[out#0/avi @ 0000018c687f47c0] video:82kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.631060%
frame=  200 fps=0.0 q=-1.0 Lsize=      85kB time=00:00:06.56 bitrate= 106.5kbits/s speed=76.2x    
[libx264 @ 0000018c68c8b9c0] frame I:1     Avg QP:16.12  size:  3659
[libx264 @ 0000018c68c8b9c0] frame P:80    Avg QP:21.31  size:   647
[libx264 @ 0000018c68c8b9c0] frame B:119   Avg QP:26.74  size:   243
[libx264 @ 0000018c68c8b9c0] consecutive B-frames:  3.0% 53.0%  0.0% 44.0%
[libx264 @ 0000018c68c8b9c0] mb I  I16..4: 17.6% 70.6% 11.8%
[libx264 @ 0000018c68c8b9c0] mb P  I16..4:  0.8%  1.7%  0.6%  P16..4: 17.6%  4.6%  3.3%  0.0%  0.0%    skip:71.4%
[libx264 @ 0000018c68c8b9c0] mb B  I16..4:  0.1%  0.3%  0.2%  B16..8: 11.7%  1.4%  0.4%  direct: 0.6%  skip:85.4%  L0:32.0% L1:59.7% BI: 8.3%
[libx264 @ 0000018c68c8b9c0] 8x8 transform intra:59.6% inter:62.4%
[libx264 @ 0000018c68c8b9c0] coded y,uvDC,uvAC intra: 48.5% 0.0% 0.0% inter: 3.5% 0.0% 0.0%
[libx264 @ 0000018c68c8b9c0] i16 v,h,dc,p: 19% 39% 25% 17%
[libx264 @ 0000018c68c8b9c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 25% 30%  3%  3%  4%  4%  4%  5%
[libx264 @ 0000018c68c8b9c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 20% 16%  6%  8%  8%  8%  5%  6%
[libx264 @ 0000018c68c8b9c0] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0000018c68c8b9c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000018c68c8b9c0] ref P L0: 76.2%  7.9% 11.2%  4.7%
[libx264 @ 0000018c68c8b9c0] ref B L0: 85.6% 12.9%  1.5%
[libx264 @ 0000018c68c8b9c0] ref B L1: 97.7%  2.3%
[libx264 @ 0000018c68c8b9c0] kb/s:101.19


    


    So the question is : why does this happen, and how can one avoid it ?

    


  • concat two videos with same format

    24 mars 2023, par ttb

    I'm trying to concat two videos that have very similar formats :

    


    Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv), 1920x1080 [SAR 1:1 DAR 16:9], 1141 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 224 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]


    


    and

    


      Stream #0:0(und): Video: hevc (hev1 / 0x31766568), yuv420p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 24k tbn (default)
    Metadata:
      creation_time   : 2023-03-24T21:10:17.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.6.101 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 341 kb/s (default)
    Metadata:
      creation_time   : 2023-03-24T21:10:17.000000Z
      handler_name    : Surround
      vendor_id       : [0][0][0][0]


    


    But the video ends up freezing when played. Not sure what's wrong, I matched everything ?

    


  • ffmpeg :how to apply animation in multiple images

    2 mars 2023, par Pavan Ghanate

    I am trying to merge number of selected images from gallery to a video template in order to make video status or short video in a android app, I am able to merge the selected images in the video using below cammand now i want to add animation

    


     ArrayList<string> cmd2 = new ArrayList&lt;>();&#xA;    cmd2.add("-y");&#xA;    cmd2.add("-i");&#xA;    if (video_temp_path!= null){&#xA;        cmd2.add(video_temp_path);&#xA;    }else {&#xA;        cmd2.add(Environment.getExternalStorageDirectory().getPath()&#xA;                &#x2B; "/Download/happy.mp4");&#xA;    }&#xA;&#xA;&#xA;    for (int no = 0; no &lt; paths.length; no&#x2B;&#x2B;) {&#xA;        cmd2.add("-i");&#xA;&#xA;        cmd2.add(paths[no]);&#xA;&#xA;    }&#xA;&#xA;    cmd2.add("-filter_complex");&#xA;&#xA;&#xA;&#xA;    cmd2.add("[0][1]overlay=x=100:y=200:enable=&#x27;between(t,3,8)&#x27;[v1];" &#x2B;&#xA;            "[v1][2]overlay=x=100:y=200:enable=&#x27;between(t,10,15)&#x27;[v2];" &#x2B;&#xA;            "[v2][3]overlay=x=100:y=200:enable=&#x27;gt(t,17)&#x27;[v3]");&#xA;    cmd2.add("-map");&#xA;    cmd2.add("[v3]");&#xA;    cmd2.add("-map");&#xA;    cmd2.add( "0:a");&#xA;    cmd2.add(Environment.getExternalStorageDirectory().getPath()&#xA;            &#x2B; "/Download/output.mp4");&#xA;</string>

    &#xA;

    but now i want to add fade in out animation to images so I am using this cammand generated by chatgpt but its giving me error

    &#xA;

      ArrayList<string> cmd2 = new ArrayList&lt;>();&#xA;   cmd2.add("-y");&#xA;   cmd2.add("-i");&#xA;&#xA;   if (video_temp_path != null) {&#xA;    cmd2.add(video_temp_path);&#xA;  } else {&#xA;    cmd2.add(Environment.getExternalStorageDirectory().getPath() &#x2B;&#xA;            "/Download/happy.mp4");&#xA;}&#xA;&#xA;for (int no = 0; no &lt; paths.length; no&#x2B;&#x2B;) {&#xA;    cmd2.add("-loop");&#xA;    cmd2.add("1"); // loop the image&#xA;&#xA;    cmd2.add("-t");&#xA;    cmd2.add("5"); // duration of the image&#xA;&#xA;    cmd2.add("-i");&#xA;    cmd2.add(paths[no]);&#xA;&#xA;    cmd2.add("-filter_complex");&#xA;    cmd2.add("[1:v]fade=in:st=0:d=1[tin];" &#x2B;&#xA;            "[1:v]fade=out:st=4:d=1[tout];" &#x2B;&#xA;            "[0:v][tin]overlay=x=100:y=200" &#x2B;&#xA;            "[v1];" &#x2B;&#xA;            "[v1][tout]overlay=x=100:y=200:enable=&#x27;between(t,10,15)&#x27;[v2];" &#x2B;&#xA;            "[v2][2:v]overlay=x=100:y=200:enable=&#x27;gt(t,17)&#x27;[v3]");&#xA;&#xA;    cmd2.add("-map");&#xA;    cmd2.add("[v3]");&#xA;    cmd2.add("-map");&#xA;    cmd2.add("0:a");&#xA;}&#xA;&#xA;cmd2.add(Environment.getExternalStorageDirectory().getPath() &#x2B;&#xA;        "/Download/output.mp4");&#xA;</string>

    &#xA;

    error is

    &#xA;

     Option map (set input stream mapping) cannot be applied to input url /storage/emulated/0/Pictures/temp/1677570327312.jpg -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.&#xA;

    &#xA;

    2023-03-01 12:50:50.707 5950-6326/com.android.mergevideo E/mobile-ffmpeg : Error parsing options for input file /storage/emulated/0/Pictures/temp/1677570327312.jpg.&#xA;2023-03-01 12:50:50.707 5950-6326/com.android.mergevideo E/mobile-ffmpeg : Error opening input files :&#xA;2023-03-01 12:50:50.707 5950-6326/com.android.mergevideo E/mobile-ffmpeg : Invalid argument

    &#xA;