Recherche avancée

Médias (91)

Autres articles (112)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • 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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

Sur d’autres sites (2894)

  • Cropping a video from Sony A7 Camera using ffmpeg

    23 octobre 2023, par Mike Slinn

    I want to crop a video file created by a Sony A7iii camera, so only the portion from 0:51 through 2:45 is extracted.
The camera adds streams that need to be ignored.

    


    ffprobe shows the error on input stream 2, however the problem I am reporting deals with input stream 3, which is a data stream, and is not required. I want to exclude input stream 3, then deal with input stream 2.

    


    $ ffprobe myfile.mp4
ffprobe version 3.0-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-8) 20160205
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2023-01-05 00:52:24
  Duration: 00:10:58.16, start: 0.000000, bitrate: 51445 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4), 1920x1080 [SAR 1:1 DAR 16:9], 49370 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2023-01-05 00:52:24
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2023-01-05 00:52:24
      handler_name    : Sound Media Handler
    Stream #0:2(und): Data: none (rtmd / 0x646D7472), 491 kb/s (default)
    Metadata:
      creation_time   : 2023-01-05 00:52:24
      handler_name    : Timed Metadata Media Handler
Unsupported codec with id 0 for input stream 2


    


    Predictably, ffmpeg fails because ffprobe failed.

    


    $ ffmpeg -y -i 'myfile.mp4' -ss 51 -to 2:45 -acodec copy 'myfile.crop.mp4'
