Recherche avancée

Médias (91)

Autres articles (77)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (9442)

  • How to export audio from a iPhone video file with FFmpeg ?

    11 janvier 2020, par DanScripter

    UPDATE 1 the problem resides in the input read-stream. (check below)

    I am using fluent-ffmpeg (version : 2.1.2) to get a .mp3 file out of a video file that I input as a stream .createReadStream(). I output the file as a .pipe to a remoteWriteStream.

    ffmpeg -i pipe:0 -vn -f mp3 -acodec mp3 -movflags frag_keyframe+empty_moov pipe:1

    This works fine with .mp4, .webm and .mov (codec : prores) files.

    But it somehow does not want to work with a .mov out of an iPhone 11. FFmpeg is not giving me any error when running above code. It creates the .mp3 file but the size is just 152 B and it is not playable.

    I ffprobed the iPhone .mov files it returns this :

    "{ streams:
      [ { index: 0,
          codec_name: 'hevc',
          codec_long_name: 'H.265 / HEVC (High Efficiency Video Coding)',
          profile: 'Main',
          codec_type: 'video',
          codec_time_base: '1111/33300',
          codec_tag_string: 'hvc1',
          codec_tag: '0x31637668',
          width: 1920,
          height: 1080,
          coded_width: 1920,
          coded_height: 1088,
          has_b_frames: 2,
          sample_aspect_ratio: '0:1',
          display_aspect_ratio: '0:1',
          pix_fmt: 'yuv420p',
          level: 120,
          color_range: 'tv',
          color_space: 'bt709',
          color_transfer: 'bt709',
          color_primaries: 'bt709',
          chroma_location: 'unspecified',
          field_order: 'unknown',
          timecode: 'N/A',
          refs: 1,
          id: 'N/A',
          r_frame_rate: '30000/1001',
          avg_frame_rate: '33300/1111',
          time_base: '1/600',
          start_pts: 'N/A',
          start_time: 'N/A',
          duration_ts: 6666,
          duration: 11.11,
          bit_rate: 7611708,
          max_bit_rate: 'N/A',
          bits_per_raw_sample: 'N/A',
          nb_frames: 333,
          nb_read_frames: 'N/A',
          nb_read_packets: 'N/A',
          tags: [Object],
          disposition: [Object] },
        { index: 1,
          codec_name: 'aac',
          codec_long_name: 'AAC (Advanced Audio Coding)',
          profile: 'unknown',
          codec_type: 'audio',
          codec_time_base: '1/44100',
          codec_tag_string: 'mp4a',
          codec_tag: '0x6134706d',
          sample_fmt: 'fltp',
          sample_rate: 44100,
          channels: 2,
          channel_layout: 'stereo',
          bits_per_sample: 0,
          id: 'N/A',
          r_frame_rate: '0/0',
          avg_frame_rate: '0/0',
          time_base: '1/44100',
          start_pts: 'N/A',
          start_time: 'N/A',
          duration_ts: 489951,
          duration: 11.11,
          bit_rate: 135091,
          max_bit_rate: 192000,
          bits_per_raw_sample: 'N/A',
          nb_frames: 481,
          nb_read_frames: 'N/A',
          nb_read_packets: 'N/A',
          tags: [Object],
          disposition: [Object] },
        { index: 2,
          codec_name: 'unknown',
          codec_long_name: 'unknown',
          profile: 'unknown',
          codec_type: 'data',
          codec_tag_string: 'mebx',
          codec_tag: '0x7862656d',
          id: 'N/A',
          r_frame_rate: '0/0',
          avg_frame_rate: '0/0',
          time_base: '1/600',
          start_pts: 'N/A',
          start_time: 'N/A',
          duration_ts: 6666,
          duration: 11.11,
          bit_rate: 2670,
          max_bit_rate: 'N/A',
          bits_per_raw_sample: 'N/A',
          nb_frames: 38,
          nb_read_frames: 'N/A',
          nb_read_packets: 'N/A',
          tags: [Object],
          disposition: [Object] },
        { index: 3,
          codec_name: 'unknown',
          codec_long_name: 'unknown',
          profile: 'unknown',
          codec_type: 'data',
          codec_tag_string: 'mebx',
          codec_tag: '0x7862656d',
          id: 'N/A',
          r_frame_rate: '0/0',
          avg_frame_rate: '0/0',
          time_base: '1/600',
          start_pts: 'N/A',
          start_time: 'N/A',
          duration_ts: 6666,
          duration: 11.11,
          bit_rate: 7,
          max_bit_rate: 'N/A',
          bits_per_raw_sample: 'N/A',
          nb_frames: 1,
          nb_read_frames: 'N/A',
          nb_read_packets: 'N/A',
          tags: [Object],
          disposition: [Object] },
        { index: 4,
          codec_name: 'unknown',
          codec_long_name: 'unknown',
          profile: 'unknown',
          codec_type: 'data',
          codec_tag_string: 'mebx',
          codec_tag: '0x7862656d',
          id: 'N/A',
          r_frame_rate: '0/0',
          avg_frame_rate: '0/0',
          time_base: '1/600',
          start_pts: 'N/A',
          start_time: 'N/A',
          duration_ts: 6666,
          duration: 11.11,
          bit_rate: 18117,
          max_bit_rate: 'N/A',
          bits_per_raw_sample: 'N/A',
          nb_frames: 333,
          nb_read_frames: 'N/A',
          nb_read_packets: 'N/A',
          tags: [Object],
          disposition: [Object] } ],
     format:
      { filename: 'pipe:0',
        nb_streams: 5,
        nb_programs: 0,
        format_name: 'mov,mp4,m4a,3gp,3g2,mj2',
        format_long_name: 'QuickTime / MOV',
        start_time: 'N/A',
        duration: 11.11,
        size: 'N/A',
        bit_rate: 'N/A',
        probe_score: 100,
        tags:
         { major_brand: 'qt  ',
           minor_version: '0',
           compatible_brands: 'qt  ',
           creation_time: '2020-01-11T12:33:36.000000Z',
           'com.apple.quicktime.make': 'Apple',
           'com.apple.quicktime.model': 'iPhone 11',
           'com.apple.quicktime.software': '13.3',
           'com.apple.quicktime.creationdate': '2020-01-11T13:33:36+0100' } },
     chapters: [] }"

    The created .mp3 file results in a undefined.

    I already tried to take the .mov re-encode it to an .mp4 via ffmpeg and then try the above code to get the .mp3 - still does not work.

    Any advice how I can make this work ?

    thanks !


    UPDATE 1
    The problem resides in the input stream ! When I download the file to the local machine and input it as as a local file, not as a read stream, it works perfectly.

    I am creating the stream from a google cloud bucket like this :

    const myBucket = storage.bucket('myBucket');
    const remoteReadStream = myBucket.file(file).createReadStream();

    Since this code is perfectly working with all other codecs, what maybe the issue while creating the read stream from the google cloud from a h265 file ?

  • Video size optimization

    21 janvier 2020, par Heba Gamal Eldin

    I’m working on a task that should optimize the video’s size before uploading to the server in a web application.
    So i want my model to automatically optimize each input video size.

    I have many trials in different approaches like FFmpeg :
    I used libx265, h264 and lib265 as a codec, with some videos it increases the video size and others minimize it with little ratio and it takes so long to generate the output file.

    for example with video of size 8M

    input = {input_name: None}
    output = {output_name: '-n preset faster -vcodec libx265 -crf 28'}

    The output file is 10M.

    And also tried OpenCV :
    But the output videos aren’t written the file appears 0kb size.

    ex : with input video resolution (1280×544)
    I want to down scale it by :

    cap= cv2.VideoCapture(file_name)
    cap.set(3,640)
    cap.set(4,480)
    codec = cv2.VideoWriter_fourcc(*'XDIV')
    out = cv2.VideoWriter(output_file, codec, 28.0 , (640,480))
    While cap.isOpened():
      bol, frame = cap.read()
      out.write(frame)
      cv2.imshow('video', frame)

    I become little bit confused. what are the parameters of the input,output videos i should consider to be optimized and make a vital size change in each specific video ? Is it the codec, width, height only ?

    What is the most effective approach to do this ?

    Should i build a predictive model for estimating the suitable output video file parameters or there is a method that auto adjust ?

    if there’s an illustrative example please provide me.

  • How to solve javacv ExceptionInInitializerError [closed]

    6 juin, par shihui wei

    I want to combine multiple images into a gif. I chose ffmpeg. I learned that there are binary dependencies including ffmpeg in java, so I chose javacv

    


    First, I added the dependency of javacv to my pom file:

    


            <dependency>&#xA;            <groupid>org.bytedeco</groupid>&#xA;            <artifactid>javacv-platform</artifactid>&#xA;            <version>1.5.11</version>&#xA;        </dependency>&#xA;

    &#xA;

    Then I wrote a code to synthesize GIF from multiple images.

    &#xA;

    public static byte[] encodeGif(List<bufferedimage> frames, int frameDelayMs, boolean loopForever) {&#xA;&#xA;        if (frames == null || frames.isEmpty()) {&#xA;            throw new IllegalArgumentException("frames 不能为空");&#xA;        }&#xA;        int width = frames.get(0).getWidth();&#xA;        int height = frames.get(0).getHeight();&#xA;&#xA;        // ByteArrayOutputStream &#x2B; FFmpegFrameRecorder&#xA;        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {&#xA;            &#xA;            try (FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(baos, width, height)) {&#xA;                recorder.setFormat("gif");&#xA;                recorder.setFrameRate(1000.0 / frameDelayMs);&#xA;&#xA;                recorder.setOption("loop", loopForever ? "0" : "1");&#xA;&#xA;                recorder.start();&#xA;&#xA;                Java2DFrameConverter converter = new Java2DFrameConverter();&#xA;                for (BufferedImage img : frames) {&#xA;                    // 把 BufferedImage 转成 Frame&#xA;                    Frame frame = converter.convert(img);&#xA;                    recorder.record(frame);&#xA;                }&#xA;&#xA;                recorder.stop();&#xA;            }&#xA;            return baos.toByteArray();&#xA;        } catch (Exception e) {&#xA;            log.error("FastGifUtil.encodeGif 失败", e);&#xA;            throw new RuntimeException("生成 GIF 失败", e);&#xA;        }&#xA;&#xA;    }&#xA;</bufferedimage>

    &#xA;

    Finally, I have prepared data to test, Below is my test code:

    &#xA;

        public void testGenerateGif() {&#xA;        log.info(">>>>>>>>>>> start get bufferedImage &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        List<bufferedimage> bufferedImages = batchTaskUtils.batchIOTask(urls, url -> {&#xA;            byte[] byteData = imageClientUtils.byteData(url);&#xA;            return OpencvUtils.byteToBufferedImage(byteData);&#xA;        });&#xA;        log.info(">>>>>>>>>>> start generate gif &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        long time = System.currentTimeMillis();&#xA;        byte[] bytes = GifUtils.encodeGif(bufferedImages, 50, true);&#xA;        log.info("{}", System.currentTimeMillis() - time);&#xA;        log.info(">>>>>>>>>>> start upload gif &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;");&#xA;        String upload = upload(bytes);&#xA;        log.info("{}", upload);&#xA;&#xA;    }&#xA;</bufferedimage>

    &#xA;

    However, I encountered a difficult problem : I cannot load the FFmpegFrameRecorder class. The exception error is :

    &#xA;

    java.lang.ExceptionInInitializerError&#xA;    at org.bytedeco.javacv.FFmpegFrameRecorder.<clinit>(FFmpegFrameRecorder.java:356)&#xA;    at com.kuaishou.qa.utils.GifUtils.encodeGif(GifUtils.java:29)&#xA;    at com.kuaishou.qa.AnimationDiffTest.testGenerateGif(AnimationDiffTest.java:88)&#xA;    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&#xA;    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&#xA;    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&#xA;    at java.base/java.lang.reflect.Method.invoke(Method.java:566)&#xA;    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)&#xA;    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)&#xA;    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)&#xA;    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)&#xA;</clinit>

    &#xA;