ffmpeg version 5.1.2-3ubuntu1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
  configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55d61a97fc80] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55d61a97fc80] st: 0 edit list 1 Cannot find an index entry before timestamp: 1001.
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
  Metadata:
    major_brand     : XAVC
    minor_version   : 16785407
    compatible_brands: XAVCmp42iso2
    creation_time   : 2023-01-05T00:52:24.000000Z
  Duration: 00:10:58.16, start: 0.000000, bitrate: 51445 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/iec61966-2-4, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 49370 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
    Metadata:
      creation_time   : 2023-01-05T00:52:24.000000Z
      handler_name    : Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1[0x2](und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2023-01-05T00:52:24.000000Z
      handler_name    : Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: none (rtmd / 0x646D7472), 491 kb/s (default)
    Metadata:
      creation_time   : 2023-01-05T00:52:24.000000Z
      handler_name    : Timed Metadata Media Handler
      timecode        : 03:52:30:26
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55d61aa58a80] using SAR=1/1
[libx264 @ 0x55d61aa58a80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d61aa58a80] profile High, level 4.2, 4:2:0, 8-bit
[libx264 @ 0x55d61aa58a80] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - 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=34 lookahead_threads=5 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
[mp4 @ 0x55d61aa57cc0] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --
Conversion failed!


    


    I tried various incantations that specified permutations of -map options, but only dug myself a deeper hole.

    


    How might I perform the extraction ? I am not interested in preserving extra streams, I just want the main video and stereo audio streams.

    


  • memcpy to av_malloc's memory crash

    26 octobre 2023, par PeacefulWindy

    I use the code in x64 windows :

    


    #include<iostream>&#xA;#include<memory>&#xA;#include<vector>&#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include<libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;#include<libswscale></libswscale>swscale.h>&#xA;#include<libswresample></libswresample>swresample.h>&#xA;}&#xA;&#xA;struct BufferData&#xA;{&#xA;    uint8_t* ptr;&#xA;    size_t size;&#xA;    size_t file_size;&#xA;};&#xA;&#xA;int main()&#xA;{&#xA;    auto file=fopen("E:/test.jpg", "rb");&#xA;    fseek(file, 0, SEEK_END);&#xA;    auto fileSize = ftell(file);&#xA;    fseek(file, 0, SEEK_SET);&#xA;    auto data = std::vector(fileSize);&#xA;    fread(data.data(), sizeof(uint8_t), fileSize, file);&#xA;    fclose(file);&#xA;&#xA;    auto test = BufferData();&#xA;    test.ptr = data.data();&#xA;    test.size = data.size();&#xA;    test.file_size = data.size();&#xA;    auto buffer = (uint8_t*)av_malloc(4096 * 10);&#xA;    char errStr[128] = { 0 };&#xA;&#xA;    auto avformatContext = avformat_alloc_context();&#xA;    auto avioContext = avio_alloc_context(buffer, 4096, 0, &amp;test, [](void* opaque, uint8_t* buf, int buf_size)&#xA;        {&#xA;            BufferData* bd = (BufferData*)opaque;&#xA;            auto size = std::min(bd->size, (size_t)buf_size);&#xA;&#xA;            if (!size)&#xA;            {&#xA;                return -1;&#xA;            }&#xA;&#xA;            memcpy(buf, bd->ptr, size);&#xA;            bd->ptr &#x2B;= size;&#xA;            bd->size -= size;&#xA;            return (int)size;&#xA;        }, NULL, NULL);&#xA;    avformatContext->pb = avioContext;&#xA;    avformatContext->flags = AVFMT_FLAG_CUSTOM_IO;&#xA;&#xA;    auto ret = avformat_open_input(&amp;avformatContext, nullptr, nullptr, nullptr);&#xA;    if (ret != 0)&#xA;    {&#xA;        av_strerror(ret, errStr, sizeof(errStr));&#xA;        std::cout &lt;&lt; errStr &lt;&lt; std::endl;&#xA;        av_free(buffer);&#xA;        avformat_close_input(&amp;avformatContext);&#xA;        return 0;&#xA;    }&#xA;&#xA;    ret = avformat_find_stream_info(avformatContext, nullptr);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        av_strerror(ret, errStr, sizeof(errStr));&#xA;        std::cout &lt;&lt; errStr &lt;&lt; std::endl;&#xA;        av_free(buffer);&#xA;        avformat_close_input(&amp;avformatContext);&#xA;        return 0;&#xA;    }&#xA;&#xA;    av_dump_format(avformatContext, 0, nullptr, 0);&#xA;&#xA;    auto videoIndex = av_find_best_stream(avformatContext, AVMEDIA_TYPE_VIDEO, -1, -1, nullptr, 0);&#xA;    if (videoIndex == AVERROR_STREAM_NOT_FOUND)&#xA;    {&#xA;        av_free(buffer);&#xA;        avformat_close_input(&amp;avformatContext);&#xA;        return 0;&#xA;    }&#xA;    else if (videoIndex == AVERROR_DECODER_NOT_FOUND)&#xA;    {&#xA;        av_free(buffer);&#xA;        avformat_close_input(&amp;avformatContext);&#xA;        return 0;&#xA;    }&#xA;&#xA;    auto videoCodecPar = avformatContext->streams[videoIndex]->codecpar;&#xA;    auto videoCodec = avcodec_find_decoder(videoCodecPar->codec_id);&#xA;    if (!videoCodec)&#xA;    {&#xA;        av_free(buffer);&#xA;        avformat_close_input(&amp;avformatContext);&#xA;        return 0;&#xA;    }&#xA;&#xA;    av_free(buffer);&#xA;    avformat_close_input(&amp;avformatContext);&#xA;}&#xA;</vector></memory></iostream>

    &#xA;

    I use memcpy to copy data to buffer,it run to av_free(buffer) get crash.&#xA;ffmpeg version is 6.0.&#xA;Visual Studio version is 2022 with CMake.

    &#xA;

    Use fread replace memcpy,it can work !But I need to resolve load from std::vector memory,not fread.&#xA;I think maybe memory-align problem when run av_free,but I no way to find the cause.

    &#xA;

  • FFmpeg batchfile to compress images JPG JPEGs and keep EXIF (metadata)

    24 novembre 2023, par esdoublelef

    I tried searching everywhere for a possible solution but I really can't find it. Hope someone can help me out here.

    &#xA;

    I have written a batch file to use FFmpeg to compress and sharpen JPGs in a folder.

    &#xA;

    @ECHO ON&#xA;  FOR %%a in (*.jpg) DO (ffmpeg -i "%%a" -q:v 8 -vf unsharp=5:5:1.0:5:5:0.0 "2022 01 22 %%~na".jpg)&#xA;PAUSE&#xA;

    &#xA;

    The new file comes out smaller in size, but is missing all the EXIF information that the original photo has.

    &#xA;

    I tried to add in the command -metadata but apparently it works for MP4 only. I have an existing solution with ImageMagick but I'm hoping to solve this via FFmpeg.

    &#xA;

    Or is there a way to integrate exiftool into the batch file ?

    &#xA;

    Thank you and I really appreciate any help here.

    &#xA;